Re: [R] wilcox.test statistics

From: Christoph Buser <>
Date: Thu 03 Mar 2005 - 22:08:24 EST


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.


Christoph Buser

Christoph Buser <> Seminar fuer Statistik, LEO C11
ETH (Federal Inst. Technology)	8092 Zurich	 SWITZERLAND
phone: x-41-1-632-5414		fax: 632-1228

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
> ______________________________________________
> mailing list
> PLEASE do read the posting guide! mailing list PLEASE do read the posting guide! Received on Thu Mar 03 22:59:28 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:40 EST