What the Wilcoxon signed-rank test does
The Wilcoxon signed-rank test compares two paired measurements, such as the same people before and after a change, without assuming the differences are normally distributed. It ranks the absolute differences, then checks whether the positive and negative differences have similar rank sums. It is the nonparametric alternative to the paired t-test, and it can also test a single sample against a hypothesised median.
When to use it
- Paired or matched data: before/after, left/right, two ratings of the same item.
- The differences are skewed, contain outliers, or the data are ordinal (for example Likert ratings), so a paired t-test is doubtful.
- The differences are roughly symmetric around their median. If they are strongly skewed, the sign test is safer.
Worked example
The example data are sleep-quality scores for 10 people before and after a two-week routine change. All 10 differences are non-zero; the positive differences have rank sum W+ = 52 and the negative ones W− = 3, so T = 3. With no ties and fewer than 50 pairs, the calculator uses the exact distribution: p = .0098, a significant improvement. The rank-biserial correlation is .89, a very large effect. The same example is worked by hand in the Wilcoxon signed-rank table.
How the calculation works
- Compute each difference and drop pairs with a difference of exactly zero.
- Rank the absolute differences; tied values share the average rank.
- Sum the ranks of positive differences (W+) and negative differences (W−). For a two-sided test, T is the smaller of the two.
- The p-value is exact for up to 50 pairs without ties, and otherwise uses the normal approximation with a tie correction. Results match SciPy’s
wilcoxonand R’swilcox.test.
Effect size
The matched-pairs rank-biserial correlation is (W+ − W−) / (W+ + W−). It runs from −1 to 1: 0 means positive and negative differences balance out, and ±1 means every difference goes the same way. Report it alongside the p-value.
Frequently asked questions
When should I use the Wilcoxon signed-rank test instead of a paired t-test?
When the paired differences are clearly non-normal or contain outliers, or the data are ordinal such as ratings. With roughly normal differences, the paired t-test is slightly more powerful.
What happens to pairs with a zero difference?
The standard Wilcoxon method drops them, because a zero difference gives no information about direction. The calculator reports how many pairs were dropped.
Is the p-value exact?
Yes for up to 50 pairs without tied differences. Otherwise the calculator uses the normal approximation with a correction for ties, the same rule SciPy uses.
What is T in the Wilcoxon test?
T is the smaller of the two rank sums, W+ for positive differences and W- for negative differences. It is compared with critical values in the Wilcoxon table for small samples.