Jue, On a second look, it appears that wilcox.test does report the offset-adjusted statistic U, as also mentioned in the help page.
wilcox.test returns W=6 (instead of 12 as your example showed, unless "wilcox_test" is a different function). > wilcox.test( 1:5 ~ c(1,1,0,0,0) )$statistic # or wilcox.test( 1:5 ~ factor(c(1,1,0,0,0)) )$statistic W 6 So there does not appear to be a difference between the two methods. Did I miss something? -Christos -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christos Hatzis Sent: Thursday, October 05, 2006 4:41 PM To: [EMAIL PROTECTED]; [email protected] Subject: Re: [R] The W statistic in wilcox.exact 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, October 05, 2006 1:35 PM To: [email protected] 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 ______________________________________________ [email protected] 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. ______________________________________________ [email protected] 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. ______________________________________________ [email protected] 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.
