What Spearman's rank correlation measures
Spearman's rank correlation coefficient, written ρ (rho) or rs, measures the strength and direction of a monotonic relationship between two variables: the tendency for one to increase (or decrease) as the other increases. Unlike Pearson's correlation, it does not require the relationship to be a straight line — only that it consistently moves in one direction. It was introduced by the psychologist Charles Spearman in 1904.
The coefficient always falls between −1 and +1. A value of +1 means the two rankings agree perfectly (as X rises, Y always rises); −1 means they are perfectly reversed (as X rises, Y always falls); and 0 means there is no monotonic tendency at all. Because it works on ranks rather than raw values, ρ is robust to outliers and can be used with ordinal data such as ratings, positions, or grades.
The formula
The method is simple: replace each variable's values with their ranks, then compute the ordinary Pearson correlation of those two sets of ranks. When there are no tied values, this is algebraically identical to the well-known shortcut:
ρ = 1 − 6Σd² / n(n² − 1)
Here d is the difference between the two ranks of a pair, Σd² is the sum of those squared differences, and n is the number of paired observations. This calculator computes the Pearson correlation of the ranks directly, which gives the correct answer whether or not ties are present; the Σd² value is reported as well so you can reproduce the shortcut by hand.
When some values are tied, they are assigned the average of the ranks they would otherwise take (e.g. values tied for 3rd and 4th both become 3.5). The plain 6Σd² formula slightly overstates or understates ρ in that case, so the rank-Pearson form used here is the correct general method.
A worked example
Suppose X = (1, 2, 3, 4, 5) and Y = (2, 3, 1, 5, 4). The ranks of X are 1,2,3,4,5 and the ranks of Y are 2,3,1,5,4. The rank differences d are −1, −1, 2, −1, 1, so d² = 1, 1, 4, 1, 1 and Σd² = 8. With n = 5: ρ = 1 − (6×8) / (5×24) = 1 − 48/120 = 1 − 0.4 = 0.6. That is a moderate positive association.
Interpreting the strength of ρ
- 0.00 – 0.10 — negligible association.
- 0.10 – 0.39 — weak.
- 0.40 – 0.69 — moderate.
- 0.70 – 0.89 — strong.
- 0.90 – 1.00 — very strong. The sign (+ or −) tells you the direction.
These bands are common rules of thumb, not hard cut-offs. Whether a given ρ is meaningful also depends on sample size and context — with only a handful of pairs, even a large ρ can arise by chance.