Wilcoxon signed-rank test
The Wilcoxon signed-rank test uses signs and ranks of paired differences to test symmetry about zero.
Fit
When to use it, and when not to
Use it when
- You have two measurements per person, or prespecified matched pairs, and differences have meaningful magnitudes.
- You want a paired rank test and can justify a symmetric distribution of differences.
Not when
- Your target is the mean change. Use a paired t-test if its assumptions fit. Read: Paired t-test: testing a mean change
- The groups contain different people. Use the Mann-Whitney test for an independent rank comparison. Read: Mann-Whitney U test
- Differences are strongly asymmetric. Consider a sign test for the median rather than assuming ranks solve the problem. Read: Choosing a test for means
Before you start
What you need
- Pair identifiers, differences and subtraction orderrepeatedMeasuresKeep pairs intact. Define after minus before, or its reverse.
- Zeros, tied magnitudes and measurement scaleState the zero-handling rule and whether the p-value is exact or approximate.
- The target population and missing-pair planExplain which pairs are incomplete. Justify a missing-data assumption, such as missing completely at random, and assess selection bias.
- Different pairs contribute independently.How to check: Repeated eyes, families or shared clinics require an approach that accounts for clustering.
- A location interpretation requires differences symmetric about a common center.How to check: Plot the differences themselves. Skew in either raw measurement alone does not decide the test.
- Absolute differences can be meaningfully ranked.How to check: A purely ordinal scale may not support subtracting scores or ranking the size of those differences.
Plain language
How it works
Compute one difference per pair. Remove zeros under the chosen rule, rank the remaining absolute differences and average tied ranks. Add ranks for positive differences. Under a symmetric zero-centered null, positive and negative signs balance. The calculator standardizes the positive-rank sum as a z score. A normal approximation or a suitable exact calculation supplies the p-value.
Li and Johnson distinguish symmetry testing from median testing under symmetry. Rosner and colleagues derive a clustered extension because ordinary paired ranks assume independent pairs. Neither result makes arbitrary skew or clustering harmless.
Worked example
A worked example
- Setting
- A clinic measures change in 10 complete patient pairs.
- Question
- Are the differences compatible with symmetry about zero?
- Approach
- Differences: -2, 3, -1, 5, 4, -1, 6, 2, 0, 3. Use after minus before; drop zeros and average tied ranks.
- Result
- Dropping 1 zero leaves 9 pairs. Positive ranks sum to 38.5; z = 1.901. The approximate two-sided p = 0.057, without continuity correction.
- What it means
- This normal approximation is uncertain in a small sample. A large p-value proves neither symmetry nor no change; it estimates no mean effect.
In practice
Recent studies PubMed search · not vetted
Watch out
Common mistakes
The one to remember
The signed-rank test needs symmetric differences for a location interpretation. It does not test the mean change, and ranks do not make clustering or missing pairs harmless.
- Reporting the p-value as an estimate of mean change.Instead: Describe the differences and their clinical size. A location estimate and interval must match the chosen target and symmetry assumption.
- Ignoring zeros or ties when describing the test.Instead: Report the zero rule, tie handling and probability calculation. Exact methods must accommodate the observed ties.
Inside Mallard
How Mallard uses this
Mallard links this article to its signed-rank calculator. It drops zeros and uses a tie-corrected normal approximation without continuity correction. The method registry links this method to its published analysis article and code.
wilcoxon-signed-rank-hodges-lehmann).analysis.wilcoxon_signed_rank, the id a plan cue records.How to report it
Report the subtraction order, complete and nonzero pair counts, signed-rank statistic convention, zero and tie handling, and exact or approximate two-sided p-value. Describe the differences in their clinical units. For a symmetric location model, a Hodges-Lehmann estimate needs a signed-rank-inversion interval, not a mean-change interval. A reporting guideline is not a design manual: use it to make the study transparent, not as a substitute for careful design. Check the target journal's own requirements as well, which this page cannot know.
Work it out
Related Learn pages
Related designs and methods
Evidence
Sources & further reading
- Wilcoxon's signed-rank statistic: what null hypothesis and why it matters (opens in a new tab) · Pharm Stat · doi 10.1002/pst.1628
- The Wilcoxon signed rank test for paired comparisons of clustered data (opens in a new tab) · Biometrics · doi 10.1111/j.1541-0420.2005.00389.x