Launch StatClinic →
Statistical Tests

How to Perform the Wilcoxon Signed-Rank Test in Medical Research

📖 13 min read 🗓 July 2026 ✓ Updated July 2026
S
StatClinic Editorial Team Statistical content for medical researchers and clinicians
When you measure the same patients twice — before and after an intervention, on and off a drug, pre- and post-surgery — and your outcome doesn't follow a normal distribution, the paired t-test is no longer the right tool. The Wilcoxon signed-rank test is the non-parametric method built exactly for this situation, and it's one of the most frequently needed, most frequently misapplied tests in clinical research. This guide walks through what it actually tests, when it applies, how to prepare your data, a full worked clinical example, and exactly how to run and report it using StatClinic.
Key Takeaways
  • The Wilcoxon signed-rank test compares two related (paired) measurements on the same subjects — it is the non-parametric alternative to the paired t-test, not a general-purpose non-parametric test.
  • Use it when the differences between pairs are not normally distributed, or when your outcome is ordinal rather than truly continuous.
  • The test ranks the absolute values of the differences, restores their sign, and compares the sum of positive versus negative ranks — it tests whether the median difference is zero.
  • Always report the median difference and an effect size alongside the p-value — the p-value alone doesn't convey clinical magnitude.
  • Zero differences are dropped before ranking, and tied ranks are averaged — both need to be understood before interpreting your output.

What Is the Wilcoxon Signed-Rank Test?

The Wilcoxon signed-rank test is a non-parametric statistical test that compares two related sets of measurements taken from the same subjects, testing whether the median of the differences between the pairs is equal to zero. It was developed by Frank Wilcoxon in 1945 as a rank-based counterpart to the paired t-test, for exactly the situations where the paired t-test's normality assumption doesn't hold.

Mechanically, the test takes the difference for each pair, ranks the absolute values of the non-zero differences from smallest to largest, then reattaches each rank's original sign (positive if the pair increased, negative if it decreased). It sums the positive ranks and the negative ranks separately — if there is truly no systematic difference between the paired measurements, these two sums should be roughly equal; a large imbalance between them is what produces a small p-value.

In Plain Terms

