Spearman Rank Correlation
Regression & CorrelationMeasures the strength and direction of the monotonic relationship between two variables using ranked data, without assuming a linear relationship or normal distribution.
When to Use
Use this test when the relationship between variables is monotonic but not necessarily linear, when data are ordinal, or when normality cannot be assumed. For example, correlating disease severity rankings with treatment dose, or measuring the association between two Likert-scale ratings.
Assumptions
- Both variables are at least ordinal.
- The relationship is monotonic (consistently increasing or decreasing, though not necessarily at a constant rate).
- Observations are independent.
Required Inputs
| Input | Type | Notes |
|---|---|---|
| Variable 1 | Numeric / Ordinal | First variable |
| Variable 2 | Numeric / Ordinal | Second variable |
Output Metrics
| Metric | What it means |
|---|---|
| Spearman rho | Rank correlation coefficient. Ranges from -1 to +1. Equivalent to Pearson r computed on the ranks. |
| S-statistic | Sum of squared differences of ranks, used internally for computing rho. |
| p-value | P-value for the test of rho = 0. |
| 95% CI Lower | Lower bound of the 95% confidence interval for rho. |
| 95% CI Upper | Upper bound of the 95% confidence interval for rho. |
Interpretation
- Spearman rho = +1 means a perfect monotonically increasing relationship; -1 means perfect monotonically decreasing.
- The same effect size thresholds used for Pearson r apply: weak (0.1-0.3), moderate (0.3-0.5), strong (> 0.5).
- Spearman is more robust to outliers than Pearson because it operates on ranks rather than raw values.
- If Spearman rho is similar to Pearson r, the relationship is approximately linear. A large discrepancy suggests a non-linear but monotonic relationship.
Common Pitfalls
- Spearman detects monotonic relationships but not non-monotonic ones (e.g., U-shaped or inverted-U relationships will give rho near zero).
- Many tied values reduce the effective variability of ranks and can attenuate the correlation.
- Spearman correlation does not distinguish between different types of monotonic relationships. A logarithmic and an exponential relationship might give the same rho.
How It Works
- Rank each variable separately from smallest to largest.
- Compute the Pearson correlation coefficient on the ranked values.
- Test significance using a t-distribution or exact permutation test.
Citations
References
- Spearman, C. (1904). The proof and measurement of association between two things. American Journal of Psychology, 15(1), 72-101.