One-sided test
Lets say I want to compute one-sided wilcoxon test:
R:
> wilcox.test(B,A, alternative="greater", paired=TRUE, correct=FALSE, exact=FALSE)
Wilcoxon signed rank test
data: B and A
V = 28, p-value = 0.00898
alternative hypothesis: true location shift is greater than 0
>
> wilcox.test(A, B, alternative="greater", paired=TRUE, correct=FALSE, exact=FALSE)
Wilcoxon signed rank test
data: A and B
V = 0, p-value = 0.991
alternative hypothesis: true location shift is greater than 0
but if I do it in python (I need to divide the p-value by 2): wilcoxon(B, A) and wilcoxon(A, B) give the same statistics, so there is no way how to identify the direction of rejection.
>>> wilcoxon(A,B)
WilcoxonResult(statistic=0.0, pvalue=0.011412036386001651)
>>> wilcoxon(B,A)
WilcoxonResult(statistic=0.0, pvalue=0.011412036386001651)
Is there any alternatives for one-sided Wilcoxon test in python that will give also the direction of rejection?
EDIT, Old question: (answered by Robin Ryder)
I found some differences in test statistics in python and R and I cannot figure out what is the difference.
Python:
from scipy.stats import wilcoxon
A = [0.19826790, 1.36836629, 1.37950911, 1.46951540, 1.48197798, 0.07532846,1]
B = [10,10,10,10,10,10,10]
wilcoxon(B, A)
WilcoxonResult(statistic=0.0, pvalue=0.017960477526078766)
R:
A = c(0.19826790, 1.36836629, 1.37950911, 1.46951540, 1.48197798, 0.07532846,1)
B = c(10,10,10,10,10,10,10)
wilcox.test(B,A, alternative="two.sided", paired=TRUE, correct=FALSE, exact=FALSE)
Wilcoxon signed rank test
data: B and A
V = 28, p-value = 0.01796
alternative hypothesis: true location shift is not equal to 0
The p-values are the same but the test statistics are completely different. I checked the script code for it and it wasn't so clear how to resemble R test statistics and why there eis a difference.