Wilcoxon signed-rank test
Intermediate
What you need first. Nothing else on this path comes first. This page is part of Statistical inference.
In statistical inference, the Wilcoxon signed-rank test is a test of a symmetric paired difference that ranks the absolute differences and sums the ranks of one sign. It is the paired procedure that keeps the direction of each difference and weights that direction by the rank of the absolute difference. Its null concerns independent differences symmetric about a specified centre. That centre is a median and is also the mean when the expectation exists; a zero mean or median alone does not supply the symmetry the test needs.
Wilcoxon signed-rank test
| Fact | Value |
|---|---|
| Topic | Statistical inference |
| Listed on | Statistical inference |
Motivating example
Eight students sit a short test, take a lesson, and sit a parallel test. Seven scores rise, by and points. The eighth falls by . A procedure that counts only signs sees seven improvements out of eight and treats the fall of as one negative sign, the same kind of evidence as a fall of half a point. A procedure that ranks the absolute differences gives that fall rank , the largest rank in the sample, and the conclusion moves. The signed-rank test is the second procedure. The comparison with the sign count, on these same eight numbers, is the worked example below.
Signed ranks of the paired differences
Let the paired measurements be for , and write . Drop every pair with , and let be the number that remain. Rank the absolute values from , the smallest, to , the largest. If several absolute values are equal they share the average of the ranks they occupy. Write for the rank attached to the th remaining difference, including these average ranks (midranks). The signed-rank statistic is the sum of the ranks attached to the positive differences.[1] Without ties the ranks are ; averaging tied ranks preserves their total . The negative ranks are whatever is left out of , so they sum to . Either sum determines the other.
The null says that the differences are independent and symmetric about zero. Conditional on their nonzero absolute values, the signs are independent fair coins, so the ways of signing the ranks are equally likely. Zero is then a median of the and is also their mean if the expectation exists. Neither a zero median nor a zero mean alone gives this null without symmetry.[1] [2]
A one-sided alternative in the positive direction rejects for large . A two-sided alternative rejects for a value far from the null mean in either direction. The same construction tests whether a single sample is symmetric about a stated centre , by pairing each observation with and ranking those differences.[1]
What symmetry adds, and what it does not
The sign test uses only the indicators . The signed-rank test uses those indicators and the order of the . When the differences really are symmetric, that extra information is why the signed-rank test is the more powerful of the two against a shift. When symmetry is not a fair description, the sign test is the procedure that still matches the question it asks, which is whether positive and negative differences are equally likely. The gain and the extra assumption are the same fact.[2]
Symmetry lets the null be read as a statement about the mean only when that mean exists. Independent standard Cauchy differences are symmetric about zero and have median zero but no mean; conditional on their nonzero magnitudes, their signs are still independent fair coins. Without symmetry, a mean can sit away from zero while the median is zero, or the reverse, and a large is not by itself a statement about either centre. The paired statistic targets the mean difference and takes its critical value from the Student table on degrees of freedom. The signed-rank null replaces that normal-theory reference by symmetry of the differences.[1] [2]
The worked example below shows that “uses the magnitudes” is not the same sentence as “has the smaller -value in this sample”. One large negative difference pulls down and can leave the signed-rank test short of a rejection while the sign count still rejects. Power is a property of the tests under a stated alternative, not a comparison of two -values on one sample.
The exact law obtained by signing the ranks
With untied absolute values, under the null just stated, is the sum of a random subset of , and every subset has probability .[2] That is an exact finite law, not an approximation. For a positive-direction alternative the exact -value is the number of subsets whose elements add to at least the observed , divided by . Wilcoxon obtained those probabilities by counting the partitions of the rank sum.[3] Because that distribution is symmetric about its mean, the lower tail of the same size is the number of subsets adding to at most . When the observed value is not the mean the two tails are disjoint, so the two-sided probability is twice the smaller one. The attainable probabilities are multiples of , so a nominal level such as need not be hit exactly.
With ties, condition on the observed nonzero magnitudes and enumerate all sign assignments to the labelled midranks . Each difference keeps its own label even when its rank equals another. Thus , where the indicators are independent fair coins under the null. Count assignments, not distinct possible sums: several assignments can produce the same , and each counts separately in the tail probability. This is an exact conditional law even with ties. Complementing every sign still makes the distribution symmetric about half the total rank sum.
The conditional null mean and variance follow from the same signings. Each labelled rank enters with probability , independently of the others, so Without ties, the variance simplifies to . With ties, use the squared midranks instead. The summands are independent conditional on the ranks, but generally not identically distributed because their rank weights differ. For the critical value can be approximated by comparing with a normal reference.[1] For smaller the exact subset count is the probability, and the normal formula only describes where the observation sits.
For example, differences have labelled midranks and observed . The eight sign assignments give positive rank sums , listed with multiplicity. Five are at least , so the exact upper-tail probability is . The conditional variance is , whereas the untied formula would give .
A zero difference is removed before is chosen, so it contributes neither a sign nor a rank.[1] A tie among absolute values is given the average of the ranks those values occupy. Dodge describes comparing the statistic based on those average ranks with the normal table.[1] That comparison is an approximation; the labelled sign count gives the exact conditional probability.
Reporting the exact count, the interval, and the approximation
When the sum of the positive ranks is the statistic and , the critical value for untied absolute values is read from the ordinary untied signed-rank table. When , that critical value can be approximated from the normal table. A two-sided test rejects when the statistic is smaller than or larger than , the lower and upper critical values.[1] For a one-sided question, state the direction before seeing , report after zeros have been dropped, and report the subset count when the absolute values are untied and is small.
An interval is obtained by inverting the exact two-sided test: it is the set of shifts that the test does not reject. Under the symmetry assumption the test already uses, a shift of the differences is a statement about their median. The worked example below carries out that inversion for one sample. Because the exact distribution places mass only on multiples of , the coverage of the inverted interval need not equal the nominal level, and the interval need not be the shortest one with its coverage.
Eight pairs and one large decline
The scores before the lesson are . The scores after it are . The differences are None is zero and the eight absolute values are distinct, so and the ranks of are through in that order. The only negative rank is . Hence , and the negative ranks sum to .
The exact reference set is the subsets of . A subset sums to or more precisely when the ranks left out, the ones that would have been negative, sum to or less. There is such signing of negative-sum , of sum and of sum . The counts for negative sums through are and . These add to , so the exact one-sided probability is The matching lower tail is as well, and the two events are disjoint, so the two-sided probability is . At a one-sided level the signed-rank test does not reject.
The sign test on the same differences keeps seven positive signs out of eight. Its one-sided probability is At the same one-sided level the sign test does reject. The two procedures disagree because the fall of is one sign to the sign test and the rank to the signed-rank test.[1]
Replace by and leave the other seven differences as they are. The signs are unchanged, so the sign-test probability is still . The absolute values are now , and the negative difference carries rank rather than rank . Then , and only the empty negative set and the singleton produce a positive rank sum of or . The exact one-sided probability falls from to , and the signed-rank test rejects. One observation, changed in magnitude but not in sign, reverses the signed-rank conclusion and leaves the sign test untouched.
The normal approximation is a different object from either exact probability. For , The mean and the variance are those of the exact null, and the normal approximation is the reference intended for .[1] The standardised value of is , and the corresponding upper normal probability is about . The continuity correction that wilcox.test applies by default to this approximation compares with the same normal curve and gives about .[4] Both approximations are smaller than the exact . At the subset count is the probability to report.
The point estimate that accompanies the exact test is the median of the averages with . For these eight differences that median is . With conf.int = TRUE, wilcox.test returns an estimate of the location parameter, and on these differences that estimate is this same median.[4]
The exact interval is the set of shifts that the exact two-sided test does not reject. With equally likely signings, , and while . The test that rejects only for or therefore has two-sided size . Inverting it on these differences gives the open interval from to , which are the th and the rd of the ordered pairwise averages. Every shift strictly between those endpoints leaves the untied positive rank sum between and . Under a continuous symmetric law the coverage of that interval is rather than exactly , because the exact test cannot spend probability in fractions finer than .
In R, wilcox.test(after, before, paired = TRUE, alternative = "greater") returns the statistic and the one-sided probability . The default two-sided call returns . Adding conf.int = TRUE returns the estimate and the interval from to . The argument exact selects whether an exact -value is computed. These eight differences are untied, and the returned probability matches the subset count . The argument correct = TRUE, the default in the call, applies a continuity correction in the normal approximation, and that corrected probability was .[4]
Your turn. Five differences are . Drop the zero, rank the remaining absolute values, and compute and the exact one-sided probability of a positive rank sum at least that large.
The zero is removed, so four ranks remain. The absolute values receive ranks , and the negative difference carries rank . Thus . Of the subsets of , the three subsets , and sum to at least . The probability is .
Magnitudes do not guarantee a smaller probability
A non-rejection is sometimes read as evidence that the median difference is zero. Here against a null mean of and a null standard deviation . The exact one-sided probability is . That is what a null distribution of this width does with a moderate rank sum. It is not a measurement of the shift. The median of the pairwise averages on the same differences is , and the exact interval in the worked example runs from to : the test’s silence at is compatible with shifts of several points either way.
A second misreading is that the signed-rank test simply “corrects” the sign test and must therefore be more significant whenever the magnitudes are informative. On these eight differences the sign test’s one-sided probability is and the signed-rank probability is . Using the magnitudes made the evidence weaker, because the one negative difference was the largest. After that difference is reduced to , the signed-rank probability becomes and the sign-test probability does not move. Magnitude is information. It is not a guarantee of a smaller -value.
Where the subset count stops
Each difference must be symmetric about the null centre, and the differences must be mutually independent.[1] [2] The ordinary untied reference table needs no ties among the absolute values; the exact count does not. With ties, enumerate the labelled midranks conditional on the nonzero magnitudes. Dependence between pairs, as when several pairs share a ward or a day, does not by itself bias each sign, but it does destroy the claim that all signings are equally likely. Without independent signs, the conditional variance need not equal ; even with independent signs, the untied formula must be replaced when there are ties.
Symmetry is an assumption about the shape of the differences, not a consequence of pairing. Pairing fixes how is formed. A skewed difference can have median zero and mean far from zero; is then aimed at a centre the distribution does not have. In that case the sign test remains a test of the sign probability, and the signed-rank conclusion does not transfer to it.[2]
The subset count over is the untied case of the labelled-rank enumeration. For these eight differences that count and the probability returned by wilcox.test are the same number, .[2] [4]
Paired signs, unpaired ranks, and the permutation count
The sign test is the paired comparison that gives every untied difference the same weight. The Wilcoxon rank-sum test ranks observations pooled from two independent samples; it does not start from pairs. Paired samples are the design that produces the differences . The one-sample test, applied to those differences, is the normal-theory comparison of the mean. A permutation test is the broader idea of which the signings are one case: the reference distribution is generated by a group of rearrangements that the null says are equally likely.
Check yourself
1. All eight differences in the worked example are positive. What are and the exact one-sided probability?
Every rank from to is positive, so . Only one of the signings does this. The probability is .
2. A ninth pair is added and its difference is . The other eight differences stay as in the worked example. What are and ?
The zero is dropped before ranking, so still. The remaining absolute values and their signs are unchanged, and is still . The reference set still has signings.
3. The difference is replaced by . It is still the unique largest absolute value, and it is still negative. What happens to and to the sign count?
The order of the absolute values is unchanged, so the ranks are unchanged and stays . The signs are unchanged, so the sign count stays at seven positives out of eight. Increasing a difference that is already the largest, without changing its sign, moves neither statistic.
Paired ranks in 1945
Frank Wilcoxon introduced the ranking of paired differences in 1945, as a quick substitute for the paired comparison of means. In the paired form, ranks replace the absolute differences and a negative difference gives its rank a negative sign. The probability of a small rank total is found by counting the partitions of that total, which is the subset enumeration above in the language of partitions. For eight pairs his table gives probability for a smaller rank sum of , and for a smaller rank sum of or less.[3] The subset counts for those same totals are and . He also noted that Friedman’s rank method, when only two treatments are compared, reduces to the binomial test that uses the signs alone, and that the signed ranks keep the sizes as well.[3]
In 1949 Wilcoxon proposed another method to treat the zero differences that can appear between two observations.[1] The null mean , the null standard deviation, and the normal approximation for are the form in which the procedure is now calculated when the subset count is no longer the practical reference.[1]
See also
Line chart · Apriori algorithm · Asymptotic analysis · Average treatment effect · Base rate · Bayesian inference · Bayesian model · Bayesian probability
References
- ^ a b c d e f g h i j k l m a. (pp. 571–572) b. (pp. 572–573) c. (pp. 572–573) d. (pp. 409, 573) e. (p. 572) f. (p. 571) g. (pp. 571, 574) h. (p. 572) i. (p. 486) j. (p. 572) k. (p. 572) l. (p. 571) m. (p. 572) Dodge, Yadolah (2008). The Concise Encyclopedia of Statistics. Springer. https://doi.org/10.1007/978-0-387-32833-1
- ^ a b c d e f g a. (Purpose and assumptions) b. (comparison with the sign test) c. (assumptions) d. (the signings) e. (assumptions) f. (comparison with the sign test) g. (the signings) NIST (2023). NIST Dataplot: Signed Rank Test. National Institute of Standards and Technology. https://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/signrank.htm
- ^ a b c a. (p. 82) b. (p. 82) c. (pp. 80–81) Wilcoxon, F. (1945). Individual Comparisons by Ranking Methods. Biometrics Bulletin, 1(6), 80–83. https://doi.org/10.2307/3001968
- ^ a b c d a. (Usage and Arguments, `correct`) b. (Usage, Arguments `conf.int`, and Value) c. (Usage, Arguments `paired`, `exact`, `correct` and `conf.int`, and Value) d. (Value) R Core Team (2026). Wilcoxon Rank Sum and Signed Rank Tests (R-devel documentation for wilcox.test). R Foundation for Statistical Computing. https://stat.ethz.ch/R-manual/R-devel/library/stats/html/wilcox.test.html
Cite this page
StatWiki (2026). "Wilcoxon signed-rank test." StatWiki. Last updated 2 December 2026. https://www.statwiki.io/articles/wilcoxon-signed-rank-test.html
@misc{statwiki_wilcoxon_signed_rank_test,
author = {{StatWiki}},
title = {{Wilcoxon signed-rank test}},
year = {2026},
url = {https://www.statwiki.io/articles/wilcoxon-signed-rank-test.html},
urldate = {2026-12-02},
note = {StatWiki, last updated 2 December 2026}
}