When to use correlation
Use correlation to quantify the strength and direction of association between two continuous variables — study hours and exam score, temperature and sales. Choose Pearson's r when the relationship is roughly linear and the data has no extreme outliers; choose Spearman's ρ for ranked/ordinal data or when outliers or curvature are present.
If you want to predict one variable from another rather than just measure association, use linear regression instead.
Interpreting the magnitude
A common rule of thumb (Cohen): |r| ≈ 0.1 is small, 0.3 moderate, and 0.5 or above large — but context matters enormously across fields. The square of r (r²) is the share of variance the linear relationship explains: r = 0.5 explains just 25%.
Assumptions and cautions
- Linearity (Pearson) — a curved relationship can give r ≈ 0 despite a strong pattern. Always look at a scatterplot.
- Outliers — a single extreme point can create or destroy a correlation. Spearman is more robust.
- Restricted range — sampling a narrow slice of one variable shrinks r.
Common mistakes
- Inferring causation — a correlation can arise from a lurking third variable; see correlation vs causation.
- Not plotting the data — Anscombe's quartet shows four datasets with identical r but wildly different shapes.
- Confusing r with slope — r is unitless; the regression slope carries units.
Worked example
Hours studied 1,2,3,4,5 against scores 52,58,63,71,78 gives r ≈ 0.997 — a very strong positive linear relationship, with a p-value well below 0.05. Paste two equal-length columns above to compute r, the p-value, and r². Computation details are on the methodology page.