[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) (

	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”





         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

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