Jue.Wang2 at sanofi-aventis.com
2006-Oct-06 15:47 UTC
[R] Estimate in Wilcox_test vs wilcox.exact
Does any one know why wilcox.exact sometimes doesn't agree with wilcox_test on the estimate of the difference of medians in two levels ? Thank you Jue Wang, Biostatistician Contracted Position for Preclinical & Research Biostatistics PrO Unlimited (908) 231-3022 Example 1: (wilcox_test gives correct median difference) y1<-rep(0,10) y2<-c(32.507,61.901,134.938,49.95,29.954,99.835,49.27) median(y1)-median(y2) -49.95 y<-c(y1,y2) x<-c(rep(0,10),rep(1,7)) Test<-wilcox_test(y~factor(x),distribution="exact",conf.int=TRUE) confint(Test)$estimate difference in location -49.95 exact<-wilcox.exact(y~x,conf.int=TRUE) exact$estimate difference in location -55.9255 Example 2: (wilcox.exact gives correct median difference) y1<-c(0,0,0,0,0,3.065,3.075,3.075,3.118,3.118) y2<-c(0,0,0,0,0,0,0,14.958,51.002,63.984) median(y1)-median(y2) 1.5325 y<-c(y1,y2) x<-c(rep(0,10),rep(1,10)) Test<-wilcox_test(y~factor(x),distribution="exact",conf.int=TRUE) confint(Test)$estimate difference in location 0 exact<-wilcox.exact(y~x,conf.int=TRUE) exact$estimate difference in location 1.5325
<Jue.Wang2 <at> sanofi-aventis.com> writes:> > Does any one know why wilcox.exact sometimes doesn't agree with wilcox_test onthe estimate of the> difference of medians in two levels ? >Example removed.... See: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/85893.html Dieter