IB Maths AI HLCorrelation & RegressionPaper 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
Spearman’s rank, rs, measures how well a relationship fits a monotonic function (always increasing or always decreasing).
It works on the ranks of the data, not the raw values — so it can detect non-linear monotonic relationships too.
Range: −1 ≤ rs ≤ 1. Same sign/strength reading as PMCC.
Method: rank each variable from 1 to n, then find the PMCC of the ranks using your GDC — that value is rs.
Rank both variables in the same direction (both biggest→smallest or both smallest→biggest).
Tied values: each gets the average of the ranks they would have occupied.
rs is not usually affected by outliers, because it only uses ranks, not the actual numbers.
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
Rank the x-values from 1 to n (e.g. smallest = 1, largest = n).
Rank the y-values from 1 to n in the same direction.
Handle ties: give each tied value the average of the ranks they’d occupy.
Enter the two sets of ranks into your GDC as the new x and y.
Find the PMCC of the ranks — that value is rs.
from values to ranks
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 x
7
18
37
52
61
68
75
82
English y
5
3
9
12
17
41
49
97
rank x (largest = 8)82→8, 75→7, 68→6, 61→5, 52→4, 37→3, 18→2, 7→1x ranks (in table order): 1, 2, 3, 4, 5, 6, 7, 8rank y (largest = 8)97→8, 49→7, 41→6, 17→5, 12→4, 9→3, 5→2, 3→1y ranks (in table order): 2, 1, 3, 4, 5, 6, 7, 8ranks listed for both variablesrank 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 GDCx ranks: 1 2 3 4 5 6 7 8y ranks: 2 1 3 4 5 6 7 8find the PMCC of the ranksrₛ = 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-linearrₛ 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 positions12 → 1, then two 15s occupy positions 2 and 3tied 15s share the average(2 + 3)/2 = 2.5 eachthen 19 → 4, 22 → 5ranks: 1, 2.5, 2.5, 4, 5tied 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 lineso 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
Spearman’s = PMCC of the ranks. Rank both variables first, then run the PMCC on the ranks.
Rank both the same way (both smallest→largest or both largest→smallest) — direction must match.
Tied values share the average of the positions they occupy.
rs measures monotonic correlation — it can be high for a curve, so don’t call it “linear”.
rs resists outliers because it uses ranks, not raw values — useful when the data has extreme points.
If rs > r, the relationship is likely monotonic but non-linear (curved).
⚠ Common mistakes
Running the PMCC on the raw values instead of the ranks. Spearman’s needs the ranks.
Ranking the two variables in opposite directions. Both must use the same order.
Giving tied values consecutive ranks. Tied values share the average rank.
Describing rs as “linear”. It measures monotonic (possibly curved) correlation.
Saying rs = 0 means no relationship. It means no monotonic relationship — a hill-shaped curve could still exist.
Expecting rs to match r. They often differ, and the difference is informative.
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.