Rank tests and distribution-free inference
Derive exact rank and sign null distributions from exchangeability, keeping continuity, symmetry and the tested hypothesis distinct.
On this page
The question for today
What you’ll understand
- Calculate a rank-sum statistic and its exact permutation probability.
- Distinguish equality-of-distribution, location and symmetry hypotheses.
- Use the binomial sign null with its sampling assumptions.
Rank procedures replace numerical magnitudes by order information. Their null distributions can avoid an unknown continuous distribution because, under the right null, all assignments of group labels to pooled ranks are equally likely. This is a consequence of exchangeability, not an absence of assumptions. Equal medians alone do not produce the usual two-sample rank null, and a signed-rank procedure requires more symmetry than a sign test. Exact small-sample enumeration makes these differences clearer than attaching the word nonparametric to a software command.
Under a common continuous distribution, labels are exchangeable
Let and be independent samples, iid within each group. Under the null that both groups have the same continuous distribution, pooled observations have no ties almost surely and every subset of m pooled ranks is equally likely to belong to X. The rank sum R for X therefore has a combinatorial null distribution depending only on the sample sizes. This exact statement assumes the common-distribution null, not merely equality of two numerical summaries.
Subtracting the smallest possible X rank sum gives a Mann–Whitney count U, here defined as the number of cross-group pairs with X greater than Y. Some references reverse the inequality or report a normalized count, so the convention must be declared. Under the stated no-tie null, its expectation is mn/2 and its variance is mn(m+n+1)/12. Rank invariance under a common strictly increasing transformation follows because such a transformation preserves all pooled order relations.
A distribution-free null is not a universal median test
Under alternatives, the normalized pair count estimates the probability that a new X exceeds an independent Y. Different distributions can have the same median while producing different rank behavior, and equal pairwise probability alone does not generally restore the common-distribution permutation law. Interpreting the test as a location-shift comparison is justified within an additional common-shape shift model. Without that model, a rejection need not mean that only the medians differ.
Ties require their own treatment. Midranks are natural for representing tied observations, but the no-tie variance and exact tables cannot simply be reused unchanged. A conditional permutation distribution given the observed pooled data can still be exact under exchangeable labels, including ties; the attainable probabilities and correction formulas change. Randomized experiments can provide exchangeability through assignment under an appropriate sharp null, while observational sampling requires an argument about the group distributions and independence.
Signs and signed ranks have different symmetry requirements
For independent identically distributed continuous differences, a null median of zero with equal probability on either side gives a binomial positive-sign count. It uses only signs, so symmetry of the full distribution is unnecessary. If zeros occur, removing them changes the conditioning and the positive-sign probability must still be justified among nonzero values. Merely knowing that zero is one possible median of a distribution with atoms does not automatically supply a fair conditional sign experiment.
The Wilcoxon signed-rank statistic instead weights signs by ranks of absolute differences. Its usual exact null relies on a continuous distribution symmetric about zero, making signs fair and independent of magnitudes. A skew distribution can have median zero without satisfying that condition. Paired measurements should first be converted into within-pair differences, with independent pairs as sampling units. Predetermined one-sided or two-sided rejection rules also matter: switching direction after seeing the result can turn a valid exact calculation into an incorrectly calibrated procedure.
Work it through
Enumerate an extreme rank sum
Observe X=(4,5) and Y=(1,2,3). Under the independent continuous common-distribution null, calculate U and the exact one-sided probability for X tending larger. Also give the symmetric two-sided tail probability based on extremeness around the null center.
The X values have pooled ranks four and five, so R=9 and U=9−2×3/2=6. All six cross-group comparisons have X greater than Y, the maximum possible count.
There are choose(5,2)=10 equally likely X-rank subsets. Only {4,5} produces U≥6, so the predeclared upper-tail p-value is 1/10=0.10.
The opposite extreme U=0 occurs only for ranks {1,2}. The symmetric two-sided rule counts both extremes, giving 2/10=0.20. These are exact null probabilities under exchangeability, despite the data set's small size.
An extreme observed rank order can still have a coarse and fairly large p-value because the exact permutation space is small.
The living notebook
Explore the model
Interactive lab · probability
Inspect an exact sign-count null
Pause and Reset, then set both controls to p=0.5 and trials n=8; predict mean count 4 and variance 2. Sum the bars from six through eight to obtain 37/256. Reset and set p=0.5 and n=16; predict mean count 8 and variance 4. These are exact binomial sign-null counts, not a rank-sum or signed-rank distribution. Playback highlights bars rather than generating observations.
- Mean · np
- 5
- Variance · np(1−p)
- 2.5
- Total probability
- 1
These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forExact distribution-free inference comes from a justified null experiment; distinct rank and sign statistics have distinct null laws.
Pause & reason
Check your understanding
Your turn
Try it yourself
Eight independent continuous differences have six positive signs. Under a null with positive-sign probability one-half, calculate the upper-tail sign-test p-value and the symmetric two-sided tail probability.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Count outcomes with six, seven or eight positive signs. For the symmetric two-sided rule, include the reflected tail of at most two positives.
Compare with the solution
The upper tail is [choose(8,6)+choose(8,7)+choose(8,8)]/2^8=(28+8+1)/256=37/256, approximately 0.144531. The reflected tail has the same probability and is disjoint, so the specified two-sided probability is 74/256=0.2890625. These values do not require symmetry of the magnitude distribution, but they do require the fair independent sign null. Applying signed-rank tables would answer a different question.
Keep the idea
Take it with you
- Exchangeable labels yield the exact common-distribution rank null.
- Rank-sum, signed-rank and sign tests require different hypotheses.
- Ties, pairing and data-chosen tail directions change calibration.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.