# Spearman Correlation Calculator

> Compute Spearman’s rank correlation ρ from paired data, with average ranks for ties, Σd² and a two- or one-sided p-value from the t approximation.

Category: Statistics & probability · Applies to: Worldwide · Last updated: 2026-10-29
Interactive calculator: https://calculators.geekmidst.com/calculators/spearman-correlation-calculator

Spearman’s ρ is Pearson’s correlation applied to ranks. It measures whether y tends to rise (or fall) as x rises, whether or not the relation is a straight line.

Also called: Spearman’s rho calculator, Rank correlation calculator.

## Inputs
- X values (default 35, 23, 47, 17, 10, 43, 9, 6, 28)
- Y values (same order) (default 30, 33, 45, 23, 8, 49, 12, 4, 31)
- Alternative hypothesis (options: Two-sided: ρ ≠ 0, One-sided: ρ > 0, One-sided: ρ < 0; default two)

## Results
- Spearman’s ρ
- Pairs (n)
- Σd² (squared rank differences)
- t statistic (n − 2 df)
- p-value
- p-value, sidedness and method
- Ties present

## Formula

```
ρ = Pearson r of the ranks (ties get average ranks); without ties ρ = 1 − 6Σd² ÷ (n(n² − 1));  t = ρ·√((n − 2) ÷ (1 − ρ²))
```

Where:
- d: difference between the x-rank and y-rank of a pair
- n: number of pairs

## Worked example
1. Rank each list from smallest to largest; the rank differences squared add to Σd² = 12.
2. ρ = 1 − 6 × 12 ÷ (9 × 80) = 1 − 0.1 = 0.9.
3. t = 0.9 × √(7 ÷ 0.19) = 5.46 with 7 df, two-sided p ≈ 0.0009.

**Result:** 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.

## Related calculators
- [Pearson Correlation Calculator](https://calculators.geekmidst.com/calculators/pearson-correlation-calculator)
- [R-Squared Calculator](https://calculators.geekmidst.com/calculators/regression-r-squared-calculator)
- [Statistics Calculator](https://calculators.geekmidst.com/calculators/statistics-calculator)

Source: GM¹X CalcVerse — https://calculators.geekmidst.com/calculators/spearman-correlation-calculator
