Home › Statistics & Probability Calculators › Spearman Rank Correlation Calculator
Spearman Rank Correlation Calculator
Spearman’s rank correlation ρs (rho) measures how well the relationship between two variables can be described by a monotonic function: as one goes up, does the other consistently go up (or down), even if not in a straight line? It works by converting each variable to ranks and then computing Pearson’s r on the ranks, which makes it robust to outliers and suitable for ordinal data such as ratings and placings.
Enter the paired values; the calculator ranks each variable (ties get average ranks), shows the rank differences d and d², computes ρs with the shortcut formula 1 − 6Σd²/[n(n² − 1)] when there are no ties, or the exact Pearson-on-ranks formula when there are, and tests significance with a t statistic on n − 2 degrees of freedom, the same approach SciPy uses.
Use Spearman when a scatter plot shows a curved but consistently rising or falling pattern, when the data are ranks or ordered categories, or when outliers distort Pearson’s r. For a genuinely linear relationship on interval data, Pearson’s r is more powerful.
Separate values with commas, spaces or new lines.
Separate values with commas, spaces or new lines.
Result and step-by-step solution
- Rank x and y separately (ties get average ranks)
x y Rank x Rank y d d² 106 7 7 3 4 16 100 27 4 7 −3 9 86 2 1 1 0 0 101 50 5 10 −5 25 99 28 3 8 −5 25 103 29 6 9 −3 9 97 20 2 6 −4 16 113 12 10 4 6 36 112 6 9 2 7 49 110 17 8 5 3 9 - Sum of squared rank differencesΣd² = 194
- Spearman coefficientρs = 1 − 6Σd² ÷ [n(n² − 1)] = 1 − 6 × 194 ÷ [10 × (10² − 1)] = −0.1758
- Significance testH₀: ρs = 0 H₁: ρs ≠ 0 (two-tailed test)
t = ρs√[(n − 2)/(1 − ρs²)] = −0.505, df = 8; p = 0.6272 - Decisionp = 0.6272 ≥ α = 0.05. critical values ±2.306 (reject when |t| > 2.306).
Frequently asked questions
- When should I use Spearman instead of Pearson?
- For ordinal data, for monotonic but non-linear relationships, or when outliers are present. Pearson measures linear association on interval data.
- Why doesn't the shortcut formula match the result when there are ties?
- The 1 − 6Σd²/[n(n² − 1)] formula assumes all ranks are distinct. With ties the exact value is Pearson’s r applied to the average ranks, which is what the calculator reports.
- How is significance tested for Spearman's rho?
- With t = ρ√[(n − 2)/(1 − ρ²)] on n − 2 degrees of freedom, which is accurate for n of about 10 or more. Exact tables exist for very small n.
- Can Spearman's rho be used with Likert-scale data?
- Yes. Because it uses ranks, it is the usual correlation for ordinal survey responses.
Last reviewed: September 25, 2026. Calculations run in your browser and were validated against SciPy.