Instead of asking "is the average difference between before and after zero?" (the paired t-test's question), the Wilcoxon signed-rank test asks "is there a consistent direction to the differences, once we rank them by size?" — a question that doesn't require the differences to be normally distributed to answer validly.

When to Use the Wilcoxon Signed-Rank Test

The Wilcoxon signed-rank test is the correct choice whenever you have two related measurements per subject and at least one of the paired t-test's requirements isn't met. In practice, this means:

If your paired differences are approximately normally distributed and your outcome is genuinely continuous, the paired t-test remains the more statistically powerful choice — the Wilcoxon test is a fallback for when that assumption fails, not a universally "safer" default.

Suitable Data and Study Designs

The Wilcoxon signed-rank test fits a specific family of study designs — all built around the same subject (or matched pair) contributing two related data points.

Study DesignExample
Pre-post (single-group) interventionSymptom score before and after a 6-week therapy program
Crossover trialEach patient receives both Drug A and Drug B, in random order, with a washout period
Matched-pair designEach case matched to one control on age and sex, comparing a continuous biomarker
Repeated measurement, two time pointsPain score at admission and at discharge for the same patients

It is not appropriate for comparing two independent, unrelated groups (use the Mann-Whitney U test instead), and not appropriate for more than two repeated measurements on the same subjects (use the Friedman test instead).

Wilcoxon Signed-Rank Test vs Paired T-Test

Both tests answer a similar practical question using paired data, but they differ in what they assume and what they actually compare.

FeaturePaired T-TestWilcoxon Signed-Rank Test
Data typeContinuousContinuous or ordinal
Distribution requirementDifferences approximately normalNo normality requirement
What is comparedMean of the differencesMedian of the differences (via ranks)
Sensitivity to outliersHighLow — ranking limits their influence
Test statistictW (or T, or Z for larger samples)
Typical effect sizeCohen's dMatched-pairs rank-biserial r
Take-Home Points When the normality assumption genuinely holds, the paired t-test has more statistical power. When it doesn't, the Wilcoxon signed-rank test is the more valid choice — this isn't a matter of one test being universally "better," but of matching the test to what your data can actually support.

Assumptions and Requirements

The Wilcoxon signed-rank test has fewer and less restrictive assumptions than the paired t-test, which is exactly why it serves as its non-parametric fallback.

1

Paired or matched data

Each subject (or matched pair) contributes exactly two related measurements.

2

At least ordinal measurement

The differences must be capable of being ranked — meaningful order, not just categories.

3

Independence between pairs

One subject's pair of measurements shouldn't influence another subject's pair.

4

Roughly symmetric distribution of differences

Needed specifically for the "median difference" interpretation to be clean and meaningful — not required for the test's basic validity as a test of consistent direction.

Notice what's absent from this list: there is no requirement that the raw outcome values, or their differences, follow a normal distribution — this is the entire reason the test exists as an alternative to the paired t-test.

How to Prepare Your Paired Data

Correct data preparation prevents the most common data-entry errors that quietly invalidate a Wilcoxon analysis before the test is even run.

A Realistic Medical Research Example

A physiotherapy clinic runs a 4-week exercise program for patients with chronic knee osteoarthritis and wants to know whether it reduces pain. Eighteen patients report their pain on a 0–100 Visual Analog Scale (VAS) at baseline and again after 4 weeks. A Shapiro-Wilk test on the paired differences returns p = 0.01, indicating the differences are not normally distributed — several patients improved dramatically while others showed almost no change, producing a skewed distribution unsuited to a paired t-test.

A partial view of the dataset for the first eight patients, showing how the ranking step works:

PatientBaseline VASWeek 4 VASDifferenceRank of |Difference|Signed Rank
16240-226-6
25855-31-1
37030-408-8
44548+31.5+1.5
56638-287-7
65446-83-3
76044-165-5
85039-114-4
How the Ranking Works

Absolute differences are ordered smallest to largest and assigned ranks 1, 2, 3... Patients 2 and 4 have the same absolute difference (3), so both receive the average of the two ranks they'd otherwise occupy (1 and 2, averaged to 1.5) — this is the tied-rank correction explained further below. Each rank then keeps the sign of its original difference.

Step-by-Step Analysis Using StatClinic

Running this analysis correctly — and being confident it's the right test — takes a few minutes with StatClinic's guided workflow.

1

Enter your paired data

Upload your dataset or enter it directly, with baseline and follow-up VAS scores as two separate columns for the same 18 patients.

2

Confirm your study design

Tell StatClinic these are paired / repeated measurements on the same subjects — this is what routes the analysis toward the correct family of tests.

3

Let StatClinic check normality automatically

StatClinic runs a Shapiro-Wilk test on the paired differences behind the scenes and flags when the paired t-test's assumption isn't met.

4

Accept the recommended test

StatClinic recommends the Wilcoxon signed-rank test once normality is flagged as violated — you can also select it manually if you already know it's the right test.

5

Review the full output

You'll get the test statistic, exact or asymptotic p-value, the median for each condition, the median difference, and the effect size r — all in one panel.

6

Get a ready-to-use interpretation

StatClinic generates a plain-language interpretation plus pre-written Methods and Results sentences you can adapt directly into your manuscript or thesis.

You can also run the calculation directly with the Wilcoxon Signed-Rank Test Calculator if you already have your ranked pairs and just need the statistic and p-value.

Interpretation: Test Statistic, P-Value, Medians, and Effect Size

For the osteoarthritis example (full sample of 18 patients), StatClinic's output might read: W = 9, Z = -3.34, p < .001, with a median VAS of 62 (IQR 54–70) at baseline falling to a median VAS of 38 (IQR 28–46) at 4 weeks, and an effect size r = 0.56. Here's how to read each piece:

OutputWhat It Tells You
Test statistic (W / T / Z)A summary of the rank imbalance between positive and negative differences — not interpretable in isolation; always reported alongside N and the p-value
P-valueThe probability of seeing this much rank imbalance (or more) if there were truly no difference between conditions
Median (each condition) & median differenceThe actual clinical quantity of interest — always report this alongside the p-value, never instead of it
Effect size (r)Magnitude of the effect independent of sample size; roughly 0.1 small, 0.3 moderate, 0.5+ large

Put together: the p-value tells you the pain reduction is very unlikely to be due to chance alone; the median drop from 62 to 38 tells you the reduction is clinically substantial; and r = 0.56 confirms the effect is large in magnitude, not just statistically detectable in a large sample.

Zero Differences and Tied Ranks: What to Do

Pairs With a Difference of Zero

Any pair where the two measurements are identical contributes a difference of zero, which cannot be meaningfully ranked as positive or negative — these pairs are dropped before ranking, and the effective sample size used by the test is reduced accordingly. If a large share of your pairs show no change at all, report that proportion explicitly; it may reflect a genuine ceiling or floor effect in your measurement tool (a scale unable to register further improvement) rather than a true absence of any effect.

Tied Ranks

When two or more pairs share the same absolute difference, each receives the average of the ranks they would otherwise occupy (as shown for patients 2 and 4 in the worked example above). A high number of ties reduces the accuracy of the standard normal approximation used for larger samples, so most statistical software — including StatClinic — automatically applies a tie-correction to the variance calculation, and defaults to an exact calculation method for small samples with few ties.

How to Report Results in a Thesis or Paper

A complete report states the test used, why it was chosen, the descriptive statistics for both conditions, and the full inferential result — following the same principles covered in our guide to writing statistical results by test.

Sample Methods Text

"Because the distribution of paired differences in pre- and post-intervention pain scores was non-normal (Shapiro-Wilk p = 0.01), the Wilcoxon signed-rank test was used to compare baseline and 4-week VAS pain scores."

Sample Results Text

"Median VAS pain score decreased from 62 (IQR 54–70) at baseline to 38 (IQR 28–46) at 4 weeks (Wilcoxon signed-rank test, Z = -3.34, p < .001, r = 0.56), indicating a statistically significant and clinically meaningful reduction in pain following the exercise program."

Common Mistakes Researchers Make

Mistake 1: Using It for Independent Groups

Applying the Wilcoxon signed-rank test to two separate, unrelated groups of patients rather than paired measurements on the same subjects.

✓ Fix: For independent groups, use the Mann-Whitney U test instead.

Mistake 2: Reporting Only the P-Value

Stating "p < .05" without reporting the median difference or an effect size, leaving readers unable to judge the actual clinical magnitude.

✓ Fix: Always report medians for both conditions and an effect size (r) alongside the p-value.

Mistake 3: Reporting a Mean With a Rank-Based Test

Presenting the arithmetic mean and standard deviation alongside a test that is actually based on ranks, creating an internal inconsistency.

✓ Fix: Report the median and interquartile range (IQR) to match what the test itself evaluated.

Mistake 4: Ignoring a High Proportion of Zero Differences

Not mentioning that a substantial share of pairs showed no change, which silently reduces the effective sample size and power.

✓ Fix: Report the number of zero-difference pairs excluded from the ranking.

Mistake 5: Using It for More Than Two Time Points

Running repeated Wilcoxon tests across three or more time points instead of a single appropriate test, inflating the false-positive rate.

✓ Fix: Use the Friedman test for three or more repeated measurements on the same subjects.

Mistake 6: Skipping the Normality Check Entirely

Defaulting to the Wilcoxon test out of caution without ever testing whether the paired t-test's assumption actually failed, losing statistical power unnecessarily.

✓ Fix: Test normality of the differences first — use the paired t-test if it genuinely holds.
❌ Incorrect

"We used the Wilcoxon signed-rank test to compare pain scores between the treatment and control groups (p = 0.03)."

✅ Correct

"Median VAS pain score decreased from 62 to 38 following treatment (Wilcoxon signed-rank test, Z = -3.34, p < .001, r = 0.56)" — the test is applied within one group across time, with full descriptive and effect-size reporting.

Frequently Asked Questions

What is the null hypothesis of the Wilcoxon signed-rank test? +
The null hypothesis is that the median of the differences between paired observations is zero — that the distribution of differences is symmetric around zero, with no systematic tendency for one measurement to exceed the other. The alternative is that the median difference is not zero.
Can the Wilcoxon signed-rank test be used for ordinal data? +
Yes. It only requires that the differences between paired observations can be meaningfully ranked, making it suitable for ordinal outcomes like symptom severity scales, as well as continuous outcomes that violate the normality assumption of the paired t-test.
What sample size do I need for a Wilcoxon signed-rank test? +
There's no single fixed minimum — the test performs a reliable exact calculation down to as few as 6 to 8 non-zero pairs, a real advantage in small pilot studies. Above roughly 20 to 25 pairs, most software switches to a normal approximation with a continuity correction.
How is the Wilcoxon signed-rank test different from the Mann-Whitney U test? +
Wilcoxon signed-rank compares two related measurements from the same subjects; Mann-Whitney U compares a single measurement between two independent groups of different subjects. Using the wrong one for your design produces a mismatched, invalid analysis.
What do I do if many pairs have a difference of zero? +
Zero-difference pairs are excluded from ranking, reducing effective sample size and power. Report the proportion explicitly — it may reflect a genuine ceiling or floor effect in your measurement rather than a true absence of change.
Can I report a mean difference with the Wilcoxon signed-rank test? +
It's more consistent to report the median, since the test is rank-based rather than mean-based. Reporting a mean alongside this test is a common inconsistency reviewers often flag; if you include it, label it clearly as a descriptive addition.
What effect size should I report with the Wilcoxon signed-rank test? +
The matched-pairs rank-biserial correlation, or r calculated as Z divided by the square root of N, is most common. Using Cohen's adapted benchmarks, r around 0.1 is small, 0.3 moderate, and 0.5 or above is large.
Is the Wilcoxon signed-rank test the same as the sign test? +
No. The sign test only uses the direction of each difference, ignoring magnitude entirely. The Wilcoxon signed-rank test uses both direction and relative magnitude via ranking, making it more statistically powerful whenever magnitude carries information.
Can the Wilcoxon signed-rank test be used for more than two time points? +
No, it's built specifically for exactly two related measurements per subject. For three or more repeated measurements on the same subjects, use the Friedman test, followed by an appropriate post hoc test if significant.
How do I report the Wilcoxon signed-rank test in APA format? +
A typical report includes the test statistic (commonly Z), sample size, p-value, and effect size, written as: Z = -3.34, p < .001, r = 0.56 — paired with the median (and IQR) for each condition in the surrounding sentence.

Once your Wilcoxon test is run, these guides take you through the surrounding decisions:

Ready to Run Your Wilcoxon Test?

Let StatClinic's AI Statistical Assistant confirm the right test, run your analysis, and write your results sentence. Free, no registration required.

Try StatClinic Free →