Wilcoxon Signed-Rank Test Calculator
The Wilcoxon signed-rank test examines the difference between two measurements taken from the same subjects (before and after, two different methods, matched pairs). It is the nonparametric counterpart of the paired samples t-test and does not require the differences to be normally distributed; it only asks that they can be ranked.
The test uses both the sign and the magnitude order of the differences: the differences are computed, pairs with a difference of zero are dropped, the absolute values of the remaining differences are ranked, and the rank sum of the positive differences (W⁺) is compared with that of the negative ones (W⁻). This calculator reports W⁺, W⁻, the reported T = min(W⁺, W⁻), the tie-corrected z, the two-tailed p, the r effect size, a Hodges-Lehmann confidence interval for the median difference, and a table of the differences and signed ranks.
Wilcoxon Signed-Rank Test Formulas
Differences: dᵢ = x₂ᵢ − x₁ᵢ (pairs with dᵢ = 0 are dropped) Ranking: |dᵢ| ranked from smallest to largest, average ranks for ties Rank sums: W⁺ = Σ (ranks where dᵢ > 0) , W⁻ = Σ (ranks where dᵢ < 0) Test statistic: T = min(W⁺, W⁻) and W⁺ + W⁻ = n(n+1)/2 Expected value: μ_W = n(n+1) / 4 Standard deviation: σ_W = √[ n(n+1)(2n+1)/24 − Σ(t³ − t)/48 ] z statistic: z = (W⁺ − μ_W) / σ_W Effect size: r = |z| / √(2n) (alternative convention: |z| / √n) Median estimate: Δ̂ = median[(dᵢ + dⱼ)/2] , i ≤ j (Walsh averages)
Dropping the zero differences is Wilcoxon's classic approach; Pratt's method keeps those pairs in the ranking and gives a slightly different p. Σ(t³ − t) is the variance correction for tied absolute differences. The p-value is computed with the normal approximation; for n < 10 the exact table should be used.
How to Calculate
- Paste the two measurements taken from the same subjects into the separate boxes, in the same order: the ith values must belong to the same person.
- The two measurements must contain the same number of values; if data is missing for a subject, remove that pair entirely.
- Choose which p-value to report: use the uncorrected version if you are comparing with SPSS output.
- Set the significance level (α); the confidence interval for the median change is computed at the 1 − α level.
- In the signed-rank table, review which pairs increased, which decreased, and which were dropped for having a zero difference.
- Read the r effect size and the box plot of the differences alongside T, z, and p; significance alone does not show the practical importance of a change.
Worked Examples
Achievement scores before and after training
Eleven of the 12 pairs increased and none decreased; one pair had a difference of zero and was dropped, leaving an effective n = 11. With W⁺ = 66, W⁻ = 0, T = 0, and z = 2.949, p = 0.003, so the post-training scores are significantly higher. The median of the differences is 6.00 and r = 0.629, a large effect; the 95% confidence interval for the median change runs from 4.50 to 7.00 points.
T test statistic: 0.0 · Positive rank sum (W⁺): 66.0 · Negative rank sum (W⁻): 0.0
No difference between two measurement methods
Five of the 10 pairs increased and five decreased; W⁺ = 28, W⁻ = 27, and T = 27. With z = 0.052 and p = 0.958, there is no systematic difference between the two methods. The median of the differences is 0 and r = 0.012, a negligible effect; the 95% confidence interval for the median change runs from -1.50 to 2.00 and contains zero.
T test statistic: 27.0 · Positive rank sum (W⁺): 28.0 · Negative rank sum (W⁻): 27.0
A small sample with an outlier — with continuity correction
The measurement fell for all eight patients: W⁺ = 0, W⁻ = 36, and T = 0. With the continuity correction z = -2.466 and p = 0.014, the decrease is significant. Although the 42-unit extreme drop in one patient distorts the mean, the rank-based test is unaffected by it; the median of the differences is -7.50 and r = 0.634, a large effect. The 95% confidence interval for the median change runs from -24.50 to -5.50.
T test statistic: 0.0 · Positive rank sum (W⁺): 0.0 · Negative rank sum (W⁻): 36.0