[R] Confidence interval in the Wilcoxon exact test

Thomas Lumley tlumley at u.washington.edu
Sat Sep 30 00:15:32 CEST 2006

On Fri, 29 Sep 2006, Jue.Wang2 at sanofi-aventis.com wrote:

> Hi,
> Two functions wilcox.exact and wilcox_test give slightly different 
> confidence intervals of the difference of the medians: for example
> y<-c(0,0,1.081,0.594,0,0.769,0,0.009,0,0,0.798,0.405,0.498,0.946,1.35,1.149,0.528)
> x<-c(rep(1,10),rep(2,7))
> aa<-wilcox.exact(y~x,conf.int=TRUE)
> bb<-wilcox_test(y~factor(x),distribution="exact",conf.int=TRUE)
> aa
> bb
> Does anyone know why?

The help for wilcox.test says
      'wilcox.exact' in 'exactRankTests' covers much of the same ground,
      but also produces exact p-values in the presence of ties.
so that is probably the explanation.

However, since your x and y can't really have come from distributions 
differing only by a location shift, the confidence interval isn't valid 
anyway (and the test is valid only to reject the strong null hypothesis 
that the distributions are the same, not anything about medians)


More information about the R-help mailing list