Learn R Programming

flip (version 2.0)

permutationSpace: These functions handle the orbit (i.e. permutation space) of permutation tests.

Description

make.permSpace computes the perms x n matrix of ids used for test of dependence. make.signSpace computes the perms x n vector of +1 and -1 used for symmetry test. In both functions the element corresponding to the observed data is on the first row. t2p computes the (possibily multivariate) space of p-values from the space of test statistic.

Usage

make.permSpace(IDs,perms,return.permIDs=FALSE,testType="permutation",Strata=NULL)
make.signSpace(N, perms)
allpermutations(Y)
npermutations(Y)
t2p(T, obs.only = TRUE, tail)

Arguments

IDs
vector of IDs to be permuted. If IDs is a scalar, it is replaced with 1:IDs.
return.permIDs
logical. If TRUE, the matrix of permuted IDs is stored and returned. Only used with testType="permutaiton"
N
number of elements of the sample.
Y
a vector of data. It can also be a vector 1:N referring to the IDs of observations.
perms
number of random permutations. If it is a list, it has two elements number (the number of random permutation requested) and seed (the seed to be set when start generating. it is useful for reproducibility) If perms > number of
T
the (possibly multivariate) permutation space as returned, for example by flip
obs.only
logical. If TRUE only the p-value for observed test statistic is returned, otherwise the whole space is computed
tail
Tail of the distribution being significant for H1. See also argument tail in flip
testType
See argument testType in flip
Strata
See argument testType in flip

References

Pesarin (2001) Multivariate Permutation Tests with Applications in Biostatistics. Wiley, Mew York.

See Also

flip

Examples

Run this code
#10 random elements of the orbit of a one-sample test
make.signSpace(5, 10)

#All elements of the orbit of a one-sample test (the size of the space is 2^5 < 1000)
make.signSpace(5, 1000)

Run the code above in your browser using DataLab