Unit 4002Rank Correlation
Your Progress
16%

🏅 Spearman's Rank Correlation

When data is ranked rather than measured precisely — inspector quality scores, subjective ratings — Spearman's coefficient measures how well two rankings agree.

Level 4 HN Engineering MathsInteractive ToolsVisual DiagramsGraded Practice
2Topics
8Worked Examples
4Eng. Cases
12Practice Qs
🥇Ranking DataAssigning positions, handling ties
📐Spearman's r_sRank-based correlation
⚙️ApplicationsReal engineering
🎮Quick-Fire GameTest your speed
📝PracticeGraded questions
🎯What you will learn
Rank raw data (including handling tied values); calculate Spearman's rank correlation coefficient r_s; and understand when to use it instead of Pearson's r.
💡 Spearman's r_s only needs the order of the data, not exact values — making it ideal for subjective rankings, ordinal data, or relationships that are consistent but not perfectly linear.
🧭How to use this resource
1. Read the rules banner at the top of each tab
2. Experiment with the interactive tool
3. Check the key vocabulary panel
4. Study the visual diagram, then the worked examples
🥇

Ranking Data

Before finding Spearman's coefficient, every value must be converted to a rank position.

📏 The Rules — Ranking

Rank 1 = highest (or lowest) value
Be consistent — same direction for both variables
Tied values share the average rank
e.g. two values tied for 3rd and 4th both get rank 3.5
Σd = 0 always (no ties)
d = difference in ranks; a useful check on your ranking
🔧Rank AssignerEnter data to see ranks (with tie handling)
Enter a list of numbers, choose the ranking direction, then press Rank to see each value's rank (with ties averaged)…

📖 Key Vocabulary

Rank — a value's position when the data is sorted, from 1 upward.
Tied ranks — when two or more values are equal, they share the average of the ranks they would otherwise occupy.
Ordinal data — data that can be ranked (1st, 2nd, 3rd) but where the gaps between ranks aren't necessarily equal.
d — the difference between a data item's two ranks (in x and in y).
Value: 201512129 Rank: 12 3.53.5 5 tied values share the average of ranks 3 and 4
👁️ Visual aid: the two tied 12s would occupy ranks 3 and 4 — instead both get 3.5, and rank 5 continues as normal afterwards.
✏️Worked Example 1 — Ranking without tiesType: Simple ranking
Question Rank the values 45, 30, 60, 15 (highest = rank 1).
Sort descending 60, 45, 30, 15
Assign ranks 60→1, 45→2, 30→3, 15→4
Answer Ranks: 45→2, 30→3, 60→1, 15→4
🔗Worked Example 2 — Ranking with one tieType: Single tie
Question Rank the values 25, 25, 18, 30 (highest = rank 1).
Sort descending 30, 25, 25, 18
Assign, averaging the tie 30→1; the two 25s would be ranks 2 and 3, so both get (2+3)/2=2.5; 18→4
Answer Ranks: 25→2.5, 25→2.5, 18→4, 30→1
🔢Worked Example 3 — Ranking with a triple tieType: Multiple ties
Question Rank the values 8, 8, 8, 5, 3 (highest = rank 1).
Identify Three values tied for what would be ranks 1, 2, 3
Average (1+2+3)/3 = 2
Answer All three 8s get rank 2; 5→4, 3→5
⚙️Worked Example 4 — Engineering context (ranking inspector scores)Type: Engineering
Question Five welds are given subjective quality scores by an inspector: 7, 9, 9, 6, 8. Rank them (highest quality = rank 1).
Sort descending 9, 9, 8, 7, 6
Handle the tie Two 9s share ranks 1 and 2 → both get 1.5
Answer Ranks: 7→4, 9→1.5, 9→1.5, 6→5, 8→3 — ready to compare against a second inspector's ranking using Spearman's coefficient.
🧠 Common slip: giving tied values consecutive ranks instead of the average — this breaks the property that ranks always sum to the same total, and distorts the final correlation coefficient.
📐

Spearman's Rank Correlation Coefficient

Apply Pearson's logic to ranks instead of raw values — robust to outliers and non-linear (but monotonic) relationships.

📏 The Rules — Spearman's r_s

