How to determine the effect size of a Wilcoxon rank-sum test in R?

I want to determine if there’s a difference in mean p-values between two groups. In order to do this I perform a Wilcoxon’s rank-sum test (the data is not normally distributed). So far, so good. Finally, I want to calculate the corresponding effect size. Unfortunately, R does not provide this. It also does not provide a z value with which the effect size can easily be calculated using: effect size = z / sqrt(N)

here is some sample R code:

a=rep(0:1,each=20)                            #grouping variable
b=c(rnorm(20, .03,.01), rnorm(20, .02, .009)) #vector of p-values

d=cbind(a,b)

test = wilcox.test(b ~ a, data = d)     #perform Wilcoxon rank-sum test
test

Does anybody know how to obtain the effect size?

Answer

The estimator that corresponds to the Wilcoxon test is the Hodges-Lehmann estimator; it’s returned by wilcox.test using the conf.int=TRUE option, under “difference in location”.

For your example:

> wilcox.test(b~a,data=d, conf.int=TRUE)

    Wilcoxon rank sum test

data:  b by a 
W = 355, p-value = 6.914e-06
alternative hypothesis: true location shift is not equal to 0 
95 percent confidence interval:
 0.008657301 0.021523993 
sample estimates:
difference in location 
            0.01442617 

For more on the Wilcoxon and the assumptions behind it, and what it actually tests for, and other nonparametric estimators, this document is (possibly) helpful:
www.stat.umn.edu/geyer/old03/5102/notes/rank.pdf

Attribution
Source : Link , Question Author : mats , Answer Author : jbowman

Leave a Comment