Instant PDF download, name-and-email checkout. Complete Book Bundle: every Economics, Statistics, Mathematics, Econometrics and Research Methods book
Statistics

Spearman’s Rank Correlation: Formula, Ties and a Worked Hypothesis Test

Spearman's rank correlation coefficient explained: ranking, the 6Σd² formula, tied ranks, critical values and a worked hypothesis test, with practice questions.

In 30 seconds
  • Spearman’s rank correlation \(r_s\) measures how well two variables move together in a monotonic way (always up, or always down), using ranks instead of raw values.
  • Formula without ties: \(r_s = 1 – \dfrac{6\sum d^2}{n(n^2 – 1)}\), where \(d\) is the difference in ranks.
  • Use it for ordinal data, skewed data, outliers, or curved but one-directional relationships.
  • Test significance by comparing \(r_s\) with a critical value for your sample size.
  • Below: a full worked example, how to handle ties, and exam questions with answers.

The problem: Pearson’s r doesn’t always fit

Pearson’s correlation coefficient assumes a straight-line relationship between two numerical variables, and it is pulled around by outliers. But a lot of real data is not like that. Judges rank contestants. Survey answers run from “strongly disagree” to “strongly agree”. Income is heavily skewed. Sometimes the relationship is clearly one-directional but curved. In all these cases you want Spearman’s rank correlation coefficient, named after the psychologist Charles Spearman, who introduced it in 1904[1]. It appears in Cambridge 9709 Statistics, IB Mathematics, A-level Geography and Biology fieldwork, and many dissertations.

Key ideas

Key termSpearman’s rank correlation coefficient \(r_s\): Pearson’s correlation calculated on the ranks of the data. It ranges from −1 (perfect negative monotonic relationship) to +1 (perfect positive monotonic relationship). Monotonic: as one variable increases, the other always increases (or always decreases), though not necessarily at a constant rate.

When there are no tied ranks, Pearson’s formula on the ranks simplifies to

\[ r_s = 1 – \frac{6\sum d^2}{n(n^2 – 1)} \]

where \(d\) is the difference between each pair of ranks and \(n\) is the number of pairs.

Statistics Made Simple textbook coverStatistics Made Simple covers Pearson, Spearman and regression with worked examples, tables and exam tips.Get the textbook · $15

Worked example

Worked example

Eight students recorded how many hours they revised and their exam mark (%). Is there a significant positive association at the 5% level?
Hours: 12, 5, 8, 15, 3, 10, 7, 14
Marks: 72, 60, 70, 85, 55, 64, 58, 80

Step 1Rank each variable separately, smallest = 1.
Hours ranks: 6, 2, 4, 8, 1, 5, 3, 7
Marks ranks: 6, 3, 5, 8, 1, 4, 2, 7
Step 2Differences \(d\): 0, −1, −1, 0, 0, 1, 1, 0. Squares: 0, 1, 1, 0, 0, 1, 1, 0, so \(\sum d^2 = 4\).
Step 3\(r_s = 1 – \dfrac{6 \times 4}{8(64 – 1)} = 1 – \dfrac{24}{504} = 0.952\).
Step 4Hypotheses: \(H_0: \rho_s = 0\) (no association); \(H_1: \rho_s > 0\) (positive association). One-tailed test.
Step 5Critical value for \(n = 8\), 5% one-tailed: 0.643. Since \(0.952 > 0.643\), reject \(H_0\).

Conclusion: there is strong evidence of a positive association between revision hours and exam marks among these students. Correlation is not causation, though: students who revise more may also attend more lessons.

n5% one-tailed5% two-tailed
60.8290.886
80.6430.738
100.5640.648
120.5030.587

These are standard critical values for Spearman’s coefficient[2]. Your exam board’s formula book has the full table; use it, because published tables differ slightly in rounding.

Statistics Practice Questions coverPractise ranking, correlation and hypothesis tests with 1,569 questions, all fully worked.Get 1,569 questions · $9

What to do with tied ranks

If two values are equal, give each the average of the ranks they would have taken. Two values tying for 3rd and 4th place both get 3.5; three values tying for 5th, 6th and 7th all get 6. Strictly, the \(6\sum d^2\) shortcut is then only approximate, and the exact method is to calculate Pearson’s r on the ranks. With a few ties the difference is tiny, and most exam questions accept the shortcut. Software always uses the exact method.

Spearman vs Pearson

