Ranking
Intermediate
What you need first. Nothing else on this path comes first. This page is part of Data analysis.
In data analysis, ranking is the replacement of each observation by its place in the ordered sample, with average places for ties. Ranking replaces each observation by its place in the ordered sample.
The smallest value receives rank , the next rank , and so on, unless a tie forces two or more values to share the places they jointly occupy. The average of those places is then the rank of each tied value. Spearman’s rank correlation, introduced in 1904, is the oldest widely used statistic that works entirely with those places.[1]
Ranking
| Fact | Value |
|---|---|
| Topic | Data analysis |
| Listed on | Data analysis |
| Worked example | 1 |
Motivating example
Four finishing times, in minutes, are , , , and . The clock readings carry the size of the gaps: the two s are five minutes behind the , and the is only two minutes ahead of the . A rank summary throws the minutes away and keeps the order. The question it can still answer is who finished ahead of whom, including the fact that two runners finished together. It cannot answer how many minutes separated first from last.[1]
Definition
Order the sample from smallest to largest. If all values are distinct, the ranks are in that order, written back against the original positions. If several observations have exactly the same value, each of them receives the average of the ranks those positions would have taken. For two values tied at the top of a list of four, the places and average to , and both tied values are ranked .
Spearman’s coefficient is the Pearson correlation of the two rank vectors, using average ranks (midranks) whenever values are tied. With tied groups in the first sample, of sizes , the centred sum of squares of its rank vector is
and likewise for the second sample. Each is the sum of squared deviations of the ranks from their mean, . The same Pearson correlation can be expressed using , , and the sum of squared rank differences. The tie-group terms account for any ties, even a single tied pair. When there are no ties, each observation is a group of size , and , so both centred sums of squares reduce to .[1]
Properties
The ranks of observations, with average ranks for ties, still sum to , the sum of the first positive integers. Averaging the shared places is what keeps that identity. Giving every member of a tie the lowest place in the tie, or the highest, would change the sum.
For the times , , , and , the ordered values are , , , . The ranks in that order are , , , . Written against the original order they are , , , and , and
The two s were five minutes from the and seven minutes from the . Their ranks differ from the rank of by and from the rank of by . The rank gaps are not proportional to the time gaps. That disproportion is the point of the replacement: the scale of the measurement has been discarded.[1]
A monotone transformation that does not change the order does not change the ranks. Replacing each time by its logarithm, or by any strictly increasing function, leaves , , , and where they are. A transformation that is not monotone can change them.
Statistical use
Use ranks when the scientific comparison is about order, or when the raw scale is arbitrary but the order is not. Spearman’s coefficient then measures agreement between two rankings on a scale from to . In the Reproducibility Project, original and replication effect sizes were positively associated, with Spearman’s .[2] A rank test of location compares the ranks in two or more groups rather than the raw measurements, which limits the influence of one wild value: that value receives the last place, and the size of its excess over the next value never enters the statistic.
The price is power against alternatives that live in the spacing.[1] If the groups differ by a shift on a scale that is already well measured, the raw measurements use that spacing and the ranks ignore it. Average ranks also need the tie correction in Spearman’s formula once ties are common. Ignoring the correction treats tied values as if they had been distinct.[1]
Worked example
The times , , , and have ranks , , , and in that order, and the ranks sum to . The tied pair occupies places and . Their average, , is the rank of each.
Your turn. Rank , , , and , using average ranks for the tie. Report the four ranks in the original order and their sum.
The ordered values are , , , . The ranks in that order are , , , and . In the original order they are , , , and , and they sum to .
Common misconceptions
Rank is the smallest value in the convention used here, not a judgement that the smallest value is the best. A race that scores the fastest time as first place is using the opposite orientation. The arithmetic of average ranks is the same after the orientation is reversed, but the number attached to a given runner is not.
A tie is not two observations with the same rank chosen arbitrarily. The average of the shared places is fixed by the places, not by a preference for the lower or the upper number. Assigning both of the tied s the rank , and nobody the rank , would make the ranks sum to rather than .
Spearman’s coefficient is not the Pearson correlation of the raw values. It is a correlation of the ranks. Two series can have a modest Pearson correlation and a Spearman correlation of when one series is a strictly increasing curve of the other.[1]
Connections
Spearman’s rank correlation coefficient is the agreement measure built from two rankings. A rank transformation is a data reduction that keeps order and discards spacing. The median is the middle place of the ordered sample, so it is already a function of ranks. Methods that replace measurements by ranks in order to limit the pull of a wild value sit with robust statistics.[1]
Check yourself
Try these questions before opening an answer.
Why the ranks sum to the triangular number
Four distinct values are ranked 1 through 4, with no ties. What is the sum of the ranks, and why does a tie that is given average ranks keep the same sum?
The sum is 10, because the ranks are the first four positive integers. Average ranks share the places that those integers would have occupied, so the total is unchanged.
A tie for first
Two observations tie for the two best places when rank 1 is the smallest. Why is each given 1.5 rather than both given 1?
The places 1 and 2 are shared. Their average is 1.5. Giving both the rank 1 would drop the sum of all ranks below the sum for an untied ranking.
What the raw scale loses
Spearman’s coefficient is computed from ranks rather than from the raw measurements. What feature of the raw scale does that discard?
The spacing between the values. Only the order, and the average places of ties, remain. A strictly increasing transformation of the measurements leaves the ranks unchanged.
History
Spearman, a psychologist, introduced the rank correlation in 1904. Dodge calls it one of the oldest rank statistics. The average-rank rule for ties is part of the same definition: several observations with exactly the same value receive one shared rank, the average of the places they occupy, and the formula for the coefficient then corrects and by .[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 a. (p. 502) b. (p. 502) c. (p. 502) d. (p. 502) e. (p. 502) f. (p. 502) g. (p. 502) h. (p. 502) i. (p. 502) Dodge, Yadolah (2008). The Concise Encyclopedia of Statistics. Springer. https://doi.org/10.1007/978-0-387-32833-1
- ^ (Results) Open Science Collaboration (2015). Estimating the reproducibility of psychological science. Science, 349(6251). https://doi.org/10.1126/science.aac4716
Cite this page
StatWiki (2026). "Ranking." StatWiki. Last updated 2 December 2026. https://www.statwiki.io/articles/ranking.html
@misc{statwiki_ranking,
author = {{StatWiki}},
title = {{Ranking}},
year = {2026},
url = {https://www.statwiki.io/articles/ranking.html},
urldate = {2026-12-02},
note = {StatWiki, last updated 2 December 2026}
}