← 2. Comparing groups
Wilcoxon signed-rank test
Try this analysis →

Wilcoxon Signed-Rank Test

A nonparametric test that pairs two measurements from the same subject and compares the direction and size of the change using ranks.

Paired samplesSigned ranksW statisticBefore-and-after comparison

Before treatmentAfter treatmentSame patientRank the differencesbetween paired scores

Did the pain scores of patients in a pain management program go down compared with before treatment? If the same students rated their confidence before and after a course, did their scores change? If the same users rated two screen designs, which one got higher satisfaction?

The Wilcoxon signed-rank test is a method that compares the differences between two measurements from the same subjects using ranks and signs.

Unlike the Mann–Whitney U test, which compares two different groups, the Wilcoxon signed-rank test handles data linked one to one, such as each person's before-and-after change. It evaluates the size of the change by converting it to ranks, but you still need to check the conditions required for interpretation, such as symmetry of the distribution of differences.

In this article we'll use an example of pain scores before and after treatment to look at how the test works, how to read actual results, how it differs from the paired t test, how to report the results and what to check before the analysis.

SECTION 01

What is the Wilcoxon signed-rank test?

It evaluates the differences between two measurements from the same subjects using ranks and signs.

The Wilcoxon signed-rank test is a nonparametric test that compares two measurements of the same person, or two observations that are paired with each other. You compute the difference for each pair, rank the differences by absolute value, and take the direction of increase or decrease into account as well.

Where the paired t test focuses on the mean difference, the Wilcoxon signed-rank test uses the rank information of the differences. However, an interpretation in terms of a location shift, specifically a difference in medians, is possible only when the assumption that the distribution of differences is symmetric holds.

SECTION 02

What research questions is it used for?

It's used for repeated measurements or when there is a clear one-to-one pairing.
Research settingWhat is comparedQuestion
Treatment effectSame patients' pain before and after treatmentHas the pain score changed?
Training evaluationSame students' confidence before and after trainingDid confidence increase?
Product usabilitySame users' satisfaction with the old and new UIDo the two screens get different ratings?

If the two groups consist of different people, you should consider methods for independent samples, such as the Mann–Whitney U test, rather than the Wilcoxon signed-rank test.

SECTION 03

How does the test work?

It uses signed ranks, which reflect both size and direction at once.

For each participant, compute the difference after treatment − before treatment. In the standard Wilcoxon procedure, pairs with a difference of 0 are dropped, and the absolute values of the remaining differences are ranked. Tied differences get the average rank.

Compare the sum of negative ranks for observations that decreased with the sum of positive ranks for observations that increased. If the rank sums in the two directions are badly unbalanced, that is evidence against the null hypothesis of no change.

Rank sums in the example: the positive rank sum is W⁺ = 9 and the negative rank sum is W⁻ = 181. There are 19 nonzero pairs, and for a two-sided test the test statistic is reported as the smaller of the two, 9.
SECTION 04

Worked example: comparing pain scores before and after treatment

We check the change in scores for the same 20 patients.

To look at the effect of a pain management program, suppose the pain of 20 patients was rated on a 0–10 scale before treatment and 4 weeks later. Higher scores mean more severe pain, and all data are hypothetical figures made up for explanation.

PatientBefore treatmentAfter treatmentAfter − before
185-3
275-2
367+1
496-3
574-3
686-2
765-1
875-2
−17.5−12−4.504.5Patient 1−3−17.5Patient 2−2−12Patient 3+1+4.5Patient 4−3−17.5Patient 5−3−17.5Patient 6−2−12Patient 7−1−4.5Patient 8−2−12After − beforeSigned rank
Assigning signed ranks

Only the first 8 patients are shown. The test used the full data for all 20.

33445566778899Before treatmentAfter treatmentLine width = number of patients with the same change
Pain scores before and after treatment, by patient
SECTION 05

How do you read the test results?

Check the direction of change as well as the test statistic.
StatisticExample resultInterpretation
Total pairs20All 20 measured at both time points
Decreased / increased / no change17 / 2 / 1Decreases predominate
Wilcoxon W (two-sided)9Smaller of the signed-rank sums
Exact two-sided p-value0.000141Less than 0.05
Median before / after7 / 6Median is lower after treatment
Decreased 17Increased 2No change 1W9Exact p0.000141
Wilcoxon test results

In this example, the exact two-sided p = 0.000141, so a statistically significant difference is observed. Pain scores clearly tend to fall after treatment. However, the difference between the medians at the two time points (7 − 6 = 1 point) is not the same thing as the median of the individual changes.

SECTION 06

How do you describe the size of the difference?

The p-value and the effect size answer different questions.

The p-value shows how unusual the observed signed-rank sum would be under the null hypothesis. The practical size of the change can be described further with the distribution of each participant's score change, the difference in medians, the Hodges–Lehmann location estimator, confidence intervals and so on.

