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).
👁️ 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
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 descending9, 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.
👁️ 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
Answerr_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 d1−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
Answerr_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.
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.
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)