Pearson’s rSpearman’s \(r_s\)
MeasuresLinear relationshipMonotonic relationship
DataNumerical, roughly normalOrdinal or numerical
OutliersVery sensitiveResistant
Curved but risingUnderstates the linkCan still give +1
Common mistakeRanking both variables together, or ranking one from largest and the other from smallest. Rank each variable separately, in the same direction (smallest = 1 for both), or the sign of \(r_s\) flips.
Exam tipAlways state hypotheses in terms of the population, compare with the correct critical value (one-tailed or two-tailed), and finish with a sentence in context. Examiners withhold the final mark for “reject \(H_0\)” with no interpretation.

Free help or the books

For Pearson’s r, see how to calculate the correlation coefficient by hand; for choosing between tests, our which statistical test should I use flowchart. The Statistics Made Simple textbook works through correlation, regression and every hypothesis test by hand, with critical value tables built in.

Statistics Made Simple bundle coverTextbook plus 1,569 worked questions: both Statistics Made Simple books for $19.Both books · $19Complete Book Bundle coverEvery Made Simple book (economics, statistics, mathematics, econometrics and research methods): the Complete Book Bundle for $59 (was $132).Complete Book Bundle · $59

Practice questions

EasyQ1. Five wines are ranked by two judges. Judge A: 1, 2, 3, 4, 5. Judge B: 2, 1, 4, 3, 5. Calculate \(r_s\). Show worked answer
\(d\): −1, 1, −1, 1, 0, so \(\sum d^2 = 4\).
\(r_s = 1 – \dfrac{6 \times 4}{5 \times 24} = 1 – 0.2 = 0.8\).
EasyQ2. Give the ranks for the data 7, 9, 9, 12, 15. Show worked answer
7 → 1; the two 9s share ranks 2 and 3, so each gets 2.5; 12 → 4; 15 → 5.
MediumQ3. For 10 pairs, \(\sum d^2 = 24\). Calculate \(r_s\) and test for association (two-tailed) at the 5% level. Show worked answer
\(r_s = 1 – \dfrac{6 \times 24}{10 \times 99} = 1 – 0.1455 = 0.855\).
Critical value (n = 10, two-tailed 5%) = 0.648. \(0.855 > 0.648\), so reject \(H_0\): there is evidence of association.
MediumQ4. Explain why Spearman’s coefficient might be preferred to Pearson’s for data on country GDP per capita and life expectancy. Show worked answer
GDP per capita is heavily skewed with extreme values, and the relationship with life expectancy is curved (rising quickly then levelling off). Spearman uses ranks, so it is resistant to outliers and captures any monotonic relationship.
ExamQ5. A geography student measures distance from the city centre (km) and house price for 8 properties and finds \(r_s = -0.71\). (a) State suitable hypotheses for a test of negative association. (b) Carry out the test at 5%. (c) Comment on whether the result proves distance causes lower prices. [6 marks] Show worked answer
(a) \(H_0: \rho_s = 0\); \(H_1: \rho_s < 0\). [1]
(b) One-tailed 5% critical value for n = 8 is 0.643 (−0.643). [1] \(-0.71 < -0.643\), so reject \(H_0\). [1] There is evidence that prices tend to fall with distance from the centre. [1]
(c) No: correlation does not prove causation; house size, age or local schools may differ with distance, and the sample of 8 is small. [2]

Frequently asked questions

Can Spearman’s rank be used for small samples?

Yes, it is designed for them. Very small samples (under about 5) have little power, though, so even strong relationships may not be significant.

What does rs = 1 mean?

The ranks match exactly: the variables have a perfect increasing monotonic relationship. It does not require a straight line.

Do I need normal data?

No. That is one of the main reasons to use Spearman instead of Pearson.

References

  1. Spearman, C. (1904) ‘The proof and measurement of association between two things’, American Journal of Psychology, 15(1), pp. 72–101. https://doi.org/10.2307/1412159
  2. Zar, J. H. (1972) ‘Significance testing of the Spearman rank correlation coefficient’, Journal of the American Statistical Association, 67(339), pp. 578–580. https://doi.org/10.1080/01621459.1972.10481251
  3. Field, A. (2024) Discovering Statistics Using IBM SPSS Statistics. 6th edn. London: SAGE.
Statistics Made Simple Complete Bundle cover showing both the textbook and practice book
This topic has a full chapter in Statistics Made Simple, with 1,569 worked practice questions in the bundle.Statistics Made Simple Complete Bundle — Textbook + 1,569 Practice Questions
Get it for $19
E

The EconTutorials team writes clear, exam-focused lessons in economics and statistics for A-Level, IB, AP and university students, with more than 13 years of classroom teaching behind every guide and book in the Made Simple series.