[Rd] CI for wilcoxon test (PR#895)
kylouskova@euromise.cz
kylouskova@euromise.cz
Thu, 5 Apr 2001 11:02:48 +0200 (MET DST)
Full_Name: Marketa Kylouskova
Version: 1.2.1
OS: Windows
Submission from: (NULL) (147.231.7.2)
Hi,
I believe there is a bug in the extension of wilcox.test, namely in
determination of confidence intervals. I concentrated on the two-sample test
only. I examined and tested its performance on this working data set:
x<-rnorm(10,3,1) # So I have two samples, I will test whether
y<-rnorm(10,0,1) # x is greater than y, i.e. one-sided alternative “greater”
say
x<-c(3.770684,4.654342,3.496403,1.772743,1.624953,2.645835,3.099477,1.706758,3.507709,1.982924)
y<-c(-0.8161288,0.1632923,0.6421997,1.9270846,-0.4668112,0.3587806,0.3312529,-0.5393900,
0.1057892,1.7963575)
then
wilcox.test(x,y,alternative="greater",conf.int=T)
gives
Wilcoxon rank sum test
data: x and y
W = 94, p-value = 0.0001624
alternative hypothesis: true mu is greater than 0
95 percent confidence interval:
-3.344416 NA
which is apparently contradictory (p-value is much less than 0.05 while exact CI
contains 0). I examined the code and I found that while the exact wilcoxon test
is applied on ranks of x (thus testing that mu = x – y is greater than 0), the
exact CI is computed based on differences y - x, hence finding a CI for mu = y –
x). The same applies, in my opinion, to approximative CI, where he optimization
interval is set as (mumin,mumax) with
mumin <- min(y) - max(x)
mumax <- max(y) - min(x)
I didn’t go through other aspects, although I believe that the continuity
correction should be checked if some changes are made, and also that some closer
look onto definitions of uci and lci in the exact CI computations should be made
(here it depends on your definition of the CI for exact distributions, i.e.
whether the CI = {uci<=mu<lci} (then I think it’s OK) or CI = {uci<=mu<=lci}
(then I think lci= diffs[ql] and not diffs[ql + 1]). Could this be specified in
the documentation?
Thank you in advance for checking my suspicions :) and for your reaction.
Marketa Kylouskova
kylouskova@euromise.cz
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._