I am trying to find the critical value for the Wilcoxon one-sample signed-rank test. Currently, I can find the value using tables. I looked at qwilcox()
in R, but it appears that this gives the critical values for the Wilcoxon two-sample test (or Mann–Whitney test). Is there a function in R
which I can use to compute this critical value?
1 Answer
You can use the qsignrank()
function. Example:
> qsignrank(.025, 10, lower.tail=FALSE)
46
This means that for a sample size of 10 and a two-sided test with a significance level of 5%, the test statistic must be greater than 46 (i.e., 47 or greater) to be statistically significant. Example data:
> set.seed(1)
> x = rnorm(10, .5)
> wilcox.test(x)
Wilcoxon signed rank test
data: x
V = 47, p-value = 0.04883
alternative hypothesis: true location is not equal to 0
Here the test statistic is 47, and significant at the 5% level.
Note that for a two-sided test, the test statistic returned by qsignrank()
is the larger of the two possible test statistics. For example, wilcox.test(-x)
gives a test statistic of 8, which can be transformed into 47 by $\frac{10\cdot 11}{2}-8$.
-
1$\begingroup$ I guess we have to subtract 1 from the result of
qsignrank
in order to obtain the critical value.. As mentioned here -stats.stackexchange.com/questions/32445/… $\endgroup$– DineshFeb 25, 2015 at 23:04