[R] one (small) sample wilcox.test confidence intervals

peter dalgaard pdalgd at gmail.com
Tue Aug 10 14:41:19 CEST 2010


On Aug 10, 2010, at 1:30 PM, Panos Hadjinicolaou wrote:

> My questions (finally!) are:
> 
> 1.  Why the above warning for conf.lev = 0.99 does not appear for 0.93 <  conf.lev < 0.98 although it produces the same summary?
> 
> 2. For  conf.lev = 0.95, is there anything else I can do in order to obtain  confidence intervals other than the max. and min. values of my sample  or I am limited from my sample's size ?
> 
> Thanks for your patience in reading this,
> 
> Panos


It is as it should be. 

I think it is instructive to look at explicitly shifted samples, e.g.

> wilcox.test(sample-1.369)

	Wilcoxon signed rank test

data:  sample - 1.369 
V = 1, p-value = 0.0625
alternative hypothesis: true location is not equal to 0 

> wilcox.test(sample-1.371)

	Wilcoxon signed rank test

data:  sample - 1.371 
V = 0, p-value = 0.03125
alternative hypothesis: true location is not equal to 0 

Notice how the p-value jumps as the shift crosses 1.37. You can shift the distribution by 1.369999 to the left and have nonsignificant test that the center is at zero. However if you shift by more than 1.37, then you do get significance. This is true for all significance levels between 0.03125 and 0.0625 (and 0.03125 == 1/32, the probability that all ranks have the same sign). 

The above explains almost everything if you think a little about the definitions. The only slightly puzzling thing is why confidence levels larger than 1-0.03125 are considered achievable. The actual code has

                if (achieved.alpha - alpha > alpha/2) {
                  warning("Requested conf.level not achievable")
                  conf.level <- 1 - signif(achieved.alpha, 2)
                }

so I have to assume that the author has considered this with some care.


-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list