Re: [Rd] Error from wilcox.test

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Wed, 2 Jan 2008 08:19:11 +0000 (GMT)

On Wed, 2 Jan 2008, Prof Brian Ripley wrote:

> Try exact = TRUE: the default switches to a normal approximation that will
> not be adequate in your extreme example.

I've modified the code in R-devel to give an answer in such extreme cases, but note that the p-value is pretty inaccurate, and so is the coverage of the reported CI.

> On Tue, 1 Jan 2008, Wolfgang Huber wrote:
>
>> When one of the two groups has only one member and the other one more
>> than 49, wilcox.test will exit with the below error message,
>>
>> n=51; wilcox.test(1:n ~ 1:n==1, conf.int=TRUE)
>>
>> Error in uniroot(wdiff, c(mumin, mumax), tol = 1e-04, zq =
>> qnorm(alpha/2, :
>> f() values at end points not of opposite sign
>>
>>
>> whereas with n=50 a result is returned:
>>
>> n=50; wilcox.test(1:n ~ 1:n==1, conf.int=TRUE)
>>
>> Wilcoxon rank sum test
>>
>> data: 1:n by 1:n == 1
>> W = 49, p-value = 0.04
>> alternative hypothesis: true location shift is not equal to 0
>> 95 percent confidence interval:
>> 1 49
>> sample estimates:
>> difference in location
>> 25
>>
>>
>> I wonder whether it would be worthwhile to make the wilcox.test function
>> handle such (admittedly pathologic) cases more gracefully.
>>
>>
>> Happy New Year to all -
>> Wolfgang
>>
>> ------------------------------------------------------------------
>> Wolfgang Huber EBI/EMBL Cambridge UK http://www.ebi.ac.uk/huber

-- 
Brian D. Ripley,                  ripley_at_stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed 02 Jan 2008 - 08:21:33 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 Jan 2008 - 19:30:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive