A simple function to compute a permutation t-test.

Share:

Description

The data matrix, x, with two-level factor, fac, is used to compute t-tests. The values of fac are permuted B times and the complete set of t-tests is performed for each permutation.

Usage

1
ttperm(x, fac, B = 100, tsO = TRUE)

Arguments

x

A data matrix. The number of columns should be the same as the length of fac.

fac

A factor with two levels.

B

An integer specifying the number of permutations.

tsO

A logical indicating whether to compute only the t-test statistic for each permuation. If FALSE then p-values are also computed - but this can be very slow.

Details

Not much more to say. Probably there is a generic function somewhere, but I could not find it.

Value

A list, the first element is named obs and contains the true, observed, values of the t-statistic. The second element is named ans and contains a list of length B containing the different permuations.

Author(s)

R. Gentleman

See Also

rowttests

Examples

1
2
3
   x=matrix(rnorm(100), nc=10)
   y = factor(rep(c("A","B"), c(5,5)))
   ttperm(x, y, 10)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.