Learn R Programming

flip (version 2.4.3)

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

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.

rom computes a Random Orthogonal Matrix of size nXn.

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)
rom(N)
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. It is also the dimention of the random orthogonal matrix in rom.

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 all possible flips, then compute the complete space.

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

Details

rom implements the algorithm of Stewart (1980). The function is compiled in C++.

References

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

Stewart, G. W. (1980). The efficient generation of random orthogonal matrices with an application to condition estimators. SIAM Journal on Numerical Analysis 17, 403-409.

See Also

flip

Examples

Run this code
# NOT RUN {
#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)

# }
# NOT RUN {
#A random rotation matrix of size 3
(r=rom(3))
#verify that it is orthogonal:
r<!-- %*%t(r) -->
# }

Run the code above in your browser using DataLab