The Wilcoxon signed-rank test is a statistical hypothesis test used to assess whether a population of measurements, or differences between paired measurements, is symmetric about a specified value. It combines the signs of deviations from that value with the ranks of their absolute magnitudes. Under a symmetric location model, it tests whether the population’s center equals the specified value. Introduced by Frank Wilcoxon in 1945, it is a standard method in nonparametric statistics and an alternative to the paired Student’s t-test when a normal model for differences is unsuitable.
Setting and hypotheses
The test has two common forms:
- One-sample form: observations are compared with a specified location , using differences .
- Paired-sample form: each observational unit provides two measurements, and , and the test is applied to . A hypothesized change other than zero can also be subtracted.
Pairing may arise from repeated measurements of the same unit or from matched units. Independence is required between pairs, not between the two observations within a pair.
A standard formulation assumes that the differences are independent observations from a common continuous distribution symmetric about a location . The null hypothesis is
The alternative hypothesis may be two-sided, , or one-sided, or .
Under symmetry, the location is also the population median. Nevertheless, the signed-rank test is not a distribution-free test of a median alone: a distribution can have median zero without being symmetric, and the usual signed-rank null distribution need not then apply.
Construction of the statistic
For the conventional version of the test:
- Compute the differences .
- Remove differences equal to zero.
- Rank the absolute values from smallest to largest.
- Assign tied absolute values their average rank.
- Sum the ranks separately for positive and negative differences.
Let be the number of nonzero differences and the rank assigned to . Define
Since the ranks sum to ,
Large supports a positive location shift; small supports a negative shift. Common choices of test statistic include , the smaller sum
and the signed sum
These statistics encode equivalent information when is fixed, but software packages use different names and reporting conventions. A reported “Wilcoxon statistic” therefore requires its definition to be clear.
The ranks here describe ordering by magnitude and are unrelated to matrix rank.
Exact null distribution
Under the continuous symmetric null hypothesis, each difference is equally likely to be positive or negative, and its sign is independent of its absolute magnitude. Conditional on the observed magnitudes, all sign assignments are equally probable.
Without ties, consequently has the same distribution as
where the are independent Bernoulli random variables with success probability .
This yields an exact sampling distribution, obtainable through enumeration or recursive calculation. For an upper-tailed alternative, the p-value is
A common two-sided convention doubles the smaller inclusive tail probability, capped at 1:
Because the distribution is discrete, attainable p-values occur in steps. Different definitions of two-sided exact p-values can also produce different results, so the convention matters.
Example
Suppose six paired differences are
Their absolute values already have ranks , giving
Of the possible sign assignments, two produce : no positive ranks, or only rank 1 positive. By symmetry, two produce . The doubled-tail two-sided p-value is therefore
Thus, five positive differences out of six do not by themselves imply significance at a significance level of .
Normal approximation
When there are no ties or zeros, the null expectation and variance of are
For sufficiently large samples, a standardized statistic is approximately normally distributed:
A continuity correction is often applied, commonly by moving the numerator toward zero for a two-sided calculation. Its implementation depends on the tail and software convention.
There is no universal sample-size cutoff guaranteeing an adequate approximation. Accuracy depends on the sample size, ties, zero differences, and the tail probability of interest.
Ties and zero differences
Tied absolute differences
Ties receive average ranks. If zero differences have been discarded, the conditional sign-assignment variance is
Equivalently, if tied groups have sizes ,
The usual no-tie exact tables are not valid unchanged when ties occur. Nevertheless, an exact conditional calculation can still be performed by enumerating sign assignments using the observed average ranks, provided the null sign-symmetry assumptions hold. Whether software implements this calculation varies.
Zero differences
Several conventions are used:
- Wilcoxon convention: discard zeros before ranking.
- Pratt convention: include zeros when ranking absolute differences, but omit their ranks from the positive and negative sums.
- Zero-splitting convention: include zeros in ranking and allocate half their rank sum to each side.
These conventions change the statistic and its null distribution. The formulas for the conventional no-zero procedure cannot be transferred unchanged to every alternative.
If every difference is zero, the conventional procedure has no nonzero ranks to analyze. Software may return a special result or indicate that the calculation is undefined.
Location estimation and confidence intervals
The signed-rank procedure is closely connected to the Hodges–Lehmann estimator. For a one-sample set of differences, form the Walsh averages
Their median is the one-sample Hodges–Lehmann estimate.
Its population target is the pseudomedian, defined as a median of , where and are independent observations from the same population. For a continuous distribution symmetric about , the pseudomedian and median both equal . They need not coincide in an asymmetric distribution.
A confidence interval for the symmetric location can be obtained by inverting signed-rank tests over candidate values. Its endpoints can be expressed using ordered Walsh averages. This connection does not make the standard test valid for arbitrary asymmetric distributions merely by reinterpreting its target as a pseudomedian.
Comparison with related tests
Paired Student’s t-test
The paired Student’s t-test tests the mean difference and has an exact finite-sample t distribution when the differences are normally distributed. The signed-rank test uses ranks rather than the original magnitudes and assumes symmetry for its standard location interpretation.
The signed-rank test is less sensitive to the numerical size of an extreme difference: making the largest absolute difference still larger does not change its rank. This does not make it assumption-free or immune to unusual observations.
Under normal location alternatives, its asymptotic relative efficiency against the paired t-test is , approximately . Its relative power can be higher for some heavier-tailed distributions, but neither method is uniformly superior.
Sign test
The sign test uses only whether each difference is positive or negative. For continuous independent observations, its median test does not require symmetry.
The signed-rank test additionally uses the ordering of absolute differences. This extra information can improve power when the symmetry model is appropriate, but also introduces assumptions absent from the sign test.
Wilcoxon rank-sum test
The Wilcoxon rank-sum test, also called the Mann–Whitney U test, concerns two independent samples. It is not the signed-rank test. The shared name “Wilcoxon test” can obscure the distinction between paired and independent-sample designs.
Interpretation and limitations
The signed-rank test is used for paired comparisons in experiments, measurement studies, and other settings where differences have meaningful numerical magnitudes. Several limitations govern its interpretation:
- Symmetry matters. Without it, rejection need not indicate a nonzero median; an asymmetric distribution with median zero can violate the signed-rank null.
- Differences must be meaningful. Ranking absolute differences requires more structure than merely ordering the original observations. Arbitrary numerical coding of ordinal categories can change the result.
- Observations must have the appropriate dependence structure. Repeated differences from the same participant, clustered units, or serially dependent measurements do not generally constitute independent pairs.
- Statistical significance is not magnitude. A p-value does not quantify the practical importance of a change. A location estimate, interval, or clearly defined effect size provides different information.
- Non-rejection is not equivalence. A large p-value does not establish that a change is absent or negligibly small.
- Pairing does not establish causation. A significant before–after difference alone does not identify a causal effect; that interpretation depends on the study design and possible confounding.
A reproducible report identifies the direction of subtraction, the alternative hypothesis, the statistic convention, the treatment of ties and zeros, and whether the p-value was exact, based on sign-assignment simulation, or obtained by a normal approximation.