[Rd] Error from wilcox.test

Wolfgang Huber huber at ebi.ac.uk
Tue Jan 1 22:53:06 CET 2008


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



More information about the R-devel mailing list