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@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.

Reply via email to