Skip to content
Prev 33177 / 398506 Next

qwilcox

On Tue, 10 Jun 2003, Knut M. Wittkowski wrote:

            
That is not true. You did not tell us the whole story:
`wilcox.test' in S-PLUS 2000 reports a statistic of `W = 17' for your
example below whereas R says

R> wilcox.test(x1,x2,alternative="two.sided")

        Wilcoxon rank sum test

data:  x1 and x2
W = 2, p-value = 0.03175
alternative hypothesis: true mu is not equal to 0

and as one can find out easily, `wilcox.test' computes the statistic as

STATISTIC <- sum(r[seq(along = x)]) - n.x * (n.x + 1) / 2

So both R and S are consistent and ?qwilcox will tell you what exactly is
meant by `Wilcoxon rank sum':

     This distribution is obtained as follows.  Let `x' and `y' be two
     random, independent samples of size `m' and `n'. Then the Wilcoxon
     rank sum statistic is the number of all pairs `(x[i], y[j])' for
     which `y[j]' is not greater than `x[i]'.  This statistic takes
     values between `0' and `m * n', and its mean and variance are `m *
     n / 2' and `m * n * (m + n + 1) / 12', respectively.


Best,

Torsten