Tutorials › Biostatistics › Pearson vs. Spearman Correlation Coefficients

Biostatistics & Clinical Research

Pearson vs. Spearman Correlation Coefficients

A practical guide to choosing between Pearson and Spearman correlation in clinical research, including linear versus monotonic association, assumptions, outliers, ties, interpretation, confidence intervals, and implementation in R and SAS.

Intermediate 12 min read

What You'll Learn

  • What Pearson and Spearman correlation coefficients measure
  • The difference between linear and monotonic association
  • When clinical researchers should prefer Pearson or Spearman
  • How outliers, skewness, and ties affect correlation
  • How to calculate and interpret both coefficients
  • How to implement Pearson and Spearman correlation in R and SAS

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.

Key idea: Pearson correlation measures the strength of a linear association. Spearman correlation measures the strength of a monotonic association using ranks. The choice between them should therefore depend on the relationship you are trying to characterize, not simply on whether the data pass or fail a normality test.

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.

Important: A correlation coefficient describes association, not causation. Even a correlation very close to \(+1\) or \(-1\) does not establish that a change in one variable causes a change in 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:

$$ r = \frac{ \sum_{i=1}^{n}(x_i-\bar{x})(y_i-\bar{y}) }{ \sqrt{ \sum_{i=1}^{n}(x_i-\bar{x})^2 \sum_{i=1}^{n}(y_i-\bar{y})^2 } } $$

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.

Clinical interpretation: A Pearson correlation of \(r=0.80\) indicates a strong positive linear association. It does not mean that an 80% increase in one variable causes an 80% increase in the other.

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.

$$ \rho_s = \operatorname{cor} \left[ \operatorname{rank}(X), \operatorname{rank}(Y) \right] $$

When there are no tied ranks, an equivalent formula is:

$$ \rho_s = 1- \frac{ 6\sum_{i=1}^{n}d_i^2 }{ n(n^2-1) } $$

where \(d_i\) is the difference between the rank of \(X_i\) and the rank of \(Y_i\).

Key idea: Spearman correlation asks whether higher values of one variable tend to be associated with higher or lower values of the other, without requiring that the relationship be a straight line.

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:

$$ Y=\alpha+\beta X $$

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:

$$ Y=\log(X) $$

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.

Practical rule: Always examine a scatterplot before interpreting a correlation coefficient. A single number can hide curvature, clusters, influential observations, or other patterns that are obvious visually.

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.

Do not oversimplify the rule: Spearman is not simply "Pearson for non-normal data." The fundamental reason for choosing Spearman is that the scientific relationship is better described in terms of ranks or monotonic ordering.

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:

$$ X=(10,20,30,40,50) $$

Their ranks are:

$$ R_X=(1,2,3,4,5) $$

If a second variable has observations:

$$ Y=(100,150,200,300,500) $$

its ranks are also:

$$ R_Y=(1,2,3,4,5) $$

Therefore:

$$ \rho_s=1 $$

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:

$$ Y=\log(X) $$

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\).

Clinical example: A biomarker might have a strong association with disease severity at low concentrations but show diminishing changes at higher concentrations. If the relationship remains consistently increasing, Spearman correlation may capture the monotonic association more effectively than Pearson correlation.

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
Important: "Spearman is robust to outliers" does not mean that outliers can be ignored. An outlier may represent a data error, an unusual patient, or an important clinical subgroup. Investigate the observation rather than automatically deleting it.

Correlation Does Not Imply Causation

Suppose two clinical variables have:

$$ r=0.85 $$

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:

$$ H_0:\rho=0 $$

against an alternative such as:

$$ H_A:\rho\ne0 $$

For Pearson correlation under the usual assumptions, the test statistic can be expressed as:

$$ t = \frac{ r\sqrt{n-2} }{ \sqrt{1-r^2} } $$

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.

Do not confuse correlation with statistical significance: A small correlation can be statistically significant in a very large study, while a clinically meaningful correlation may fail to reach statistical significance in a small study. Report the estimated correlation together with its uncertainty and clinical interpretation.

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.

