nestedRanksTest_Z is used by
calculate the Z-score for the ranks of responses
into two treatment levels.
nestedRanksTest_Z(y, n1, n2)
Values to be ranked for the test. Its length must
be equal to the sum of
Values across both treatments are ranked using the base R function
ties.method = "average", which assigns
tied values their average rank. The Mann-Whitney-Wilcoxon test
statistic is computed from these ranks. Because the value of the
statistic is sample-size dependent (between
n1*n2), it is scaled to be
[-1,+1] by dividing by
The bottleneck for bootstrapping is calculation of ranks, so the most
straightforward way to speed up
nestedRanksTest would come from
rank. Because of the checks performed prior to
calling this routine, it should be sufficient to use a stripped-down
function that simply does the equivalent of making an
call, which is not allowed within package code. As of this writing, this
rank_new <- function (x) .Internal(rank(x, length(x), "average"))
For the example data this is 8-9 times faster than the base R
because it avoids error-checking overhead. For longer vectors, the
advantage decreases such that at 10000 elements it is 20-30%.
The calculated Z-score
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.