rowWilcoxonTests | R Documentation |
Wilcoxon rank sum tests for each row of a matrix
rowWilcoxonTests(
mat,
categ,
alternative = c("two.sided", "less", "greater"),
correct = TRUE
)
mat |
A |
categ |
Either a numeric vector of |
alternative |
A character string specifying the alternative hypothesis.
Must be one of "two.sided" (default), "greater" or "less". As in
|
correct |
A logical indicating whether to apply continuity correction in the normal approximation for the p-value. |
This function performs m x B
Wilcoxon T tests on
n
observations. It is vectorized along the rows of mat
. This
makes the code much faster than using loops of 'apply' functions,
especially for high-dimensional problems (small n and large m) because the
overhead of the call to the 'wilcox.test' function is avoided. Note that it
is not vectorized along the columns of categ
(if any), as a basic
'for' loop is used.
The p-values are computed using the normal approximation as
described in the wilcox.test
function. The exact p-values
(which can be useful for small samples with no ties) are not implemented
(yet).
For simplicity, 'estimate' returns the difference between the group medians, which does not match the component 'estimate' output by wilcox.test
A list containing the following components:
the value of the statistics
the p-values for the tests
A list containing the following components:
the value of the statistics
the p-values for the tests
the median difference between groups (only calculated if B=1
for computational efficiency)
Each of these elements is a matrix of size m x B
, coerced to a vector of length m
if B=1
Gilles Blanchard, Pierre Neuvial and Etienne Roquain
wilcox.test
p <- 200
n <- 50
mat <- matrix(rnorm(p*n), ncol = n)
cls <- rep(c(0, 1), each = n/2)
stats <- rowWilcoxonTests(mat, categ = cls, alternative = "two.sided")
str(stats)
# permutation of class labels
cls_perm <- replicate(11, sample(cls))
stats <- rowWilcoxonTests(mat, categ = cls_perm, alternative = "two.sided")
str(stats)
# several unrelated contrasts
cls2 <- cls
cls[1:10] <- 1 # varying nx, ny
cls_mat <- cbind(cls, cls2)
stats <- rowWilcoxonTests(mat, categ = cls_mat, alternative = "two.sided")
str(stats)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.