Introduction
Clinical researchers frequently want to know whether two measurements are associated. For example, a study might examine whether a biomarker concentration is related to disease severity, whether two laboratory measurements move together, or whether a patient-reported outcome is associated with a clinical measure.
A correlation coefficient provides a numerical summary of the direction and strength of association between two variables.
Two of the most commonly used correlation coefficients are the Pearson correlation coefficient and the Spearman rank correlation coefficient.
What Is a Correlation Coefficient?
A correlation coefficient is usually denoted by \(r\) for Pearson correlation and \(\rho_s\) for Spearman correlation.
Both coefficients range from \(-1\) to \(+1\).
| Correlation | Interpretation |
|---|---|
| \(r\approx+1\) | Very strong positive association |
| \(r\approx0\) | Little or no association of the type being measured |
| \(r\approx-1\) | Very strong negative association |
A positive correlation means that larger values of one variable tend to be associated with larger values of the other. A negative correlation means that larger values of one variable tend to be associated with smaller values of the other.
Pearson Correlation
The Pearson product-moment correlation coefficient measures the strength and direction of a linear relationship between two quantitative variables.
For observations \(x_i\) and \(y_i\), the Pearson correlation is:
The numerator measures the degree to which the two variables vary together, while the denominator standardizes that quantity so that the result lies between \(-1\) and \(+1\).
What Does Pearson Correlation Detect?
Pearson correlation is especially appropriate when the relationship between the variables can reasonably be represented by a straight line.
For example, suppose systolic blood pressure increases approximately linearly as a continuous biomarker concentration increases. Pearson correlation can summarize the strength of that linear pattern.
Spearman Rank Correlation
Spearman correlation is based on the ranks of the observations rather than their original numerical values.
Each variable is converted to ranks, and Pearson correlation is then applied to those ranks.
When there are no tied ranks, an equivalent formula is:
where \(d_i\) is the difference between the rank of \(X_i\) and the rank of \(Y_i\).
Linear vs. Monotonic Relationships
The most important conceptual distinction between Pearson and Spearman correlation is the distinction between linear and monotonic relationships.
Linear Relationship
A linear relationship can be represented approximately as:
If \(X\) increases by a given amount, the expected change in \(Y\) is approximately proportional across the range of \(X\).
Monotonic Relationship
A monotonic relationship moves consistently in one direction.
For a positive monotonic relationship, larger values of \(X\) tend to correspond to larger values of \(Y\), although the rate of increase does not have to be constant.
For example:
is nonlinear but monotonic for positive \(X\).
Spearman correlation can capture this relationship effectively because the ordering of observations remains consistent even though the numerical distance between observations changes.
Visualizing Pearson Correlation
A scatterplot is one of the most useful tools for understanding what a correlation coefficient is actually measuring.
For a roughly linear pattern, Pearson correlation provides a natural summary of the relationship.
Comparing Pearson and Spearman
| Feature | Pearson | Spearman |
|---|---|---|
| Based on | Original numerical values | Ranks |
| Primary relationship | Linear | Monotonic |
| Direction | Positive or negative | Positive or negative |
| Range | \(-1\) to \(+1\) | \(-1\) to \(+1\) |
| Sensitivity to outliers | Generally high | Generally lower |
| Requires normality? | No for descriptive calculation; distributional assumptions matter for some inferential procedures | No normality assumption for the rank calculation |
| Useful for ordinal data | Generally not preferred | Yes |
| Handles nonlinear monotonic relationships | May underestimate association | Yes |
When Should You Use Pearson?
Pearson correlation is usually appropriate when:
- Both variables are quantitative.
- The primary relationship of interest is linear.
- A scatterplot shows an approximately linear pattern.
- There are no extreme influential outliers that dominate the result.
- The numerical distances between observations are meaningful.
For example, Pearson correlation may be appropriate for studying the relationship between two continuous laboratory measurements when the scatterplot shows an approximately linear relationship.
When Should You Use Spearman?
Spearman correlation is often preferable when:
- The variables are ordinal or naturally rank-ordered.
- The relationship is monotonic but clearly nonlinear.
- The data contain substantial skewness.
- Outliers make a value-based correlation unstable.
- The scientific question concerns ordering rather than exact numerical differences.
For example, disease severity may be measured using an ordinal clinical grade. A Spearman correlation can be appropriate when comparing that ordered severity measure with a continuous biomarker.
A Small Worked Example
Consider six patients with a biomarker measurement \(X\) and a clinical severity score \(Y\).
| Patient | Biomarker \(X\) | Severity \(Y\) |
|---|---|---|
| 1 | 10 | 2 |
| 2 | 15 | 3 |
| 3 | 20 | 4 |
| 4 | 25 | 5 |
| 5 | 30 | 5 |
| 6 | 40 | 7 |
The relationship is strongly positive: patients with higher biomarker values generally have higher severity scores.
Pearson correlation evaluates how closely the numerical observations follow a straight-line pattern.
Spearman correlation evaluates how closely their rankings agree.
Because the severity variable contains a tied value of 5, the Spearman calculation should use appropriate tied-rank handling rather than blindly applying the simplified no-ties formula.
How Spearman Handles Ranks
Suppose the original observations are:
Their ranks are:
If a second variable has observations:
its ranks are also:
Therefore:
The variables have a perfect positive monotonic relationship.
Importantly, Spearman does not require the numerical spacing between \(Y\) values to be proportional to the spacing between \(X\) values. It only requires the ordering to be perfectly aligned in this example.
What Happens With a Nonlinear Relationship?
Consider a relationship in which \(Y\) rises rapidly at first and then levels off:
This relationship is nonlinear but monotonic.
Pearson correlation may be substantially less than 1 because the observations do not lie along a straight line.
Spearman correlation can remain very high because the ordering of \(Y\) follows the ordering of \(X\).
Outliers and Correlation
Pearson correlation is sensitive to extreme observations because it uses the actual numerical deviations from the means.
An observation that is far from the center of the data can have substantial influence on the numerator and denominator of the Pearson formula.
Spearman correlation is generally less sensitive because it replaces the original values with ranks.
| Situation | Potential effect |
|---|---|
| Extreme value follows the overall pattern | May strengthen Pearson correlation |
| Extreme value deviates from the pattern | May substantially weaken or reverse Pearson correlation |
| Extreme value receives an extreme rank | Spearman may be less affected than Pearson |
Correlation Does Not Imply Causation
Suppose two clinical variables have:
This indicates a strong positive linear association, but it does not establish that changing one variable will cause the other to change.
Several explanations are possible:
- One variable may causally influence the other.
- The second variable may influence the first.
- A third variable may influence both.
- The association may arise from selection or measurement processes.
- The association may be coincidental.
This distinction is particularly important in observational clinical research.
Pearson and Spearman Hypothesis Tests
Correlation analyses can also be accompanied by hypothesis tests.
For Pearson correlation, a common null hypothesis is:
against an alternative such as:
For Pearson correlation under the usual assumptions, the test statistic can be expressed as:
with \(n-2\) degrees of freedom.
For Spearman correlation, inference is based on the rank correlation and its sampling distribution or an appropriate large-sample approximation. Exact or permutation-based procedures can also be useful, particularly with small samples.
Confidence Intervals
A correlation estimate should ideally be accompanied by a confidence interval.
For Pearson correlation, the Fisher \(z\)-transformation is commonly used to construct confidence intervals.
The transformed value is approximately normally distributed under suitable conditions, with standard error:
A confidence interval can then be constructed on the \(z\) scale and transformed back to the correlation scale.
For Spearman correlation, confidence intervals can be obtained using large-sample methods, bootstrap methods, or other appropriate procedures.
Pearson vs. Spearman: A Decision Framework
When Pearson and Spearman Give Similar Results
If the relationship is approximately linear, there are no influential outliers, and the ordering of the observations closely follows their numerical values, Pearson and Spearman correlations will often be similar.
| Data pattern | Typical result |
|---|---|
| Strong linear relationship with few outliers | Pearson and Spearman often similar |
| Monotonic but curved relationship | Spearman may exceed Pearson |
| Strong influence from outliers | Pearson may differ substantially from Spearman |
| Ordinal measurements | Spearman generally more natural |
| No meaningful monotonic relationship | Both may be near zero |
When Pearson and Spearman Can Disagree
A large difference between the two coefficients can itself be informative.
Suppose:
but:
One possible explanation is that the relationship is strongly monotonic but not linear.
Another possibility is that a small number of extreme observations are strongly affecting the Pearson calculation.
R Implementation
In R, Pearson correlation can be calculated using cor():
cor(x, y, method = "pearson")
Spearman correlation is obtained with:
cor(x, y, method = "spearman")
For example:
biomarker <- c(10, 15, 20, 25, 30, 40) severity <- c(2, 3, 4, 5, 5, 7) cor(biomarker, severity, method = "pearson") cor(biomarker, severity, method = "spearman")
The cor.test() function can be used when inferential
results are needed:
cor.test(biomarker, severity, method = "pearson") cor.test(biomarker, severity, method = "spearman")
SAS Implementation
In SAS, Pearson and Spearman correlations can be obtained with PROC CORR.
proc corr data=clinical pearson spearman;
var biomarker severity;
run;
To request only the Pearson correlation:
proc corr data=clinical pearson;
var biomarker severity;
run;
To request Spearman correlation:
proc corr data=clinical spearman;
var biomarker severity;
run;
SAS will provide the estimated correlations along with inferential statistics and sample-size information.
Clinical Research Example: Biomarker Validation
Suppose investigators are evaluating whether a new continuous biomarker is associated with a validated disease-severity score.
The severity score is ordinal, ranging from mild to severe, and the relationship with the biomarker appears consistently increasing but not necessarily linear.
A reasonable primary association measure may therefore be Spearman correlation.
The analysis might be summarized as:
| Analysis question | Potential method |
|---|---|
| Does biomarker level have a linear relationship with a continuous reference measurement? | Pearson |
| Does biomarker level increase as an ordinal severity score increases? | Spearman |
| Is the biomarker/reference relationship nonlinear but monotonic? | Spearman may be preferable |
| Is there substantial curvature? | Consider modeling the relationship rather than relying only on correlation |
Correlation With Ordinal Clinical Scores
Many clinical endpoints are ordinal rather than truly continuous.
Examples include:
- Disease severity grades
- Functional status categories
- Physician global assessment scores
- Ordered toxicity grades
- Likert-type questionnaire responses
For such measurements, Spearman correlation can be attractive because it focuses on ordering.
However, correlation is not automatically the best analysis for every ordinal endpoint. Depending on the research question, ordinal regression, contingency table methods, weighted kappa, or other methods may be more appropriate.
Common Mistakes
- Assuming Pearson requires normal data. Pearson correlation itself can be calculated without requiring both variables to be normally distributed. Distributional assumptions become important when making particular inferential claims or constructing certain intervals.
- Using Spearman automatically whenever data are non-normal. Non-normality alone does not make Spearman the correct method. The shape of the relationship and scientific question matter.
- Interpreting correlation as causation. An association does not establish a causal relationship.
- Ignoring nonlinear relationships. A correlation coefficient can be misleading when the relationship has strong curvature or other structure.
- Ignoring outliers. A single influential observation can substantially change Pearson correlation.
- Choosing the coefficient after seeing which one is larger. Method selection should be prespecified or justified by the data structure and scientific objective.
- Reporting only the p-value. The magnitude and direction of the correlation are usually more informative than statistical significance alone.
- Assuming \(r=0\) means no relationship of any kind. Pearson correlation near zero means little linear association. A strong nonlinear relationship can still exist.
- Failing to examine a scatterplot. The coefficient should be interpreted alongside the actual data pattern.
- Ignoring restricted ranges. A narrow range of measurements can attenuate an observed correlation even when the underlying variables are related.
A Practical Correlation Analysis Workflow
What Should Be Reported?
A clinical research report should provide enough information for the reader to understand both the statistical result and the scientific context.
A useful correlation analysis should generally state:
- The two variables being compared
- The correlation method used
- The sample size analyzed
- The estimated correlation coefficient
- The direction and strength of association
- A confidence interval when appropriate
- The p-value when inferential testing is relevant
- How missing observations were handled
- Any important outlier or data-quality considerations
- The clinical interpretation of the association
Example Reporting Language
For a Pearson analysis:
For a Spearman analysis:
Notice the wording: Pearson is described in terms of a linear association, whereas Spearman is described in terms of a monotonic association.
Pearson vs. Spearman: Quick Decision Table
| Question | Preferred approach |
|---|---|
| Is the relationship approximately linear? | Pearson |
| Is the relationship monotonic but curved? | Spearman |
| Are the measurements ordinal? | Spearman is often more appropriate |
| Are there influential outliers? | Investigate both; Spearman may be less sensitive |
| Are exact numerical distances scientifically important? | Pearson |
| Is relative ordering the primary information? | Spearman |
| Does the scatterplot show no clear pattern? | Neither coefficient alone may be informative |
| Is the relationship strongly nonlinear? | Consider a model designed for nonlinear association |
The Most Important Concept
The most important distinction is simple:
Pearson uses the actual numerical values and therefore reflects how closely the data follow a linear pattern.
Spearman converts the observations to ranks and therefore asks whether the ordering of one variable is associated with the ordering of the other.
Neither method is universally superior.
The correct choice depends on the measurement scale, shape of the relationship, influence of outliers, and scientific question.
References
Pearson, K. (1895). Notes on regression and inheritance in the case of two parents. Proceedings of the Royal Society of London, 58, 240–242.
Spearman, C. (1904). The proof and measurement of association between two things. American Journal of Psychology, 15(1), 72–101.
Conover, W.J. (1999). Practical Nonparametric Statistics.
Wiley.
Hollander, M., Wolfe, D.A., & Chicken, E. (2013). Nonparametric Statistical Methods.
Wiley.
Mukaka, M.M. (2012). A guide to appropriate use of correlation coefficient in medical research. Malawi Medical Journal, 24(3), 69–71.