Previous topic

scipy.stats.ranksums

Next topic

scipy.stats.kruskal

scipy.stats.wilcoxon

scipy.stats.wilcoxon(x, y=None, zero_method='wilcox', correction=False)[source]

Calculate the Wilcoxon signed-rank test.

The Wilcoxon signed-rank test tests the null hypothesis that two related paired samples come from the same distribution. In particular, it tests whether the distribution of the differences x - y is symmetric about zero. It is a non-parametric version of the paired T-test.

Parameters:

x : array_like

The first set of measurements.

y : array_like, optional

The second set of measurements. If y is not given, then the x array is considered to be the differences between the two sets of measurements.

zero_method : string, {“pratt”, “wilcox”, “zsplit”}, optional

“pratt”:

Pratt treatment: includes zero-differences in the ranking process (more conservative)

“wilcox”:

Wilcox treatment: discards all zero-differences

“zsplit”:

Zero rank split: just like Pratt, but spliting the zero rank between positive and negative ones

correction : bool, optional

If True, apply continuity correction by adjusting the Wilcoxon rank statistic by 0.5 towards the mean value when computing the z-statistic. Default is False.

Returns:

statistic : float

The sum of the ranks of the differences above or below zero, whichever is smaller.

pvalue : float

The two-sided p-value for the test.

Notes

Because the normal approximation is used for the calculations, the samples used should be large. A typical rule is to require that n > 20.

References

[R651]http://en.wikipedia.org/wiki/Wilcoxon_signed-rank_test