twilight.combi {twilight} | R Documentation

## All permutations of a binary vector

### Description

For a given binary input vector, the function completely enumerates all possible permutations.

### Usage

    twilight.combi(xin, pin, bin)

### Arguments

`xin` | Binary input vector, e.g. class labels.
`pin` | Logical value. `TRUE` if samples are paired, `FALSE` if not.
`bin` | Logical value. `TRUE` if permutations should be balanced, `FALSE` if not.

### Details

Please note, that the resulting permutations are always as "balanced" as possible. The balancing is done for the smaller subsample. If its sample size is odd, say 5, `twilight.combi` computes all permutations with 2 or 3 samples unchanged. In the paired case, the output matrix contains only one half of all permutations. The second half is simply 1-`output` which leads to the same absolute test statistics in a paired test.

### Value

Returns a matrix where each row contains one permuted vector. Note that even for balanced permutations, the first row always contains the original vector. If the number of rows exceeds 10000, `NULL` is returned.

### Author(s)

Stefanie Scheid http://www.molgen.mpg.de/~scheid

### References

Scheid S and Spang R (2004): A stochastic downhill search algorithm for estimating the local false discovery rate, IEEE TCBB 1(3), 98–108.

### See Also

`twilight.permute.pair`, `twilight.permute.unpair`

### Examples

    x <- c(rep(0,4),rep(1,3))
    y <- twilight.combi(x,pin=FALSE,bin=FALSE)

[Package twilight version 1.1.0 Index]