flipn {nptest}R Documentation

Generate All Sign-Flips of n Elements

Description

Generates all 2^n vectors of length n consisting of the elements -1 and 1.

Usage

flipn(n)

Arguments

n

Number of elements.

Details

Adapted from the "bincombinations" function in the e1071 R package.

Value

Matrix of dimension n by 2^n where each column contains a unique sign-flip vector.

Warning

For large n this function will consume a lot of memory and may even crash R.

Note

Used for exact tests in np.loc.test and np.reg.test.

Author(s)

Nathaniel E. Helwig <helwig@umn.edu>

References

Meyer, D., Dimitriadou, E., Hornik, K., Weingessel, A., & Leisch, F. (2018). e1071: Misc Functions of the Department of Statistics, Probability Theory Group (Formerly: E1071), TU Wien. R package version 1.7-0. https://CRAN.R-project.org/package=e1071

Examples

flipn(2)
flipn(3)

[Package nptest version 1.1 Index]