Spearman’s Rank Correlation
When ranks tell the story
Two judges score the same entries on different scales. The difference between 70 and 80 may mean something different to each judge, but you can still compare how they order the entries. Spearman's rank correlation measures the strength and direction of an increasing or decreasing relationship using the ranks of paired observations. A consistently increasing relationship can have a coefficient of +1 even if the raw scores follow a curve.
Start by matching pairs by their original labels. Rank each column separately in the same direction. You can give rank 1 to the lowest value in both columns, or to the highest value in both. Reversing only one column reverses the sign of the coefficient.
Match the pairs ↓ Rank each column ↓ Keep each pair together ↓ Calculate the coefficient
When there are no tied values
For each pair, let d = rank in X − rank in Y. Add the squared differences and use ρₛ = 1 − 6Σd² / [n(n² − 1)], where n is the number of pairs.
| Entry | X rank | Y rank | d | d² |
|---|---|---|---|---|
| A | 1 | 2 | −1 | 1 |
| B | 2 | 1 | 1 | 1 |
| C | 3 | 4 | −1 | 1 |
| D | 4 | 3 | 1 | 1 |
| E | 5 | 5 | 0 | 0 |
Here n = 5 and Σd² = 4. The coefficient is 1 − 24/(5 × 24) = 0.80. The positive sign shows that higher ranks in one column generally pair with higher ranks in the other. If one judge's ranks were the exact reverse of the other's, the coefficient would be −1.
When some values tie
Give equal values the average of the rank positions they occupy. If two values share positions 2 and 3, each gets 2.5. The next item gets rank 4. Use Pearson correlation on the resulting ranks. The no-tie shortcut assumes that both columns contain all of the ordinary ranks exactly once.
For example, suppose the ranked columns are X = (1, 2.5, 2.5, 4) and Y = (1, 2, 3, 4). Both rank means are 2.5. After subtracting the means, the vectors are (−1.5, 0, 0, 1.5) and (−1.5, −0.5, 0.5, 1.5). The sum of paired products is 4.5. The sums of squares are 4.5 and 5. Therefore ρₛ = 4.5 / √(4.5 × 5) ≈ 0.949.
If a problem supplies Σd² and tie group sizes, you can reach the same answer without rebuilding the table. Start both columns at S₀ = n(n² − 1)/12, the sum of squared deviations from the mean rank before accounting for ties. For each tied group of size t, subtract (t³ − t)/12 from its column's total. Call the adjusted sums Sₓ and Sᵧ. The sum of paired products is (Sₓ + Sᵧ − Σd²)/2. Divide that quantity by √(SₓSᵧ). This gives Pearson correlation on the average ranks.
Check the result before choosing
The coefficient lies between −1 and +1 when both rank columns vary. If one column is constant, its rank variance is zero and the coefficient is undefined. A coefficient close to zero gives little evidence of a monotonic relationship. A curved pattern that first rises and then falls could still be present.
Try it. With no ties, six observations give Σd² = 14. What is ρₛ?
Worked check. The denominator is 6(36 − 1) = 210. The deduction is 84/210 = 0.40, so ρₛ = 0.60.
Sign in to keep your progress. Sign in