Learn R Programming

flip (version 2.5.0)

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.

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. Defaults: TRUE if T is a flip-object, FALSE otherwise.

tail

Tail of the distribution being significant for H1. See also argument tail in flip. Defaults: 1 if T is NOT a flip-object, it is taken from T otherwise.

testType

See argument testType in flip

Strata

See argument testType in flip

X

A vector of length N with a different value for each group. Only used together with testType="combination".

...

other parameters

Details

rom computes a Random Orthogonal Matrix of size nXn (C-compiled function, very fast). implements the algorithm of Stewart (1980). The function is compiled in C++. NOTE: this option is not available in the newest versions. This is now equivalent to romFast

romFast computes a Random Orthogonal Matrix of size nXn using the qr.Q decomposition. romFast is faster than rom but can be inaccurate (i.e. providing inaccurate type I error control when used in testing), specially for very small n (i.e. sample size).

allpermutations computes all permutations of a vector Y. Is is based on the function permutations of the library(e1071).

t2p computes the (possibily multivariate) space of p-values from the space of test statistic.

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)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab