Spearman correlation: rank association
Spearman’s correlation describes whether higher values of one variable tend to accompany higher or lower values of another.
Fit
When to use it, and when not to
Use it when
- Each independent person has two ordered measurements.
- The relationship is monotonic: it tends to move in one direction, even when it curves.
Not when
- You want specifically a straight-line association in continuous values. Consider Pearson correlation, covered in the correlation overview. Read: Choosing a correlation coefficient
- You want agreement between two measurement methods. Use agreement analysis. Read: Bland-Altman method comparison
- You need effects adjusted for other factors. Use an appropriate regression model. Read: Linear regression
Before you start
What you need
- Paired x and y observationsKeep lists equally long and in the same person order.
- The number and pattern of tied valuesAverage tied ranks. Many ties reduce how finely the data distinguish order.
- The inferential method and alternative hypothesisDecide whether a large-sample approximation or a justified permutation procedure fits the data.
- Pairs from different people are independent.How to check: Do not treat repeated visits as separate independent people.
- The two measurements have a meaningful order and both vary.How to check: Check category coding and ensure neither variable is constant.
- A single-direction relationship is the target.How to check: Plot the data. A U-shaped relationship can have a near-zero Spearman coefficient.
Plain language
How it works
Replace each variable’s values by their ranks, assigning an average rank to ties. Spearman’s rho is Pearson correlation of those ranks. Moving an extreme value farther out changes nothing if its rank stays the same.
Bishara and Hittner’s simulations compare correlation estimators and tests under nonnormality. Rank methods can help, but do not make inference assumption-free. A monotonic association means a trend in one direction; a curve that reverses direction is a different target.
Worked example
A worked example
- Setting
- 8 independent people each supply two ordered measurements.
- Question
- Do their ranks tend to increase together?
- Approach
- x values: 1, 2, 3, 4, 5, 6, 7, 8. y values: 2, 1, 4, 3, 6, 5, 8, 9.
- Result
- Spearman rho = 0.929. The calculator’s approximate two-sided p < 0.001, using 8 pairs and 6 degrees of freedom.
- What it means
- This is a strong positive rank association in the sample. With so few pairs, use a justified exact or permutation method for final inference.
In practice
Recent studies PubMed search · not vetted
Watch out
Common mistakes
The one to remember
Spearman correlation describes a monotonic relationship, not every curved pattern. Ties and small samples affect inference; Mallard’s p-value is a t approximation.
- Applying the no-ties shortcut despite tied values.Instead: Use average ranks and correlate them. The shortcut assumes no ties.
- Assuming a rank method needs no assumptions.Instead: Independence still matters. Approximate p-values can be unreliable with few pairs or many ties.
Inside Mallard
How Mallard uses this
Mallard links this article to its Spearman calculator. The tool averages tied ranks and uses an approximate t-based p-value. Plans do not link directly to this article yet.
analysis.spearman_correlation, the id a plan cue records.Work it out
Related Learn pages
Related designs and methods
Evidence
Sources & further reading
- Testing the significance of a correlation with nonnormal data: comparison of Pearson, Spearman, transformation, and resampling approaches (opens in a new tab) · Psychol Methods · doi 10.1037/a0028087
- Reducing Bias and Error in the Correlation Coefficient Due to Nonnormality (opens in a new tab) · Educ Psychol Meas · doi 10.1177/0013164414557639