r_s = 1 − [6Σd² / n(n²−1)]
d = difference between the two ranks for each item
−1 ≤ r_s ≤ +1
Same interpretation as Pearson's r, but for rank order
Use with ties cautiously
The simple formula is an approximation when ties are present
🔧Spearman's r_s CalculatorEnter two rankings (or raw data — it will rank them for you)
Enter two matching datasets, then press Calculate to see them ranked, the d² values, and Spearman's r_s…

📖 Key Vocabulary

Spearman's r_s — the rank correlation coefficient, based on rank differences rather than raw values.
d — rank(x) − rank(y) for each pair; squared and summed in the formula.
Monotonic relationship — one that consistently increases or decreases, even if not perfectly linear; Spearman's captures this even when Pearson's would not.
Robust to outliers — because it uses ranks, one extreme value can't distort r_s the way it can distort Pearson's r.
Pearson's r uses raw values sensitive to outliers Spearman's r_s uses ranks robust to outliers both give a coefficient between −1 and +1
👁️ Visual aid: the two methods measure a similar idea, but Spearman's works on the rank order instead of exact values.
✏️Worked Example 1 — Full Spearman calculation (no ties)Type: Full calculation
Question Two judges rank 5 welds: Judge A: 1,2,3,4,5; Judge B: 2,1,3,5,4. Find r_s.
Differences d 1−2=−1, 2−1=1, 3−3=0, 4−5=−1, 5−4=1
d² 1,1,0,1,1 → Σd²=4
Answer r_s = 1 − [6(4)/(5(24))] = 1 − 24/120 = 1−0.2 = 0.8 — strong agreement between the judges.
🔍Worked Example 2 — Interpreting the coefficientType: Interpretation
Question Two rankings give r_s = 0.95 and r_s = 0.15 respectively. Compare their agreement.
Interpret r_s=0.95 shows the two rankings agree almost perfectly on ordering; r_s=0.15 shows almost no consistent agreement.
Answer The first pair of rankers are essentially applying the same standard; the second pair are ranking almost independently.
🔗Worked Example 3 — Spearman with a tieType: With ties
Question Data set A ranks: 1, 2.5, 2.5, 4; Data set B ranks: 1, 2, 4, 3. Find r_s.
Differences d 1−1=0, 2.5−2=0.5, 2.5−4=−1.5, 4−3=1
d² 0, 0.25, 2.25, 1 → Σd²=3.5
Answer r_s = 1 − [6(3.5)/(4(15))] = 1 − 21/60 = 1−0.35 = 0.65 — moderate agreement, even with a tie present.
⚙️Worked Example 4 — Engineering context (comparing inspectors)Type: Engineering
Question Two QC inspectors independently rank 6 components by visual defect severity. Their rank differences squared sum to Σd²=10. Find r_s and comment on inter-inspector agreement.
Apply formula r_s = 1 − [6(10)/(6(35))] = 1 − 60/210
Answer r_s ≈ 0.714 — reasonably good agreement, though a formal inspector-training review might tighten consistency further.
🧠 Common slip: using Spearman's simple formula when there are many ties without adjustment — for heavily tied data, a more advanced tie-corrected formula (or Pearson's r on the ranks directly) gives a more accurate result.
⚙️

Engineering Applications

Four live scenarios — each with its own calculator. Enter your own numbers.

👷 Inspector Agreement — QC Consistency

Comparing two inspectors' defect-severity rankings of the same batch reveals how consistent their judgement is.

High r_s → inspectors apply similar standards
📟 Try it — Inspector Agreement Calculator
Enter both inspectors' scores, then press Calculate…

🏆 Supplier Ranking vs Delivery Performance

Comparing a subjective supplier quality ranking against an objective on-time-delivery ranking checks whether reputation matches reality.

r_s close to 1 → reputation and performance align
📟 Try it — Supplier Ranking Calculator
Enter both rankings, then press Calculate…

🎓 Exam Marker Reliability

Two markers independently score the same set of exam scripts; Spearman's r_s quantifies marking consistency.

Low r_s may prompt a marking-standard review
📟 Try it — Marker Agreement Calculator
Enter both markers' scores, then press Calculate…