$$ z = \frac{1}{2} \ln \left( \frac{1+r}{1-r} \right) $$

The transformed value is approximately normally distributed under suitable conditions, with standard error:

$$ SE(z) = \frac{1}{\sqrt{n-3}} $$

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

1
Define the scientific question: are you interested in numerical linear association or ordered monotonic association?
2
Plot the two variables using a scatterplot or another appropriate visualization.
3
Look for curvature, clusters, influential observations, and restricted ranges.
4
Assess whether the variables are quantitative or ordinal and whether their numerical distances are meaningful.
5
Use Pearson when a linear value-based association is the primary target.
6
Use Spearman when rank ordering or monotonic association is the more appropriate target.
7
Investigate outliers and explain how they affect the analysis rather than automatically removing them.
8
Report the coefficient, sample size, confidence interval when appropriate, and a clinically meaningful interpretation.

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:

$$ r=0.42 $$

but:

$$ \rho_s=0.78 $$

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.

Diagnostic use: Comparing Pearson and Spearman can be useful for understanding the structure of the data, but choosing whichever coefficient produces the larger value is not a valid statistical strategy. The method should be selected based on the scientific question and data structure.

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")
R tip: For Spearman correlation, R computes the correlation using ranks and handles ties appropriately. For small datasets, inspect the data and scatterplot rather than relying solely on the resulting p-value.

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.

Clinical trial caution: Do not force an ordinal clinical endpoint into a correlation analysis simply because a correlation coefficient is easy to calculate. The statistical method should reflect the estimand and the endpoint's measurement scale.

Common Mistakes

  1. 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.
  2. 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.
  3. Interpreting correlation as causation. An association does not establish a causal relationship.
  4. Ignoring nonlinear relationships. A correlation coefficient can be misleading when the relationship has strong curvature or other structure.
  5. Ignoring outliers. A single influential observation can substantially change Pearson correlation.
  6. Choosing the coefficient after seeing which one is larger. Method selection should be prespecified or justified by the data structure and scientific objective.
  7. Reporting only the p-value. The magnitude and direction of the correlation are usually more informative than statistical significance alone.
  8. Assuming \(r=0\) means no relationship of any kind. Pearson correlation near zero means little linear association. A strong nonlinear relationship can still exist.
  9. Failing to examine a scatterplot. The coefficient should be interpreted alongside the actual data pattern.
  10. 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

1
Define the scientific question and the variables being compared.
2
Confirm that correlation is an appropriate measure for the endpoint types.
3
Create a scatterplot and inspect the relationship.
4
Look for linearity, monotonicity, curvature, clusters, and influential observations.
5
Assess whether the numerical values or their ranks best represent the scientific question.
6
Select Pearson for a value-based linear association when appropriate.
7
Select Spearman for rank-based monotonic association when appropriate.
8
Investigate missing values, ties, outliers, and restricted ranges.
9
Calculate the correlation coefficient and appropriate inferential quantities.
10
Report the coefficient with its direction, magnitude, uncertainty, sample size, and clinical interpretation.

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:

Example: Pearson correlation demonstrated a moderate positive linear association between the biomarker concentration and the continuous disease-severity measure (\(r=0.62\), with the confidence interval and p-value reported as appropriate).

For a Spearman analysis:

Example: Spearman rank correlation demonstrated a strong positive monotonic association between biomarker concentration and disease-severity grade (\(\rho_s=0.74\), with the confidence interval and p-value reported as appropriate).

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:

$$ \boxed{\text{Pearson} \rightarrow \text{linear association}} $$
$$ \boxed{\text{Spearman} \rightarrow \text{monotonic rank association}} $$

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.

Bottom line: Use Pearson correlation when the primary scientific question concerns the strength of a linear relationship between quantitative variables. Use Spearman correlation when the primary question concerns monotonic association, rank ordering, ordinal measurements, or relationships where the numerical scale is less important than the ordering. In either case, inspect the data graphically, investigate outliers and missing values, and interpret correlation as association rather than causation.

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.