How Pearson's correlation coefficient is calculated
Pearson's r compares how x and y vary together (their covariance) against how much each varies on its own (their standard deviations), producing a single number between −1 and 1 that describes the strength and direction of any straight-line relationship.
- xᵢ, yᵢ — each entered pair
- x̄, ȳ — means of the x and y values
- r — correlation coefficient, from −1 (perfect negative) to 1 (perfect positive)
More detail
Correlation is not causation
A high r only shows that x and y tend to move together in a straight-line pattern — it says nothing about whether one causes the other. Ice cream sales and drowning incidents both rise in summer and correlate strongly, but neither causes the other; a third factor (hot weather) drives both. Always ask whether a third variable, reverse causation, or plain coincidence could explain a correlation before treating it as a causal link.
Reading the number. |r| ≥ 0.7 is usually called a strong relationship, 0.3–0.7 moderate, and below 0.3 weak — but these thresholds vary by field, and a scatterplot is always worth checking, since r can be misleadingly low for a strong curved relationship or misleadingly high if one outlier pair dominates a small dataset.
Frequently asked questions
What's the correlation coefficient for the pairs (1,2), (2,4), (3,5), (4,4), (5,5)?
r ≈ 0.7746 — a strong positive relationship (|r| ≥ 0.7). These are the default values above; enter your own pairs to replace them.
What does r = 1 or r = -1 mean?
r = 1 means every point falls exactly on a rising straight line (e.g. (1,2), (2,4), (3,6), (4,8), (5,10) — each y is exactly 2x). r = −1 means the same but falling: as x rises, y falls in perfect lockstep.
Why does the calculator show "—" if all my x values are the same?
Pearson's r divides by the spread of x and of y; if every x value entered is identical, x has zero variance and the division is undefined — there's no linear trend to measure when one variable never changes.
Can two variables be strongly related but have a low r?
Yes — r only detects straight-line relationships. Two variables can follow a strong curved pattern (like a U-shape) with r close to 0, because the positive and negative parts of the curve cancel out in the linear formula. Always look at a scatterplot alongside r.