<p dir="auto">Hello<br>
As presented here:<br>
<a href="http://stackoverflow.com/questions/38454893/error-in-scipy-wilcoxon-signed-rank-test-for-equal-series?noredirect=1#comment64315624_38454893" rel="nofollow">http://stackoverflow.com/questions/38454893/error-in-scipy-wilcoxon-signed-rank-test-for-equal-series?noredirect=1#comment64315624_38454893</a><br>
(without no answer to disprove it as a mistake from me),<br>
I wish to report that maybe there is a problem with the results of scipy.wilcoxon signed rank test;</p>
<p dir="auto">import scipy as sp<br>
x1=[29.39958, 29.21756, 29.350915, 29.34911, 29.212635]<br>
sp.wilcoxon(x1,x1,zero_method="wilcox",correction=True)</p>
<p dir="auto">returns statistic=0.0, pvalue=nan</p>
<p dir="auto">But with zero_method="pratt", it returns statistic=0.0, pvalue=0.043114446783075355 instead.<br>
I think there is a mistake there. The statistics (for z-score, if I am not mistaken) are the same, but the results are different for the p-value, while they should not, actually.<br>
When both series are identical, there should be no good p-value, but this is confident with alpha=0.05.</p>
<p dir="auto">Maybe "pratt" zero_method is wrongly implemented. It is said to be more conservative, but instead it has also constantly given better /lower p-values on a large array of test values.</p>
<p dir="auto">Hello<br>
As presented here:<br>
<a href="http://stackoverflow.com/questions/38454893/error-in-scipy-wilcoxon-signed-rank-test-for-equal-series?noredirect=1#comment64315624_38454893" rel="nofollow">http://stackoverflow.com/questions/38454893/error-in-scipy-wilcoxon-signed-rank-test-for-equal-series?noredirect=1#comment64315624_38454893</a><br>
(without no answer to disprove it as a mistake from me),<br>
I wish to report that maybe there is a problem with the results of scipy.wilcoxon signed rank test;</p>
<p dir="auto">import scipy as sp<br>
x1=[29.39958, 29.21756, 29.350915, 29.34911, 29.212635]<br>
sp.wilcoxon(x1,x1,zero_method="wilcox",correction=True)<br>
returns statistic=0.0, pvalue=nan</p>
<p dir="auto">But with zero_method="pratt", it returns statistic=0.0, pvalue=0.043114446783075355 instead.<br>
I think there is a mistake there. The statistics (for z-score, if I am not mistaken) are the same, but the results are different for the p-value, while they should not, actually.<br>
When both series are identical, there should be no good p-value, but this is confident with alpha=0.05.</p>
<p dir="auto">Maybe "pratt" zero_method is wrongly implemented. It is said to be more conservative, but instead it has also constantly given better /lower p-values on a large array of test values.</p>
<p dir="auto"><strong>edit</strong> josef</p>
<p dir="auto">It looks like there are two issues</p>
<ul dir="auto">
<li>corner case when all differences are zero needs special handling to return nan p-value</li>
<li>current implementation of Pratt method is wrong if there are "zeros", if (x == y).sum() &gt; 0</li>
</ul>