[Rd] feature and bug in wilcox.test
Fritz Scholz
fscholz at u.washington.edu
Tue Sep 8 22:22:27 CEST 2009
Dear Developers Team,
I have two items:
1. wilcox.test with the paired=T option appears to delete zeros
before ranking absolute differences.
Would it be possible to add the feature of removing
zeros after ranking, which is given in Lehmann's Nonparametrics
as the preferred choice. See also Pratt (1959), JASA 54, 655-667.
It is given in wilcoxsign_test of the coin package as an
option through the argument ties="Pratt" as opposed to
ties="HollanderWolfe" (default). I understand this this might
be more difficult for wilcox.test because of the method
for calculating the null distribution.
2. For the following two samples
Augmenters <- c(17.94,13.32,11.31,10.62,7.56,
5.73,5.61,5.40,3.30,3.09,.93)
Reducers <- c(7.74,5.04,1.68,0.0,-3.03,-3.09,-10.53)
I get the following strange confidence percentage of 91.46556
together with a warning message, when asking for a 95% lower bound.
I had the impression that wilcox.test would only echo back the input
confidence level.
When I ask for a 90% interval I get the same correct lower bound
without the strange percentage and without warnings. The actual
confidence coefficient of the lower bound 3.09 is 0.9573
(conservatively) and one gets lower bound 3.3 with confidence
coefficient 0.9479 if the achievable confidence level closest to
.95 is desired.
wilcox.test(Augmenters,Reducers,conf.int=T,conf.level=.95,alternative="greater",exact=T)
Wilcoxon rank sum test
data: Augmenters and Reducers
W = 66, p-value = 0.005688
alternative hypothesis: true location shift is greater than 0
91.46556 percent confidence interval:
3.09 Inf
sample estimates:
difference in location
7.56
Warning message:
In switch(alternative, two.sided = { : Requested conf.level not
achievable
wilcox.test(Augmenters,Reducers,conf.int=T,conf.level=.9,alternative="two.sided",exact=T)
Wilcoxon rank sum test
data: Augmenters and Reducers
W = 66, p-value = 0.01138
alternative hypothesis: true location shift is not equal to 0
90 percent confidence interval:
3.09 13.62
sample estimates:
difference in location
7.56
Thanks very much for any help or fix, especially with regard to
item 2.
Fritz Scholz
fscholz at u.washington.edu
More information about the R-devel
mailing list