Skip to content
Prev 10180 / 63424 Next

wilcox.test, CI (PR#3666)

The conditional distribution cannot be computed for data with zeros in
'wilcox.test' and therefore the asymptotic distribution is used instead:

R> wilcox.test(c(2,1,4,3,6,-5,0),conf.int = FALSE)

        Wilcoxon signed rank test with continuity correction

data:  c(2, 1, 4, 3, 6, -5, 0)
V = 16, p-value = 0.2945
alternative hypothesis: true mu is not equal to 0

Warning message:
Cannot compute exact p-value with zeroes in: wilcox.test.default(c(2, 1,
4, 3, 6, -5, 0), co
nf.int = FALSE)

and in this special case 'uniroot' fails when searching for the confidence
limits (which I wouldn't trust anyway for such small sample sizes).

As a workaround you can use

R> wilcox.exact(c(2,1,4,3,6,-5,0),conf.int = TRUE)

        Exact Wilcoxon signed rank test

data:  c(2, 1, 4, 3, 6, -5, 0)
V = 16, p-value = 0.3125
alternative hypothesis: true mu is not equal to 0
95 percent confidence interval:
 -5  6
sample estimates:
(pseudo)median
           2.5

from package 'exactRankTests' which derives the confidence
limits from the conditional distribution.

Best,

Torsten