get_perm | R Documentation |
Get a matrix of statistics and p-values under the null hypothesis obtained by repeated permutation of class labels (two-sample tests)
get_perm(
X,
categ,
B,
rowTestFUN = rowWelchTests,
alternative = c("two.sided", "less", "greater")
)
X |
A matrix of |
categ |
An numeric vector of |
B |
An integer value, the number of permutations to be performed |
rowTestFUN |
a vectorized testing function (same I/O as rowWelchTests) |
alternative |
A character string specifying the alternative hypothesis, to be passed to |
The element 'p.value' of the output is a m x B
matrix whose entry i,j corresponds to p_{(i)}(g_j.X)
with notation of the AoS 2020 paper cited below (section 4.5).
m <- 50
n <- 45
X <- matrix(rnorm(m*n), ncol = n, nrow = m)
categ <- rbinom(n, 1, 0.4)
B <- 10
set.seed(123)
perm0 <- sanssouci:::get_perm(X, categ, B, rowWelchTests)
# for this particular test 'get_perm' can be bypassed
set.seed(123)
null_groups <- replicate(B, sample(categ))
perm <- rowWelchTests(X, null_groups)
identical(perm0$p.value, perm$p.value)
identical(perm0$statistic, perm$statistic)
# Wilcoxon tests
set.seed(123)
perm0 <- sanssouci:::get_perm(X, categ, B, rowWilcoxonTests)
perm <- rowWilcoxonTests(X, null_groups)
identical(perm0$p.value, perm$p.value)
identical(perm0$statistic, perm$statistic)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.