Statistics Quest

Rank correlation: Spearman and Kendall

Spearman's ρ and Kendall's τ-b measure monotone association using ranks, so they resist outliers and do not require a straight line.

rs=Pearson⁡(rank⁡(x),rank⁡(y))r_s = \operatorname{Pearson}\big(\operatorname{rank}(x), \operatorname{rank}(y)\big)
Spearman's rank correlation (average ranks for ties)
rsr_s
Spearman's ρ: Pearson's r computed on the ranks
rank⁡(x)\operatorname{rank}(x)
ranks 1…n of x, tied values sharing their average rank
τb=C−D(n0−n1)(n0−n2),n0=n(n−1)2\tau_b = \frac{C - D}{\sqrt{(n_0-n_1)(n_0-n_2)}},\qquad n_0=\frac{n(n-1)}{2}
Kendall's τ-b
C, DC,\ D
numbers of concordant and discordant pairs of observations
n0n_0
total number of pairs
n1, n2n_1,\ n_2
pairs tied in x and pairs tied in y (both 0 without ties)

When to use

  • The relationship is monotone (always rising or always falling) but not necessarily linear.
  • Ordinal data (ratings, rankings) or data with outliers or strong skew.

Assumptions

  • Independent pairs. No distributional assumption for the coefficients themselves.
  • The engine tests Spearman's ρ with the t approximation t=rs(n−2)/(1−rs2)t = r_s\sqrt{(n-2)/(1-r_s^2)} (approximate for small n); Kendall's τ-b uses the exact null distribution when there are no ties and n is small, otherwise a tie-corrected normal approximation.

How to interpret

  • Both range from −1 to 1; ±1 means a perfectly monotone relationship.
  • Kendall's τ has a direct reading: (C−D)/n0(C-D)/n_0 (without ties) is P(a random pair is concordant) − P(discordant).
  • τ is usually smaller in size than ρ for the same data; do not compare one with the other.

Common mistakes

  • Treating rank correlation as a test of linearity; it ignores the spacing of values.
  • Comparing Spearman's ρ from one study with Pearson's r or Kendall's τ from another.
  • Forgetting that a monotone association is still not causation.

Example

Two judges rank five entries: x = 1, 2, 3, 4, 5 and y = 2, 1, 4, 3, 5.

  • Spearman: rs=0.80r_s = 0.80 (t = 2.31, 3 df, p = 0.104).
  • Kendall: 10 pairs, C = 8 concordant, D = 2 discordant, so τb=(8−2)/10=0.60\tau_b = (8-2)/10 = 0.60, exact p = 0.233.
  • With only five entries, neither is clear evidence of agreement beyond chance.