How to use this calculator
- Enter or choose x values.
- Enter or choose y values (same order).
- Enter or choose alternative hypothesis.
- The spearman’s ρ updates as you type. Use Copy result or Share to keep it.
Method
ρ = Pearson r of the ranks (ties get average ranks); without ties ρ = 1 − 6Σd² ÷ (n(n² − 1)); t = ρ·√((n − 2) ÷ (1 − ρ²))
- d
- difference between the x-rank and y-rank of a pair
- n
- number of pairs
Worked example
- Rank each list from smallest to largest; the rank differences squared add to Σd² = 12.
- ρ = 1 − 6 × 12 ÷ (9 × 80) = 1 − 0.1 = 0.9.
- t = 0.9 × √(7 ÷ 0.19) = 5.46 with 7 df, two-sided p ≈ 0.0009.
The nine pairs have a very strong monotonic association, ρ = 0.90, significant at the 1% level.
What the result means
ρ near ±1 means the order of y closely follows the order of x. Spearman is robust to outliers and works for ordinal data such as ratings or rankings, at the cost of ignoring how far apart the values are.
Assumptions and limits
- Pairs are independent and at least ordinal.
- The p-value uses the t approximation with n − 2 degrees of freedom, against the null hypothesis ρ = 0.
- For fewer than about 10 pairs, exact permutation tables give a more accurate p-value.
- The short formula with Σd² is only exact without ties; this calculator always uses Pearson on ranks.
Questions
When should I use Spearman instead of Pearson?
When the relation is monotonic but curved, when there are outliers, or when the data are ranks or ordinal scores.
How are ties ranked?
Tied values share the average of the ranks they occupy. Two values tied for 2nd and 3rd both get 2.5.