🔧 Material Hardness Rank vs Wear Resistance Rank

Where exact relationships are non-linear but consistently ordered, Spearman's r_s can reveal a strong monotonic link Pearson's r would understate.

r_s vs Pearson's r comparison highlights non-linearity
📟 Try it — Material Ranking Calculator
Enter both rankings, then press Calculate…
🎮

Quick-Fire Spearman Game

12 questions on ranking and Spearman's coefficient. How many can you get?

⚡ Spearman Challenge

Score: 0Question: 1/12Streak: 0🔥
Press Start to begin!
📝

Practice Questions

Graded from warm-up to challenge. Attempt fully before revealing the working.

🥉 Q1–4 Warm-up🥈 Q5–8 Standard🥇 Q9–12 Challenge
Question 1 🥉2 marks
Rank the values 40, 10, 30, 20 (highest = rank 1).
40→1, 30→2, 20→3, 10→4
Question 2 🥉2 marks
Rank the values 5, 5, 3, 8 (highest = rank 1), handling the tie.
8→1, 5→2.5, 5→2.5, 3→4
Question 3 🥉2 marks
State the range of possible values for Spearman's r_s.
−1 ≤ r_s ≤ +1
Question 4 🥉2 marks
If Σd²=0 for n=5 rankings, find r_s.
r_s = 1 − 0 = 1 (perfect agreement)
Question 5 🥈4 marks
Two rankings of 5 items: A: 1,2,3,4,5; B: 5,4,3,2,1. Find r_s.
d: −4,−2,0,2,4 → d²: 16,4,0,4,16, Σd²=40
r_s = 1−[6(40)/(5×24)] = 1−240/120 = 1−2
r_s = −1 (perfect disagreement)
Question 6 🥈4 marks
Two rankings: A: 1,2,3,4; B: 1,3,2,4. Find r_s.
d: 0,−1,1,0 → d²: 0,1,1,0, Σd²=2
r_s = 1−[6(2)/(4×15)] = 1−12/60
r_s = 0.8
Question 7 🥈3 marks
Explain why Spearman's r_s is preferred over Pearson's r for subjective quality scores.
Subjective scores are ordinal (ranking matters more than exact value) — Spearman's uses only the order, which is more appropriate and more robust to inconsistent scoring scales between raters.
Question 8 🥈4 marks
n=6, Σd²=14. Find r_s.
r_s = 1−[6(14)/(6×35)] = 1−84/210
r_s = 0.6
Question 9 🥇5 marks
Two judges score 5 components: Judge X: 88,75,92,65,80; Judge Y: 85,78,90,60,82. Rank both, find Σd² and r_s.
X ranks (high=1): 92→1,88→2,80→3,75→4,65→5
Y ranks: 90→1,85→2,82→3,78→4,60→5
Pairs (X,Y ranks): (2,2)(4,4)(1,1)(5,5)(3,3)
All d=0 → Σd²=0
r_s = 1 (perfect agreement)
Question 10 🥇5 marks
Component hardness ranking: 1,2,3,4,5; wear resistance ranking: 1,2,4,3,5. Find r_s and interpret.
d: 0,0,−1,1,0 → d²:0,0,1,1,0, Σd²=2
r_s = 1−[6(2)/(5×24)] = 1−12/120
r_s = 0.9 — strong monotonic relationship between hardness and wear resistance
Question 11 🥇5 marks
Two rank sets with a tie: A: 1,2.5,2.5,4; B: 2,1,3,4. Find r_s.
d: 1−2=−1, 2.5−1=1.5, 2.5−3=−0.5, 4−4=0
d²: 1, 2.25, 0.25, 0, Σd²=3.5
r_s = 1−[6(3.5)/(4×15)] = 1−21/60
r_s = 0.65
Question 12 🥇5 marks
Two QC inspectors rank 7 batches; Σd²=6. Find r_s and comment on whether their standards are well aligned.
n=7, n²−1=48
r_s = 1−[6(6)/(7×48)] = 1−36/336
r_s ≈ 0.893 — strong agreement; inspectors are applying closely aligned standards
SkillLondon

SkillLondon · Unit 4002 Engineering Mathematics · Spearman's Rank Correlation · Level 4 HN Engineering Maths