Re: [R] Confidence interval in the Wilcoxon exact test

From: Thomas Lumley <>
Date: Fri 29 Sep 2006 - 22:15:32 GMT

On Fri, 29 Sep 2006, 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,
> bb<-wilcox_test(y~factor(x),distribution="exact",
> 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)

         -thomas mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Sat Sep 30 08:24:11 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 29 Sep 2006 - 22:30:07 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.