Correlation

When we collect data on two quantitative variables for the same group of individuals — such as a person's height and weight, or the number of hours studied and a test score — we are working with bivariate quantitative data. One of the first questions a statistician asks is: do these two variables move together in a consistent way? The concept that captures this idea is called correlation, which measures both the strength and the direction of the linear association between two quantitative variables. Correlation is not just a vague feeling that two things are related. It is a precise numerical value, most commonly reported as the Pearson correlation coefficient, denoted r. This value always falls between −1 and 1, inclusive. A value of r = 1 means a perfect positive linear relationship (as one variable increases, the other increases proportionally), r = −1 means a perfect negative linear relationship, and r = 0 means no linear association at all. Values in between describe relationships of varying strength and direction. Understanding correlation is essential for data exploration because it tells you whether a linear model is even appropriate before you try to fit one. However, a critical warning applies in every statistics course: correlation does not imply causation. Two variables can be strongly correlated simply because a third lurking variable influences both, or even purely by coincidence. Responsible data analysis always considers context alongside the numerical value of r.

Key takeaways
  • Direction of Association
  • Strength of Association
  • Standardizing the Variables
  • Computing r
  • Important Limitations

Direction of Association

The sign of r tells you the direction. A positive r means that as the explanatory variable x increases, the response variable y tends to increase as well. A negative r means that as x increases, y tends to decrease. For example, the correlation between hours of sleep and reaction time is negative: more sleep is associated with faster (lower) reaction times.

Strength of Association

The magnitude (absolute value) of r tells you the strength. Values of |r| close to 1 indicate a strong linear relationship where points on a scatterplot cluster tightly around a straight line. Values close to 0 indicate a weak or nonexistent linear relationship. A common rough guide: |r| ≥ 0.8 is strong, 0.5 ≤ |r| < 0.8 is moderate, and |r| < 0.5 is weak, though context always matters.

Standardizing the Variables

The Pearson r is computed using z-scores, which removes units from the calculation. Each data point (xᵢ, yᵢ) is converted to its z-score: zₓ = (xᵢ − x̄)/sₓ and z_y = (yᵢ − ȳ)/s_y. Because we divide by the standard deviations, r is dimensionless — it doesn't matter whether height is measured in centimetres or inches; the correlation is the same.

Computing r

The Pearson correlation coefficient is the average of the products of the z-scores for each pair of observations. Points where both variables are above their means contribute a positive product; points where one is above and one is below contribute a negative product. If positive products dominate overall, r is positive. This is why the formula captures direction as well as strength simultaneously.

Important Limitations

Correlation only measures linear association. Two variables can have a strong curved (nonlinear) relationship and still have r near 0. Outliers can dramatically inflate or deflate r, so always pair a numerical correlation with a scatterplot. Finally, r is symmetric: the correlation between x and y equals the correlation between y and x, which reflects that neither variable is privileged in the calculation.

The Key Equation

r=1n−1∑i=1n(xi−xˉsx)(yi−yˉsy)r = \frac{1}{n-1}\sum_{i=1}^{n}\left(\frac{x_i - \bar{x}}{s_x}\right)\left(\frac{y_i - \bar{y}}{s_y}\right)
  • r — Pearson correlation coefficient (dimensionless): The numerical measure of the strength and direction of the linear association; always between −1 and 1
  • n — sample size (count): The number of paired observations (x, y) in the dataset
  • x_i,\, y_i — individual data values (varies): The ith observed value of variable x and variable y respectively
  • \bar{x},\, \bar{y} — sample means (varies): The arithmetic mean of all x values and all y values in the sample
  • s_x,\, s_y — sample standard deviations (same as x and y): The sample standard deviation of x and y; dividing by these converts each value to a z-score

Worked Example

Problem. A teacher records the number of hours five students studied (x) and their exam scores out of 100 (y). The data are: (2, 55), (3, 60), (5, 75), (7, 85), (8, 90). Calculate the Pearson correlation coefficient r.

r≈0.997r \approx 0.997

Answer. r ≈ 0.997, indicating a very strong positive linear association between hours studied and exam score.

Figure
Diagram
Types of CorrelationStrong Positiver ≈ +0.95Strong Negativer ≈ −0.95No Correlationr ≈ 0Correlation Strength Scale−1−0.8−0.50+0.5+0.8+1Strong negativeModerate neg.Weak neg.Weak pos.Moderate pos.Strong positive
Origins · 1 minKarl Pearson and how this was discovered
KP
Karl Pearson
1857–1936 · British

Karl Pearson formalised and popularised the correlation coefficient in the 1890s, building on earlier work by Francis Galton. Pearson developed the mathematical framework that defines r as we use it today, and he also founded the world's first university statistics department at University College London. His work transformed statistics from a collection of techniques into a rigorous mathematical discipline. Pearson was so dedicated to statistics that he manually calculated correlations for enormous datasets long before computers existed — a process that could take weeks of arithmetic by hand with a team of human 'computers'.

  • Scatterplots — A scatterplot is the essential visual tool for examining bivariate data; you should always look at a scatterplot before interpreting r, since correlation only captures linear patterns.
  • Least-Squares Regression Line — Once a strong linear correlation is confirmed, the next step is fitting a regression line to model and predict the relationship; the slope of the regression line is directly related to r.
  • Coefficient of Determination (r²) — r² is computed directly from the correlation coefficient and tells us the proportion of variability in y that is explained by the linear relationship with x.
  • Standard Deviation — The formula for r uses standard deviations to standardise variables into z-scores, so a solid understanding of standard deviation is prerequisite knowledge.