# wilcoxon() rejection direction is unclear for one-sided test #9046

Closed
opened this issue Jul 17, 2018 · 2 comments
Closed

# wilcoxon() rejection direction is unclear for one-sided test#9046

opened this issue Jul 17, 2018 · 2 comments
Labels

### jkokatjuhha commented Jul 17, 2018

<<Please describe the issue in detail here, and for bug reports fill in the fields below.>>
As mentioned here by @abhinavkgp :

... it is still not possible to determine one-sided result (whether x-y>0 or y-x>0) using this two-sided statistic, due to the following:

Code:
T = min(r_plus, r_minus)
r_plus = np.sum((d > 0) * r, axis=0) #Always positive
r_minus = np.sum((d < 0) * r, axis=0) #Always positive

Reasoning:
So, if you swap x and y, T will still be the same, z statistics will still be the same

Final Thoughts:
We should also aim to return in some way that whether r_plus was used or r_minus was used (through a flag maybe) in order to know the result of a one-sided tailed test

### Reproducing code example:

``````A = [10,10,10,10,15,11]
B = [30,30,30,30,31,32]

wilcoxon(A, B) == wilcoxon(B,A)
``````

### Scipy/Numpy/Python version information:

``````1.0.1 1.14.3 sys.version_info(major=3, minor=6, micro=5, releaselevel='final', serial=0)
``````
mentioned this issue Jul 17, 2018

### chrisb83 commented Jul 17, 2018

 The test only returns the two-sided p-value, so the order of x and y does not matter. I don't think there is a bug. Is this a feature request to have a one-sided test?

### jkokatjuhha commented Jul 17, 2018 • edited

 Once could transform the p-value directly into a one-sided p-value by diving by 2. So, yes, it is either a feature request (like in R: alternative which can be 'two.sided', 'greater' or 'less') or a request for providing a flag for rejection direction in case of a one-sided test.
added the label Jul 17, 2018
mentioned this issue Feb 11, 2019
mentioned this issue Aug 4, 2019