Exact permutation p-values
Calculates exact p-values for permutation tests when permutations are randomly drawn with replacement.
permp(x, nperm, n1, n2, total.nperm=NULL, method="auto", twosided=TRUE)
- number of permutations that yielded test statistics at least as extreme as the observed data. May be a vector or an array of values.
- total number of permutations performed.
- sample size of group 1. Not required if
- sample size of group 2. Not required if
- total number of permutations allowable from the design of the experiment.
- character string indicating computation method. Possible values are
- logical, is the test two-sided and symmetric between the two groups?
This function can be used for calculating exact p-values for permutation tests where permutations are sampled with replacement, using theory and methods developed by Phipson and Smyth (2010).
The input values are the total number of permutations done (
nperm) and the number of these that were considered at least as extreme as the observed data (
total.nperm is the total number of distinct values of the test statistic that are possible.
This is generally equal to the number of possible permutations, unless a two-sided test is conducted with equal sample sizes, in which case
total.nperm is half the number of permutations, because the test statistic must then be symmetric in the two groups.
total.nperm is computed automatically from
n2, but can also be supplied directly by the user.
method="exact", the p-values are computed to full machine precision by summing a series terms.
method="approximate", an approximation is used that is faster and uses less memory.
method="auto", the exact calculation is used when
total.nperm is less than or equal to 10,000 and the approximation is used otherwise.
- vector or array of p-values, of same dimensions as
Phipson B, and Smyth GK (2010).
Permutation p-values should never be zero: calculating exact p-values when permutations are randomly drawn.
Statistical Applications in Genetics and Molecular Biology, Volume 9, Article 39.
x <- 0:5 # Both calls give same results permp(x=x, nperm=99, n1=6, n2=6) permp(x=x, nperm=99, total.nperm=462)