What the Wilcoxon signed-rank test does
The Wilcoxon signed-rank test compares two paired measurements, such as before and after a treatment, without assuming that the differences are normally distributed. It is the non-parametric alternative to the paired t-test. It is also used as a one-sample test of a median: subtract the hypothesized median from each value and test the differences.
How it works
- Compute the difference for each pair and drop the zero differences.
- Rank the absolute differences from 1 (smallest) to n; ties get the average rank.
- Add the ranks of the positive differences: that is T⁺. The ranks of the negative differences give T⁻, and T⁺ + T⁻ = n(n + 1) ÷ 2.
If there is no systematic change, T⁺ should be close to half of the total.
The formulas
- Mean of T⁺ under the null hypothesis: n(n + 1) ÷ 4.
- Standard deviation: √(n(n + 1)(2n + 1) ÷ 24).
- z = (T⁺ − mean ± 0.5) ÷ SD, with the continuity correction, and the p-value from the normal distribution.
- Effect size r = |z| ÷ √n.
Example
15 non-zero differences, with T⁺ = 24:
- T⁻ = 120 − 24 = 96, so the negative differences dominate;
- expected T⁺: 15 × 16 ÷ 4 = 60, with an SD of √(15 × 16 × 31 ÷ 24) ≈ 17.61;
- z = (36 − 0.5) ÷ 17.61 ≈ 2.02;
- two-tailed p ≈ 0.044: significant at α = 0.05;
- r ≈ 0.53, a large effect.
With 15 pairs, the exact table gives a critical W of 25 at α = 0.05 two-tailed. W = min(T⁺, T⁻) = 24 is at or below it, so the exact test agrees.
Compared with other paired tests
- The paired t-test is more powerful when the differences are roughly normal.
- The sign test only uses the direction of each difference. The signed-rank test also uses their size, so it is usually more powerful, but it assumes the differences are roughly symmetric around their median.
Limits
- Pairs must be independent of each other.
- For fewer than about 20 differences, check the exact critical value of W in a table or with software.
- Many tied absolute differences call for a tie correction to the standard deviation.