Next: reml() Up: Design Macros Help File Previous: randt2()   Contents

# randt()

Usage:
 ```randt(dvec, m [,trials:n]), REAL vector dvec, positive integer n ```

Keywords: permutation test, analysis
```randt(dvec,m) computes xbar_1 - xbar_2 for all combinations with m data
values from dvec in group 1 and the remainder in group 2.  The returned
value is a vector containing all the differences.  dvec must be a REAL
vector with no MISSING values and m > 0 an integer with m < length(dvec).

randt(dvec,m,trials:n) samples from the distribution of xbar_1 - xbar_2
using n independent sets of random assignments to the groups.

You can use the results of randt() to compute p-values for the
randomization equivalent of the two sample t-test by finding the
fraction of the differences as extreme or more extreme than the observed
difference for the two groups.  You may need to be a little careful in
making the comparison because there may not be an exact match of the
observed difference of means and the values returned by randt() because of
minor differences in rounding .

Examples:
Cmd> y1 <- vector(6.5,6,7.1,7.1,3.5,6.1) # group 1 data

Cmd> y2 <- vector(3.9,4.9,2.1,7.7,4.9) # group 2 data

Cmd> d <- sum(y1)/6 - sum(y2)/5; d  # difference of means
(1)        1.35

Cmd> out <- randt2(vector(y1,y2), length(y1))

Cmd> length(out) # how many are there?
(1)         462

Cmd> sum(round(out - d,12) >= 0)/462 #one-sided permutation P-value
(1)     0.20996

Cmd> stemleaf(out)  # how do they look
3  -2.|665
12  -2*|222200000
37  -1.|8888888887766666666665555
83  -1*|4444444433333322222222222222111111110000000000
151  -0.|9999999999888888888888888887777777777777777766666666666555*
( 81) -0*|4444444444444444444333333333333333333322222222222221111111*
230  +0*|0000000000001111111111111111111112222222222222222223333333*
154  +0.|5555555555555555566666666666666666677777777778888888889999*
86   1*|00000000000011111111111112222222333333333444444444
36   1.|5555556666667778889999
14   2*|0000001334444
1   2.|8