It is well known that the Wilcoxon rank sum test is more powerful for detecting shifts in location when the data is non-normal. However, I am conducting a brief simulation study and my results contradict this.
One setting in my simulation strategy is as follows:
- Generate 25 random variables $X_1,\ldots,X_{25}$ such that $X\sim\mathsf{exp}(\mu=1)$
- Generate 25 random variables $Y_1,\ldots,Y_{25}$ such that $Y\sim\mathsf{exp}(\mu=1.5)$
- Determine whether the null hypothesis that $\mu_X=\mu_Y$ is rejected
- Repeat 10,000 and calculate the average
This average gives the empirical power of the test. However, I find that the $t$-test is consistently more powerful than the Wilcoxon rank sum test. For instance, in my last simulation, I obtained powers of 0.2317 and 0.2585 for the Wilcoxon and $t$-test, respectively.
Is there a flaw in my simulation strategy that is leading to unintuitive results? My R code:
power=0
for(i in 1:10000){
x <- rexp(25,1/1)
y <- rexp(25,1/1.5)
res <- wilcox.test(x, y, alternative = "two.sided")
power=power+(res$p.value<0.05)
}
power/10000
power=0
for(i in 1:10000){
x <- rexp(25,1/1)
y <- rexp(25,1/1.5)
res <- t.test(x, y, alternative = "two.sided")
power=power+(res$p.value<0.05)
}
power/10000