A correlation coefficient compresses the relationship between two variables into a single number between −1 and +1. That makes it one of the most useful summaries in statistics, and one of the easiest to misread. This guide explains what Pearson's r measures, how its significance depends on sample size, how to read a correlation heatmap, and the four situations in which r will mislead you unless you look at the scatter plot.
What Pearson's r measures
Pearson's r measures how closely the points in a scatter plot follow a straight line. +1 means a perfect rising line, −1 a perfect falling line, and 0 means no linear trend at all.
Two consequences of that definition surprise people:
- r is not the slope. A line that rises steeply and a line that rises gently both have r = 1 if every point falls exactly on them. The slope tells you how much Y changes per unit of X; r tells you how consistently it does so. For the slope, see linear regression and R².
- r only sees straight lines. A perfect U-shaped relationship can have r ≈ 0.
How strong is "strong"?
Common rules of thumb (from Jacob Cohen) describe |r| ≈ 0.1 as small, 0.3 as medium and 0.5 or above as large. These are only rough guides: in physics or analytical chemistry, r = 0.95 between two instruments might be disappointing, while in psychology or epidemiology r = 0.3 can be an important finding.
Squaring r gives the share of variance the two variables have in common. An r of 0.5 gives r² = 0.25: only a quarter of the variation in one variable is linearly associated with the other. This is a useful reality check: a "strong" correlation of 0.5 still leaves three quarters of the variation unexplained.
Significance depends heavily on sample size
The p-value for a correlation tests whether r differs from zero. It comes from t = r √(n − 2) / √(1 − r²) with n − 2 degrees of freedom. The same r can be convincing or meaningless depending on n:
| r | n | p (two-sided) | Interpretation |
|---|---|---|---|
| 0.30 | 20 | ≈ 0.20 | Could easily be chance |
| 0.30 | 100 | ≈ 0.002 | Very unlikely to be chance, still a modest relationship |
| 0.10 | 1,000 | ≈ 0.0015 | Real, but explains only 1% of the variance |
| 0.60 | 8 | ≈ 0.12 | Looks strong, but eight points are not enough |
So always report r together with n (and ideally a confidence interval), and judge the size of r separately from its p-value. More on that distinction in what a p-value really means.
Four ways r misleads: always plot first
The statistician Francis Anscombe made this point famous in 1973 with four small datasets that share the same means, variances, regression line and correlation (r ≈ 0.82) but look completely different when plotted: one is a clean linear trend, one a smooth curve, one a perfect line with a single outlier, and one a vertical stack of points with one far-away value that creates the whole correlation. The lessons:
- Curved relationships. r underestimates a strong but non-linear relationship. Look at the scatter plot; if it curves, r is the wrong summary.
- Outliers. A single extreme point can create a strong correlation out of nothing, or destroy a real one. Spearman's rank correlation is much less sensitive to this.
- Restricted range. If you only sample a narrow slice of X (for example, only students with top grades), the correlation within that slice will be weaker than in the full population.
- Mixed groups. Combining two groups that differ in both X and Y can produce a correlation that exists in neither group alone, or even reverses the direction within each group (Simpson's paradox).
In StatFlo, a Scatter Plot of the two columns shows the points together with the fitted line and Pearson r, so you can check all four issues at a glance.
Correlation is not causation
A strong correlation between X and Y is consistent with X causing Y, Y causing X, a third variable causing both (ice-cream sales and drownings both rise in summer), or a coincidence that will not replicate. Establishing causation needs a controlled experiment or careful causal reasoning about confounders, not a stronger correlation.
Pearson or Spearman?
| Pearson r | Spearman ρ (rho) | |
|---|---|---|
| Measures | Linear association | Monotonic association (consistently up or down, not necessarily straight) |
| Calculated on | Raw values | Ranks of the values |
| Outliers | Sensitive | Robust |
| Best for | Roughly linear, continuous data without extreme values | Skewed data, ordinal scales, curved but steadily rising/falling trends |
StatFlo currently reports Pearson's r. A quick way to get Spearman's ρ is to convert each column to ranks in a spreadsheet (Excel's RANK.AVG function) and compute Pearson's r on the ranks; that is exactly what Spearman's ρ is.
Reading a correlation heatmap
When you have many variables, a heatmap shows the correlation for every pair at once. StatFlo's Correlation Heatmap colours each cell from red (r = −1) through white (r = 0) to navy (r = +1) and prints the value in each cell.
- The diagonal is always 1: every variable correlates perfectly with itself. Ignore it.
- The matrix is symmetric: the cell for A vs B equals the cell for B vs A, so you only need to read one triangle.
- Look for blocks: clusters of strongly coloured cells often reveal groups of variables measuring related things.
- Beware of multiple comparisons: 10 variables produce 45 distinct pairs. At p < 0.05, two or three "significant" correlations would be expected by chance alone even if nothing were related. Treat a heatmap as exploration, then test specific hypotheses.
For a heatmap, your data must be aligned by row: each row should be one subject or sample, with each column a different variable measured on that subject. If the columns have different lengths, StatFlo compares each pair using the first rows, up to the length of the shorter column, so avoid blank cells in the middle of a column: they would shift the remaining values out of alignment.
How to report it
"Sleep duration was moderately correlated with test score (Pearson r = 0.30, n = 100, p = 0.002)." Add a scatter plot whenever space allows.