Spearman's rank correlation coefficient

Spearman's rank correlation coefficient

Spec 5.1 · Edexcel International A Level Further Maths: Revision notes

Studying this course? Keep your progress in one place.

Key facts

  • rsr_s measures agreement between the ranks of two variables, from −1-1 to +1+1.
  • Rank both variables in the same direction; tied values get the mean of their ranks.
  • rs=1−6∑d2n(n2−1)r_s=1-\frac{6\sum d^2}{n(n^2-1)}, where dd is the difference in ranks.
  • It suits ranked data and monotonic relationships, and is less affected by outliers.
  • A strong rsr_s does not show that one variable causes the other.

What it measures

How well the ranks of one variable agree with the ranks of another.

Spearman's rank correlation coefficient, rsr_s, takes values from −1-1 to +1+1. rs=+1r_s=+1 means identical rankings, rs=−1r_s=-1 means one is the exact reverse of the other, and rsr_s near 00 means no consistent agreement.

Use it when the data are already ranks, when the relationship is monotonic (always increasing or always decreasing) but not necessarily linear, or when the data are not bivariate Normal.

−1−0.8−0.6−0.4−0.200.20.40.60.81-1: reversed0: no agreement+1: identical

Which situation is best suited to Spearman's coefficient?

Ranking the data

Use the same direction for both variables, and give ties the mean rank.

Rank each variable separately, using the same direction for both (rank 1 for the largest in both, or for the smallest in both). Either direction is fine as long as it is the same.

If two or more values are equal, give each the mean of the ranks they would have occupied: equal values in 4th and 5th place each get rank 4.54.5, and the next value is 6th. These are tied ranks.

  1. 1

    Order

    Each variable separately

  2. 2

    Rank

    Same direction for both

  3. 3

    Ties

    Give each the mean rank

Ranking

Two equal values would occupy 4th and 5th place. What rank does each get?

Calculating rsr_s

Find the difference in ranks dd for each pair, then use the formula.

Find d=rankx−rankyd=\text{rank}_x-\text{rank}_y for each pair, then ∑d2\sum d^2; nn is the number of pairs. The difference in ranks can be positive or negative.

Check: ∑d\sum d must be 00, and with no ties ∑d2\sum d^2 is always even.

  1. 1

    Find each d

    d = −1, 1, −1, 1, 0, and the sum is 0 as it should be

  2. 2

    Sum the squares

    Σd² = 1 + 1 + 1 + 1 + 0 = 4

  3. 3

    Use the formula

    r_s = 1 − (6 × 4)/(5 × 24) = 0.8

Worked pattern with n = 5 and y ranks 2, 1, 4, 3, 5 against x ranks 1 to 5.
  • Spearman's coefficientrs=1−6∑d2n(n2−1)r_s=1-\dfrac{6\sum d^2}{n(n^2-1)}

Worked example

Six dancers are ranked by two judges. The differences in ranks are d=−2,1,1,−1,1,0d=-2,1,1,-1,1,0. Find rsr_s.

For n=5n=5 and ∑d2=10\sum d^2=10, what is rsr_s?

Interpreting and limitations

Interpret in context, and remember it uses only order and does not show cause.

rsr_s near +1+1 means items ranked high on one tend to be ranked high on the other; near −1-1, high on one means low on the other; near 00, little agreement. Reversing one ranking changes the sign but not the size.

Correlation is not causation. rsr_s uses only order, so it ignores how far apart values are, and a rise-then-fall relationship can give rsr_s near 00. With small nn it is unreliable.

0.511.522.533.54246810121416xyy = x²rise then fall
y = x² is monotonic but not linear, so r_s = 1. The dashed rise-then-fall curve gives r_s near 0.

Spearman's

Data used:
Ranks only
Outliers:
Less affected
Relationship measured:
Monotonic
Assumption:
No bivariate Normal needed

Product moment

Data used:
Actual values
Outliers:
Strongly affected
Relationship measured:
Linear
Assumption:
Bivariate Normal

Which is an advantage of Spearman's coefficient over the product moment coefficient?

Try an exam question

Two judges rank seven skaters. The sum of the squares of the differences in ranks is 1414. (a) Calculate Spearman's rank correlation coefficient. (b) Interpret your value.

[4 marks]

That's the notes covered.

Carry on to the next subtopic.

Try a question

Find ∑d2\sum d^2, where dd is the difference between the two ranks given to a dancer.

1 mark, marked against the mark scheme

Revision notes