Some software reports r = Z/√N, based on the Z value from the normal approximation, or the rank-biserial correlation. Record the calculation method and the rule for handling zero differences, and don't compare different effect sizes as if they were the same number.

SECTION 07

How is it different from the paired t test?

They analyze different information and need different assumptions.
CriterionWilcoxon Signed-Rank TestPaired t test
Main informationRanks and signs of the differencesMean of the raw-score differences
Main assumptionSymmetric distribution of paired differences (for location interpretation)Normality of the differences (for small-sample inference)
OutputW, p-value, location and effect sizet, p-value, mean difference, confidence interval
Suitable exampleOrdinal scores, symmetric non-normal differencesInterval-scale scores, interest in the mean difference

Lack of normality alone doesn't mean you should always choose the Wilcoxon test. If the distribution of differences is highly asymmetric, the sign test or another robust approach may be more appropriate.

SECTION 08

How is it different from the Mann–Whitney U test?

The most important distinction is whether the samples are independent or paired.
Study designAppropriate test
Comparing satisfaction between two different teams, A and BMann–Whitney U test
Comparing the same employees' satisfaction before and after trainingWilcoxon Signed-Rank Test
Comparing two conditions with matched pairsWilcoxon test, if the pairing is valid

The Mann–Whitney U test compares the rank distributions of two independent groups. The Wilcoxon signed-rank test links observations by participant and analyzes the differences within pairs. Even when the research questions look the same, the results can differ depending on the sample structure.

SECTION 09

What should you check before the analysis?

First check what is being tested, and look for zero differences and ties.

Are the pairs correctly matched to the same subjects?

Link the pre and post data by participant ID; an observation that exists at only one time point can't be used as a paired observation.

Is the distribution of differences appropriate?

Check the independence and distributional shape of the paired differences. If the distribution of differences is highly asymmetric, be careful about interpreting the result as a location shift.

Are there zero differences or differences with the same absolute value?

How zero differences and ties are handled affects the sample size, the test statistic and how the p-value is calculated. Check the options in your analysis software.

SECTION 10

How do you choose between exact and approximate tests?

Decide how to calculate the p-value by considering the sample and the ties.

For small samples, you can consider an exact test based on all possible sign arrangements. For large samples, a normal approximation is often used. However, with data containing ties and zero differences, the definition of the exact test and its implementation in software can differ.

In this guide, after dropping the zero difference, the exact two-sided p-value was obtained by fully enumerating the sign-randomization distribution, conditional on the ranks, for the remaining 19 nonzero differences. So the example figures are actually computed values and may differ from a typical normal-approximation result.

SECTION 11

How do you report the results?

Write up the method, the number of pairs, the statistics and the interpretation consistently.
Sample write-up

A Wilcoxon signed-rank test was conducted to compare pain scores before and after the pain management program. Analysis of paired data from 20 patients showed that pain scores tended to be lower after treatment than before (median before = 7, median after = 6, W = 9, exact two-sided p < .001). One pair with no change was excluded from the test.

In other studies, report effect sizes and confidence intervals, the symmetry assumption and whether a multiple-comparison correction was applied, as needed.

SECTION 12

How is it different from other analyses?

Nonparametric tests, too, call for different methods depending on the study design.
AnalysisDesignMain question
Wilcoxon signed-rankSame subjects, 2 time pointsIs there a change?
Mann–Whitney UTwo independent groupsDo the two groups' distributions differ?
FriedmanSame subjects, 3 or more time pointsAre there differences between time points?
Kruskal–WallisThree or more independent groupsDo the groups' distributions differ?
Sign testPaired data, focus on direction of changeAre increases and decreases balanced?
SECTION 13

Where can the Wilcoxon test be used?

It can be used in many studies with repeated measurements.

It can be used for symptom scores before and after treatment in health research, for the same students' self-ratings before and after an exam in education research, and for comparing the same users' ratings of two interfaces in user experience research.

The key is not the single fact that the scores aren't normally distributed, but checking whether it's a study design that calls for analyzing the differences between paired observations.

✓ Wrap-up

The Wilcoxon signed-rank test compares the change between two paired measurements.

When observations can be linked one to one, like the same person's scores before and after treatment, it considers both the direction and the relative size of the change.


The Wilcoxon signed-rank test evaluates differences in paired samples using ranks and signs. Don't confuse it with the Mann–Whitney U test, which analyzes independent groups, and interpret the results only after checking how zero differences and ties are handled and whether the distribution of differences is symmetric.

In actual research, rather than presenting only the p-value, it's good to also look at how many subjects' scores increased or decreased and whether the size of the change is practically meaningful. Where needed, presenting effect sizes and confidence intervals helps readers understand the results more accurately.

KEY TAKEAWAY

The core of the Wilcoxon signed-rank test is to bind two measurements of the same subject into a pair and evaluate the direction and relative size of the change. Check the study design and the characteristics of the distribution of differences, and interpret the test result together with the actual size of the change.