Wilcoxon signed-rank test
Ranks (nonparametric) · Two paired samples · reference distribution: W (normal for large n)
When to use it
Compare two paired measurements without assuming the differences are normal.
Null hypothesis
The distribution of the differences is symmetric around zero.
Assumptions
- Independent pairs
- Symmetric distribution of the differences
Test statistic
W = \sum_{d_i > 0} \operatorname{rank}(|d_i|)Effect size
r, from the z of the normal approximation (n is the number of pairs).
r = \dfrac{|z|}{\sqrt{n}}How to report it
V = 21, z = −2.21, p = .027, r = .57
In R and Python
wilcox.test(after, before, paired = TRUE)
stats.wilcoxon(after, before)
In Python, stats is scipy.stats and np is numpy.
Variants and alternatives
Where it sits in the catalog
Ranks (nonparametric). Nonparametric tests assume no distribution for the data. They replace each value by its rank, its position in order (1st, 2nd, 3rd…), which protects them from extreme values and makes them fit ordinal data.
Two paired samples. Two measurements linked in pairs: the same individual before and after, or matched pairs, such as twins. The test uses the difference within each pair.
In the decision tree
- What do you want to do? Compare groups, or one group with a reference value
- What kind of response did you measure? Numeric: a measurement, such as weight, time or score
- How many groups or measurements? Two groups
- Are the groups made of different individuals or the same individuals? The same individuals, such as before and after (paired)
- Are the differences between pairs approximately normal? No, but they are symmetric