[R] wilcox.test statistics

Christoph Buser buser at stat.math.ethz.ch
Thu Mar 3 12:08:24 CET 2005

```Hi,

a value of 0 for the test statistic is possible. The test
statistic is not just the sum of ranks, but this sum - n*(n+1)/2,
where n is the number of observations of the group the rank sum
is build.
This statistic is equivalent to the ranks sums, since it
differs only about a constant, which depends on the number of
observations.
Look at the following situation

> x <- 1:10
> y <- 11:20
> wilcox.test(x,y)
Wilcoxon rank sum test

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

When every observation of group1 is smaller than those of group2
the rank sum of the smaller group is
sum(1:n1) = sum(1:10) = 10*(10+1)/2 = n1*(n1+1)/2
If you compare this to the test statistics, you'll observe that
in this case the test statistic is 0.

Regards,

Christoph Buser

--------------------------------------------------------------
Christoph Buser <buser at stat.math.ethz.ch>
Seminar fuer Statistik, LEO C11
ETH (Federal Inst. Technology)	8092 Zurich	 SWITZERLAND
phone: x-41-1-632-5414		fax: 632-1228
http://stat.ethz.ch/~buser/
--------------------------------------------------------------

Liu Ting-Yuan writes:
>
> Hi,
>
> Could anyone provide the formula of the statistics which the wilcox.test
> used for the two-sample rank-sum test?  I got some statistics of 0 values,
> but it is impossible to have 0 "rank-sum".  Does the function use the
> Mann-Whitney U test statistics?  Thanks.
>
> Ting-Yuan Liu
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help