> Full_Name: David Wooff
> Version: 1.7.0
> OS: i686-pc-linux-gnu
> Submission from: (NULL) (129.234.4.10)
>
>
> wilcox.test exits with error message when confidence interval required,
under
> some situations. I suspect this occurs when the data contain a zero and for
some
> data lengths only:
>
> print(wilcox.test(c(2,1,4,3,6,-5,0),conf.int=T))
>
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
> fails
>
> print(wilcox.test(c(2,1,4,3,6,-5,0,1),conf.int=T))
>
> works
>
> print(wilcox.test(c(2,1,4,3,6,-5,1),conf.int=T))
>
> works
>
> Apologies if this is known - did search bug lists first.
>
> David.
>
> ______________________________________________
> R-devel@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
>
>