Pearson's correlation coefficient measures how closely two variables follow a straight-line relationship — but plenty of genuine, strong relationships aren't straight lines at all. Spearman's rank correlation (denoted rₛ, or the Greek ρ, "rho") measures something more general: whether two variables consistently move in the same direction, whatever shape that relationship actually takes — a monotonic relationship rather than specifically a linear one. A relationship is monotonic if it never reverses direction — always rising, or always falling, even if the rate of rise or fall changes along the way.
- The formula, and why it's built entirely on ranks rather than raw values
- A worked example showing Spearman's rho reach a perfect 1.0 while Pearson's r doesn't
- A second example with genuine disagreement between rankings
- When Spearman's is the more appropriate choice than Pearson's
The Formula
Spearman's rho is calculated by first converting both variables to ranks, then applying a formula built on the differences between those ranks:
Here d is the difference between each pair's ranks (rank of x minus rank of y for that observation), and n is the number of paired observations. When every pair's ranks match exactly (d=0 for every pair), the numerator vanishes entirely and ρ = 1 — a perfect positive monotonic relationship. The more the rankings disagree, the larger Σd² grows, and the further ρ drops below 1.
Worked Example: A Perfect Monotonic (But Not Linear) Relationship
Problem: A researcher records years of experience and hourly pay rate for 6 employees: (1, $20), (2, $28), (4, $35), (7, $40), (11, $43), (16, $45). Pay clearly rises with experience, but with visibly diminishing returns — each additional year adds less to pay than the year before. Calculate both Spearman's rho and Pearson's r.
Ranking experience (x) from lowest to highest gives ranks 1 through 6, in the same order the data is already listed. Ranking pay (y) gives exactly the same order — every employee with more experience also has strictly higher pay, so the rank order matches perfectly, pair for pair. Every d = 0, so Σd² = 0:
ρ = 1 − [6(0) / 6(35)] = 1 − 0 = 1.0
Spearman's rho reports a perfect 1.0 — a completely consistent, monotonically increasing relationship. Pearson's r, calculated on the same raw data, comes out to approximately 0.889 — strong, but noticeably less than perfect, because Pearson's r specifically measures how well a straight line fits, and this data's true relationship visibly curves (steep gains early, flattening out later). This contrast is the clearest possible illustration of what each coefficient actually measures: Spearman's rho confirms the relationship is perfectly consistent in direction; Pearson's r reports that a straight line is a good, but imperfect, description of that same relationship's specific shape.
Worked Example: Two Judges Ranking Contestants
Problem: Two judges rank 5 contestants in a competition. Judge A's ranking: 1, 2, 3, 4, 5. Judge B's ranking of the same 5 contestants, in Judge A's order: 2, 1, 4, 3, 5. How much do the judges agree?
Differences (A's rank − B's rank) for each contestant: −1, 1, −1, 1, 0. Squaring each: 1, 1, 1, 1, 0. Σd² = 4.
ρ = 1 − [6(4) / 5(24)] = 1 − [24/120] = 1 − 0.2 = 0.8
A rho of 0.8 indicates strong, though not perfect, agreement between the two judges — they agree on the overall ranking closely, with just two pairs of adjacent contestants swapped relative to each other, consistent with the small, evenly distributed disagreement visible in the raw rankings.
Is that agreement statistically significant? With only 5 contestants, not quite. Of the 120 possible ways Judge B could have ordered the contestants, 8 give a rho of 0.8 or higher, so the exact one-tailed p-value is 8/120 ≈ 0.067 and the two-tailed p-value is about 0.133. The exact critical value for n = 5 at α = 0.10 (two-tailed) is 0.900, which is why small samples need very high rank correlations to reach significance — see the Spearman critical values table for other sample sizes.
When Spearman's Is the Better Choice
Data is already ordinal. Rankings, ratings, or any scale where order is meaningful but the numeric gaps between categories aren't necessarily equal (like a 1-5 satisfaction scale) are a natural fit — ranks are exactly the right level of information such data actually carries.
The relationship is monotonic but visibly curved. As the experience-and-pay example shows, Spearman's rho captures a consistent directional relationship even when a straight line would systematically misrepresent that relationship's actual shape.
Outliers are a concern. Because Spearman's rho works on ranks rather than raw values, a single extreme outlier can shift its rank by at most one position — a far smaller effect than the same outlier could have on Pearson's r, which is sensitive to the outlier's actual numeric distance from the rest of the data.
Real-World Uses
Judging and rating agreement: as the contestant-ranking example shows, Spearman's rho is a standard way to quantify how closely two judges, reviewers, or raters agree — used across competition scoring, peer review consistency checks, and inter-rater reliability studies.
Economics and social science indices: many widely used indices (quality-of-life rankings, competitiveness indices, survey-based composite scores) are themselves ordinal or built from ranked components, making Spearman's rho a more natural fit than Pearson's r for comparing how closely two such indices track each other.
Non-linear but consistent biological and physical relationships: dose-response relationships in pharmacology, for example, often show a consistent directional effect (more of a substance produces more of a response) without following a straight line at every dose level — exactly the kind of monotonic-but-curved relationship Spearman's rho is built to capture cleanly.
Common Mistakes
Assuming Spearman's rho and Pearson's r should always be nearly equal. They frequently are similar for data that's already close to linear, but as the worked example above shows, they can diverge meaningfully whenever a relationship is monotonic without being especially close to a straight line.
Interpreting Spearman's rho as measuring the same "strength of linear relationship" that Pearson's r does. A rho of 1.0 means perfectly consistent direction of movement — it says nothing about whether that movement follows a straight line, a curve, or any other specific shape.
Forgetting to handle tied ranks correctly. When two or more observations share the same value, they're typically assigned the average of the ranks they would have occupied (for example, two tied-for-3rd values both get rank 3.5) — using the plain formula above without this adjustment introduces a small error whenever ties are present.
Reading a moderate rho as evidence of no relationship at all. A rho of, say, 0.4 indicates a real but imperfect monotonic tendency, not the complete absence of one — treating anything short of a very high rho as "no relationship" throws away genuine, if partial, information the coefficient is reporting.
Can Spearman's rho be negative?
Is Spearman's correlation the same test as the Mann-Whitney U test?
Does Spearman's rho require the same sample size as Pearson's r for a valid significance test?
Why does the vertex of a curved relationship not affect Spearman's rho, but does affect Pearson's r?
Share this article
Written by
Statistics Fundamentals Editorial Team
Written and reviewed by our team of statistics educators. Content is aligned with GCSE, A-Level, AP Statistics, and undergraduate curricula.
About Statistics Fundamentals →