[R] The W statistic in wilcox.exact

Christos Hatzis christos at nuverabio.com
Thu Oct 5 22:41:14 CEST 2006


Probably because of the offset:

U = W - n*(n+1)/2 

In your example, W=12 (=3+4+5) as reported by wilcox.test.  The offset is 6
(=3*4/2) and therefore U=6.
I am not certain as I haven't installed the exactRankTests package, but it
seems that wilcox.exact reports U instead of W.

-Christos Hatzis

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of
Jue.Wang2 at sanofi-aventis.com
Sent: Thursday, October 05, 2006 1:35 PM
To: r-help at stat.math.ethz.ch
Subject: [R] The W statistic in wilcox.exact

Does anyone know why wilcox.exact gives W-statistic 6 instead of 12 as
indicated below.

12 is the rank sum of group 0 of x, which is the linear statistic computed
by wilcox_test.

y<-c(1,2,3,4,5)
x<-c(1,1,0,0,0)


(a) wilcox.exact

wilcox.exact(y~x)
Exact Wilcoxon rank sum test
data:  y by x
W = 6, p-value = 0.2
alternative hypothesis: true mu is not equal to 0 


(b) wilcox_test

tt<-wilcox_test(y~factor(x),distribution="exact")
statistic(tt,"linear")
   
0 12



Jue Wang, Biostatistician
Contracted Position for Preclinical & Research Biostatistics
PrO Unlimited
(908) 231-3022

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list