Rank Correlation
Rank correlation coefficients measure monotonic association: whether one variable tends to rise as the other rises, without requiring the relationship to be linear or the scales to be interval. Replacing scores by ranks discards information about spacing but buys insensitivity to outliers, applicability to ordinal measurements, and freedom from distributional assumptions. Spearman’s and Kendall’s are the two standard members of this nonparametric family; they summarize different features of the ranked data and need not agree exactly in finite samples.
Spearman’s rho
Spearman’s is computed by a ranking procedure:
- Rank the values from smallest to largest, to , assigning equal (average) ranks to tied values.
- Rank the values the same way.
- Let be the difference between the two ranks for case , and compute the shortcut formula
With no ties, this shortcut is numerically identical to the Pearson correlation computed on the two rank vectors — Spearman’s is Pearson’s applied to ranks, which is why it measures monotone association.
Tie caveat. The identity with Pearson-on-ranks is exact only without ties. When ties are present and average ranks are used, the shortcut formula and the Pearson correlation of the rank vectors are no longer exactly equal, and the Pearson-on-ranks value (or a tie-corrected variant of the shortcut) is the computation to use.
Worked example
In a thirteen-case air-traffic example, the two variables are ranked, with one tie: two cases share the value on and each receives the average rank . The rank differences give , so the shortcut yields
Computing the Pearson correlation directly on the average ranks instead gives . Both values round to , but they are not exactly equal: the tie is what separates them, illustrating the caveat above. The procedure — rank, average the tied ranks, difference, square, sum — is the transferable content; the shortcut is a convenience for the no-tie case.
Kendall’s tau
Kendall’s measures the similarity of the two orderings by comparing every pair of cases. For cases, a pair is
- concordant if and , or and — the two variables order the pair the same way;
- discordant if they order the pair oppositely.
With the number of concordant pairs and the number of discordant pairs,
the excess of same-ordered over oppositely-ordered pairs as a fraction of all pairs. The coefficient lies in , with for complete agreement of the orderings and for complete disagreement. The statistic makes no assumptions about the distributions of or .
This version counts every pair in the denominator, so pairs tied on either variable — which are neither concordant nor discordant — pull toward zero. Tie-adjusted variants such as rescale the denominator to account for tied pairs and should be used when ties are substantial; the choice of variant should be reported.
Worked example
Take the first four cases of the thirteen-case example, , , , , giving six pairs:
| Pair | Ordering | Classification |
|---|---|---|
| 1 vs 2 | , | discordant |
| 1 vs 3 | , | discordant |
| 1 vs 4 | , | concordant |
| 2 vs 3 | , | concordant |
| 2 vs 4 | , | concordant |
| 3 vs 4 | , | concordant |
Four pairs are concordant and two discordant, so
The same numerator/denominator bookkeeping scales to any ; the pairwise classification is the entire computation.
Inference by permutation
Under the null hypothesis of no association, every pairing of the and values is equally likely. This suggests an exact, assumption-free test: permute one variable’s values against the other, recompute (or ) for each permutation, and locate the observed statistic in the resulting null distribution — the p-value is the proportion of permuted statistics at least as extreme as the one observed. All -pair structure is preserved under permutation; only the pairing is reshuffled. Enumeration is feasible for small , and random permutation serves as an adequate approximation for larger samples. The logic is the general permutation-test instance of hypothesis testing: build the null distribution from the hypothesis itself rather than from a distributional assumption such as bivariate normality.
Choosing between the coefficients
Spearman’s , being Pearson on ranks, is sensitive to the magnitude of rank discrepancies and behaves like a correlation coefficient on a bounded scale. Kendall’s is built from pair signs, which makes it more robust, natural for ordinal data, and easier to reason about exactly (each pair contributes or 0), at the cost of a smaller numerical scale — a given strength of association produces a smaller than . Both answer the monotone-association question; when they disagree noticeably, the disagreement itself is diagnostic, usually of a few highly influential rank discrepancies.
Related notes
- Correlation — covariance, the linear-association measure Spearman’s generalizes, and inference.
- Correlations involving binary variables — association when one or both variables are dichotomous.
- Classical item analysis — where correlation-based item statistics are applied.