Wilcoxon signed-rank test
When the same people are measured twice and the differences between measurements aren’t roughly normal, the paired t-test can mislead. The Wilcoxon signed-rank test (Wilcoxon, 1945) uses ranks instead of raw differences, so a few extreme differences can’t dominate the result.
How it works
- Calculate each pair’s difference.
- Drop pairs with a difference of exactly zero (the usual convention).
- Rank the absolute differences from smallest to largest, averaging ranks for ties.
- Add up the ranks for the positive differences (V or W⁺) and for the negative ones (W⁻).
- If there’s no systematic change, the two sums should be similar. A big imbalance means one direction dominates.
- H₀: the differences are symmetric around zero, so neither direction tends to win.
- H₁: the differences tend to be positive, or negative.
When to use it
- Paired or repeated measurements on the same cases (before/after, two conditions).
- The paired differences are clearly skewed or contain outliers.
- The outcome is ordinal, such as a rating measured twice.
The check is on the differences, not on each measurement separately. For two independent groups, use the Mann-Whitney U test instead.
Worked example: two ways of rounding first base
A classic dataset from Hollander and Wolfe’s nonparametric statistics textbook records 22 baseball players’ times (in seconds) to run from home to second base using different paths around first base. We compare the “round out” path with the “narrow angle” path, each player running both.
Step 1: check the differences
The 22 differences are strongly skewed (skewness −1.52; Shapiro-Wilk W = 0.85, p = .003), and four players had identical times on both paths. That clearly fails the paired t-test’s normality assumption, so Analytika chooses the Wilcoxon signed-rank test.
Step 2: run the test
Group 1 (Round Out): median=5.5000, n=22, iqr=0.2375 Group 2 (Narrow Angle): median=5.5250, n=22, iqr=0.1375 Median difference: 0.0500 W-statistic: 64.5000 P-value: 0.3665 Effect size r: 0.2456 95% CI: [-0.3115, 0.6771] Rows excluded for missing values: 0 of 22
> wilcox.test(d[["Round Out"]], d[["Narrow Angle"]], paired = TRUE, + exact = FALSE, correct = TRUE) Wilcoxon signed rank test with continuity correction data: d[["Round Out"]] and d[["Narrow Angle"]] V = 106.5, p-value = 0.3665
The p-values match. The statistics look different only because of convention: R’s V is the sum of the positive ranks (106.5), and Analytika reports the smaller of the two sums (64.5). With 18 non-zero differences the ranks total 171, and 171 − 106.5 = 64.5. Both use the normal approximation with a continuity correction, which is appropriate with tied and zero differences.
Step 3: interpret
- p = .367: no evidence that running times differ between the two paths.
- Median difference = 0.05 s, with round out slightly slower, and a rank-biserial r = .25, 95% CI [−.31, .68]. The interval is wide, so a moderate difference in either direction can’t be ruled out with 22 players.
A paired t-test on the same data gives p = .733. When the differences are this skewed, the two tests can disagree, and the rank-based result is the more trustworthy one. Analytika’s t-test output carries a warning about exactly this.
Step 4: report it (APA 7)
Because the paired differences were not normally distributed, a Wilcoxon signed-rank test was used. There was no evidence of a difference in running time between the round-out (Mdn = 5.50 s) and narrow-angle (Mdn = 5.53 s) paths, V = 106.5, p = .367, r = .25, 95% CI [−.31, .68].
Some software reports W or T instead of V. Name the statistic you report, and give the number of non-zero pairs if any were dropped.
Common mistakes
- Checking normality of each column instead of the differences.
- Using it for independent groups. That’s Mann-Whitney.
- Reporting means with a rank-based test. Report medians.
- Running both tests and reporting the one you prefer. Decide from the check, before looking at the results.
How to run it
- SPSS: Analyze → Nonparametric Tests → Related Samples (or Legacy Dialogs → 2 Related Samples).
- R:
wilcox.test(before, after, paired = TRUE) - Python:
scipy.stats.wilcoxon(before, after) - Analytika: recognises paired columns from names like
score_pre/score_postoranxiety_t1/anxiety_t2, or you can ask for a paired comparison. It tests the differences and picks the paired t-test or Wilcoxon.
References
- Hollander, M., & Wolfe, D. A. (1973). Nonparametric statistical methods. Wiley.
- Wilcoxon, F. (1945). Individual comparisons by ranking methods. Biometrics Bulletin, 1(6), 80–83.
More in Comparing groups
Try it with the free tools
Run this on your own data
Upload a dataset and ask your question in plain English. Analytika checks the assumptions, picks the test, runs it, and writes the results up in APA format.