wilcox.exact function (PR#8856)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

wilcox.exact function (PR#8856)

pat.hodgson
Full_Name: Patrick Hodgson
Version: 2.0
OS: solaris 2.9
Submission from: (NULL) (65.94.128.161)


The value reported for the parameter W in the function wilcox.exact appears to
be incorrect.  I have checked the reference in the help file for this function
(Myles & Hollander 1973, as well as 2nd ed. 1999 by same authors) and it is
clear that W is the sum of the ranks of the data set with the smaller number of
members.
Here is sample input/output:
> x<-c(1,2,3,4,5,6,7,8,9,10)
> y<-c(11,12,13,14,15)          
> library(exactRankTests)
> wil<-wilcox.exact(x,y)
> wil

        Exact Wilcoxon rank sum test

data:  x and y
W = 0, p-value = 0.000666
alternative hypothesis: true mu is not equal to 0

In this case W should be the sum of the ranks of y (coincidentally also the
values of the y data)= 11+12+13+14+15 = 65.
W of zero is ridiculous.

Similarly, in this case W should be 2+4+6+8 = 20, not 10 as reported.
> x<-c(1,3,5,7,9)
> y<-c(2,4,6,8)
> wil<-wilcox.exact(x,y)
> wil

        Exact Wilcoxon rank sum test

data:  x and y
W = 10, p-value = 1
alternative hypothesis: true mu is not equal to 0

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: wilcox.exact function (PR#8856)

Peter Dalgaard
[hidden email] writes:

> Full_Name: Patrick Hodgson
> Version: 2.0
> OS: solaris 2.9
> Submission from: (NULL) (65.94.128.161)
>
>
> The value reported for the parameter W in the function wilcox.exact appears to
> be incorrect.  I have checked the reference in the help file for this function
> (Myles & Hollander 1973, as well as 2nd ed. 1999 by same authors) and it is
> clear that W is the sum of the ranks of the data set with the smaller number of
> members.

You should not use the bug repository to report on a (non-core)
package. However, it is the same W used by wilcox.test and
help(wilcox.test)  has the explanation.



> Here is sample input/output:
> > x<-c(1,2,3,4,5,6,7,8,9,10)
> > y<-c(11,12,13,14,15)          
> > library(exactRankTests)
> > wil<-wilcox.exact(x,y)
> > wil
>
>         Exact Wilcoxon rank sum test
>
> data:  x and y
> W = 0, p-value = 0.000666
> alternative hypothesis: true mu is not equal to 0
>
> In this case W should be the sum of the ranks of y (coincidentally also the
> values of the y data)= 11+12+13+14+15 = 65.
> W of zero is ridiculous.
>
> Similarly, in this case W should be 2+4+6+8 = 20, not 10 as reported.
> > x<-c(1,3,5,7,9)
> > y<-c(2,4,6,8)
> > wil<-wilcox.exact(x,y)
> > wil
>
>         Exact Wilcoxon rank sum test
>
> data:  x and y
> W = 10, p-value = 1
> alternative hypothesis: true mu is not equal to 0
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

--
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - ([hidden email])                  FAX: (+45) 35327907

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel