How it’s calculated
Spearman’s rank correlation measures how well the relationship between two variables can be described by a monotonic function: as x goes up, does y tend to go up (positive) or down (negative), whether or not the trend is a straight line? It replaces each value by its rank (1 for the smallest) and then takes the ordinary Pearson correlation of the ranks. Tied values get the average of the ranks they would have shared.
The p-value tests the null hypothesis that ρ = 0 and is an approximation; with 10 or fewer pairs an exact table is preferred. When ρ = ±1 the t formula breaks down; with no ties a perfect ranking is one of n! equally likely orders, so the exact two-sided p-value 2 ÷ n! is shown instead. A significant ρ shows an association, not that one variable causes the other.
Example (from the Handbook of Biological Statistics, LibreTexts): the pouch volume and drumming frequency of 18 male magnificent frigatebirds give ρ ≈ −0.76 with 16 degrees of freedom and P ≈ 0.0002. The default values are that data set (the two values of 5090 share rank 12.5).
Frequently asked questions
When should I use Spearman instead of Pearson?
Use Spearman when the relationship is monotonic but not necessarily straight, when there are outliers, or when the data are ranks rather than measurements. For roughly linear data with no gross outliers, Pearson’s r is usually preferred.
How are ties handled?
Tied values are given the average of the ranks they span, and ρ is the Pearson correlation of those ranks. This is the standard approach and it is why the shortcut formula with Σd² is not used when there are ties.
What does ρ near 0 mean?
There is little monotonic trend. A strong curved relationship that rises and then falls can still give ρ near 0.
Is the p-value exact?
No. It uses the t distribution approximation described by the Handbook of Biological Statistics, which works well from about 11 pairs. For smaller samples, check an exact critical-value table.
Embed this calculator
Add this free calculator to your own website. Copy the code below into your page’s HTML:
Need this calculator branded, changed or built around your own prices?See custom business solutions →
Sources
- Handbook of Biological Statistics (McDonald), 5.2 Spearman Rank Correlation — LibreTexts
- Introductory Statistics 2e, §12.4 Testing the Significance of the Correlation Coefficient — OpenStax
Formulas are taken from the free public references above. Results are provided “as is” for informational and educational purposes only. See our disclaimer.
Added · Last updated · How we check our calculators
Spotted a mistake or missing option? Report a problem· Suggest a calculator