Spearman Rank Correlation Calculator

This Spearman rank correlation calculator takes two paired lists of equal length. Example: IQ and weekly TV hours of 10 people give Σd² = 194 and ρ = −0.175758.

Source: Wikipedia – Spearman’s rank correlation coefficient. Updated: .

Separate with spaces or semicolons; commas also separate values, so use a decimal point (2.5), not a comma.
Separate with spaces or semicolons; commas also separate values, so use a decimal point (2.5), not a comma.
My ToolboxYour inputs are saved in this browser only.

Result

Result
Spearman rank correlation ρ = -0.175758 (n = 10, no ties)
All values
QuantityValue
Number of pairs n10
Sum of squared rank differences Σd²194
Rank correlation ρ-0.175758
Ranks and differences
xyRank xRank yd²
862110
97202616
99283825
10027479
1015051025
10329699
10677316
11017859
11269249
1131210436
Calculation steps
  • Ranks of x: 1; 2; 3; 4; 5; 6; 7; 8; 9; 10.
  • Ranks of y: 1; 6; 8; 7; 10; 9; 3; 5; 2; 4.
  • Without ties: ρ = 1 − 6 · 194 / (10 · (10² − 1)) = -0.175758.
Weak relationship (|ρ| below 0.3). Negative sign: larger x ranks tend to come with smaller y ranks. ρ says nothing about cause and effect.

How it is calculated

Spearman’s correlation measures how well a steadily rising or falling curve, not just a straight line, describes the link between two variables.

How it is calculated

Each list is sorted on its own and given ranks 1 to n. Tied values receive the average of the ranks they would occupy. Without ties, ρ = 1 − 6 · Σd² / (n · (n² − 1)), where d is the difference between the two ranks of a pair. With ties you take the Pearson correlation of the ranks; that is what the calculator does in both cases.

Two worked examples

For x = 86, 97, 99, 100, 101, 103, 106, 110, 112, 113 and y = 2, 20, 28, 27, 50, 29, 7, 17, 6, 12, the x ranks are 1 to 10 and the y ranks are 1, 6, 8, 7, 10, 9, 3, 5, 2, 4. The squared differences add up to 194, so ρ = 1 − 6 · 194 / (10 · 99) = −0.175758. With ties, for example x = 1, 2, 2, 4, 5 and y = 3, 1, 4, 5, 5, the ranks are 1; 2.5; 2.5; 4; 5 and 2; 1; 3; 4.5; 4.5, and ρ = 0.789474.

Frequently asked questions

How do you calculate Spearman’s rank correlation?

Turn both lists into ranks, then take the Pearson correlation of the ranks. Without ties, ρ = 1 − 6Σd² / (n(n² − 1)) is enough.

What happens with tied values?

Tied values get the average rank: two values in places 2 and 3 both receive 2.5. The simple Σd² formula is then only approximate, so the calculator works on the ranks directly.

When should I use Spearman instead of Pearson?

For ranked data, with outliers, or when the relationship is monotonic rather than linear. For a linear link in normally distributed data, Pearson is more informative.

Sources and legal basis

As of: · Editorial policy

Related tools