pingouin.wilcoxon

pingouin.wilcoxon(x, y, tail='two-sided')[source]

Wilcoxon signed-rank test. It is the non-parametric version of the paired T-test.

Parameters
x, yarray_like

First and second set of observations. x and y must be related (e.g repeated measures).

tailstring

Specify whether to return ‘one-sided’ or ‘two-sided’ p-value.

Returns
statspandas DataFrame

Test summary

'W-val' : W-value
'p-val' : p-value
'RBC'   : matched pairs rank-biserial correlation (effect size)
'CLES'  : common language effect size

Notes

The Wilcoxon signed-rank test tests the null hypothesis that two related paired samples come from the same distribution. A continuity correction is applied by default (see scipy.stats.wilcoxon() for details).

The rank biserial correlation is the difference between the proportion of favorable evidence minus the proportion of unfavorable evidence (see Kerby 2014).

The common language effect size is the probability (from 0 to 1) that a randomly selected observation from the first sample will be greater than a randomly selected observation from the second sample.

Warning

Versions of Pingouin below 0.2.6 gave wrong two-sided p-values for the Wilcoxon test. P-values were accidentally squared, and therefore smaller. This issue has been resolved in Pingouin>=0.2.6. Make sure to always use the latest release.

References

1

Wilcoxon, F. (1945). Individual comparisons by ranking methods. Biometrics bulletin, 1(6), 80-83.

2

Kerby, D. S. (2014). The simple difference formula: An approach to teaching nonparametric correlation. Comprehensive Psychology, 3, 11-IT.

3

McGraw, K. O., & Wong, S. P. (1992). A common language effect size statistic. Psychological bulletin, 111(2), 361.

Examples

  1. Wilcoxon test on two related samples.

>>> import numpy as np
>>> import pingouin as pg
>>> x = [20, 22, 19, 20, 22, 18, 24, 20, 19, 24, 26, 13]
>>> y = [38, 37, 33, 29, 14, 12, 20, 22, 17, 25, 26, 16]
>>> pg.wilcoxon(x, y, tail='two-sided')
          W-val     p-val    RBC   CLES
Wilcoxon   20.5  0.285765  0.333  0.583

Compare with SciPy

>>> import scipy
>>> scipy.stats.wilcoxon(x, y, correction=True)
WilcoxonResult(statistic=20.5, pvalue=0.2857652190231508)