Correlation measures how two variables move together, which helps scientists, engineers, and students describe patterns in data. Pearson correlation is designed for straight-line relationships, while Spearman correlation is designed for ranked or monotonic relationships. Comparing them helps you choose a statistic that matches the shape of your scatterplot.
This matters because the wrong correlation can hide a real pattern or exaggerate a weak one.
Pearson uses the actual numerical values and measures how closely points cluster around a line. Spearman first converts values to ranks, then measures how well the ranks move together, so it can detect curved but consistently increasing or decreasing patterns. Outliers can strongly affect Pearson because extreme values change means, standard deviations, and the fitted linear pattern.
Spearman is often more resistant to outliers, but it can lose information when exact distances between values matter.
Key Facts
- Pearson correlation measures linear association between two quantitative variables.
- Spearman correlation measures monotonic association by applying Pearson correlation to ranks.
- Pearson formula: r = cov(x,y) / (sx sy).
- Spearman with no tied ranks: rho = 1 - 6 sum(d_i^2) / (n(n^2 - 1)).
- Both Pearson r and Spearman rho range from -1 to +1.
- Use Pearson for straight-line patterns with few outliers, and use Spearman for rank data, curved monotonic patterns, or strong outlier concerns.
Vocabulary
- Pearson correlation
- A statistic that measures the strength and direction of a linear relationship between two numerical variables.
- Spearman correlation
- A statistic that measures the strength and direction of a monotonic relationship by comparing the ranks of two variables.
- Linear relationship
- A relationship in which the data pattern is well described by a straight line.
- Monotonic relationship
- A relationship in which one variable tends to consistently increase or consistently decrease as the other changes, even if the pattern is curved.
- Outlier
- A data point that is far from the overall pattern and can strongly influence some statistical measures.
Common Mistakes to Avoid
- Using Pearson for a curved monotonic pattern, which is wrong because Pearson only measures how well the data follow a straight line.
- Using Spearman when the actual spacing between values is important, which is wrong because ranking removes information about the size of gaps between data points.
- Ignoring outliers before computing correlation, which is wrong because a single extreme point can greatly change Pearson r and sometimes change the interpretation.
- Treating correlation as proof of causation, which is wrong because two variables can be correlated due to a third variable, coincidence, or reverse direction of influence.
Practice Questions
- 1 For the data x = 1, 2, 3, 4 and y = 2, 4, 6, 8, what is the Pearson correlation r?
- 2 For the data x = 1, 2, 3, 4 and y = 10, 30, 20, 40, rank both variables and compute Spearman rho using rho = 1 - 6 sum(d_i^2) / (n(n^2 - 1)).
- 3 A scatterplot rises quickly at first and then levels off, with no major outliers. Explain whether Pearson or Spearman is more appropriate and why.