Skip to content

Spearman Rank Correlation

Regression & Correlation

Measures 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

InputTypeNotes
Variable 1Numeric / OrdinalFirst variable
Variable 2Numeric / OrdinalSecond variable

Output Metrics

MetricWhat it means
Spearman rhoRank correlation coefficient. Ranges from -1 to +1. Equivalent to Pearson r computed on the ranks.
S-statisticSum of squared differences of ranks, used internally for computing rho.
p-valueP-value for the test of rho = 0.
95% CI LowerLower bound of the 95% confidence interval for rho.
95% CI UpperUpper 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

  1. Rank each variable separately from smallest to largest.
  2. Compute the Pearson correlation coefficient on the ranked values.
  3. 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.