IB Maths AI HL Correlation & Regression Paper 1 & 2 ~8 min read

Spearman’s Rank Correlation Coefficient

Pearson’s PMCC only detects straight-line relationships. Spearman’s rank correlation coefficient, written rs, is cleverer: instead of using the raw values, it works on their ranks (1st, 2nd, 3rd…). This lets it measure any monotonic relationship — one that’s always increasing or always decreasing — even if it bends like an exponential curve. The method is simple: rank each variable, then run the PMCC on the ranks. Because it only cares about order, not size, rs is also far less affected by outliers than Pearson’s r.

📘 What you need to know

What “monotonic” means

Spearman’s is built around monotonic relationships. A relationship is monotonic if y only ever moves one way as x increases — always up, or always down — even if the rate changes.

Monotonic ✓
one direction
As x increases, y always rises (or always falls). Includes straight lines AND curves like exponential growth.
Not monotonic ✗
changes direction
y rises then falls (e.g. a U-shape or hill). Spearman’s won’t give a strong value here.

🤔 Why can Spearman’s catch a curve when Pearson’s can’t?

Pearson’s r measures closeness to a straight line, so a bending curve scores poorly. Spearman’s only asks: “does the 1st-ranked x go with the 1st-ranked y, the 2nd with the 2nd, and so on?” For exponential growth, the points are always increasing, so the rankings match perfectly and rs = 1 — even though r < 1 because the points don’t lie on a line. By throwing away the actual sizes and keeping only the order, Spearman’s detects the trend regardless of its shape.

Calculating Spearman’s rank

🧭 Recipe — finding rs

  1. Rank the x-values from 1 to n (e.g. smallest = 1, largest = n).
  2. Rank the y-values from 1 to n in the same direction.
  3. Handle ties: give each tied value the average of the ranks they’d occupy.
  4. Enter the two sets of ranks into your GDC as the new x and y.
  5. Find the PMCC of the ranks — that value is rs.
from values to ranks
rank each variable, then run PMCC on the ranks x value 7 18 37 52 x rank 1 2 3 4 y value 5 3 9 12 y rank 2 1 3 4 PMCC of the ranks = rₛ
Replace each value with its rank (smallest = 1), keep the same direction for both variables, then compute the PMCC of those ranks.

Dealing with tied values

If two or more values are equal, they should share a rank. Give each of them the average of the ranks they would otherwise have taken.

Tied ranks — use the average e.g. the 3rd, 4th & 5th values are equal → each gets 3 + 4 + 53 = 4 share the average of the positions they occupy
After averaging ties, the total of all ranks is unchanged — you’re just sharing the same positions out equally. Both variables must still be ranked in the same direction.

Worked examples

WE 1

Rank the data

Eight students’ maths (x) and English (y) scores are below. Rank each variable from largest (8) to smallest (1).

maths x718375261687582
English y5391217414997
rank x (largest = 8) 82→8, 75→7, 68→6, 61→5, 52→4, 37→3, 18→2, 7→1 x ranks (in table order): 1, 2, 3, 4, 5, 6, 7, 8 rank y (largest = 8) 97→8, 49→7, 41→6, 17→5, 12→4, 9→3, 5→2, 3→1 y ranks (in table order): 2, 1, 3, 4, 5, 6, 7, 8 ranks listed for both variables rank both in the SAME direction (here, largest = 8).
WE 2

Find Spearman’s rank coefficient

Using the ranks from WE 1, find Spearman’s rank correlation coefficient, rs.

enter the RANKS into the GDC x ranks: 1 2 3 4 5 6 7 8 y ranks: 2 1 3 4 5 6 7 8 find the PMCC of the ranks rₛ = 0.97619… rₛ = 0.976 (3 sf) Spearman’s = PMCC of the ranks, not of the raw values.
WE 3

Compare r and rs

For this data, r = 0.794 and rs = 0.976. Comment on the two correlation coefficients.

interpret r (PMCC) r = 0.794 suggests strong positive LINEAR correlation. interpret rₛ (Spearman’s) rₛ = 0.976 suggests strong positive correlation, which is not necessarily linear (the ranks agree almost perfectly). strong positive; relationship monotonic but maybe non-linear rₛ higher than r hints the relationship is monotonic but curved rather than a straight line.
WE 4

Tied values

Rank these times (seconds) from smallest (1) to largest: 12, 15, 15, 19, 22.

order & assign positions 12 → 1, then two 15s occupy positions 2 and 3 tied 15s share the average (2 + 3)/2 = 2.5 each then 19 → 4, 22 → 5 ranks: 1, 2.5, 2.5, 4, 5 tied values take the average of the positions they’d occupy.
WE 5

Why use Spearman’s here?

A scientist records data that follows an exponential growth curve (always increasing). She finds r = 0.88 but rs = 1. Explain why rs is larger.

the data is always increasing (monotonic) so the rankings agree perfectly → rₛ = 1. but the points lie on a curve, not a line so they don’t fit a straight line perfectly → r < 1. rₛ = 1 (perfect monotonic); r < 1 (not perfectly linear) Spearman’s detects the increasing trend; Pearson’s penalises the curve.

💡 Top tips

⚠ Common mistakes

Next up — Comparison of Correlation Coefficients. You now have two tools: Pearson’s (r) for linear, Spearman’s (rs) for monotonic. The next page makes the choice explicit — when to use each, how they’re connected (r = ±1 ⇒ rs = ±1, but not the reverse), and why outliers hit r but not rs.

Need help with Correlation & Regression?

Get 1-on-1 help from an IB examiner who knows exactly what Paper 1 & 2 are looking for.

Book Free Session →