I am wondering why my answers are so different when doing a mann whitney u test in python and in R. In python:
from scipy.stats import mannwhitneyu
t = [1,2,3]
g = [4,5,6,7,8,9]
mannwhitneyu(t,g)
(0.0, 0.014092901073953692)
In R:
t = c(1,2,3)
g = c(4,5,6,7,8,9)
wilcox.test(t,g, paired = FALSE)
Wilcoxon rank sum test
data: t and g
W = 0, p-value = 0.02381
alternative hypothesis: true location shift is not equal to 0
I'm wondering why the python one looks more like a one sided test.
The scipy version is documented to return a one-sided p-value. (The doc site is down for me at the moment so I can't provide a link, but you can see it if you look at the help for the mannwhitneyu
function.) The R function is documented to allow you to specify the sidedness, with two-sided as the default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With