beginnerstatistics

Correlation vs Causation

Two things moving together does not mean one is causing the other.

Key Points

What it is

Correlation measures the statistical relationship between two variables — how much they tend to move together. Causation means one variable directly causes changes in the other. These are fundamentally different things. Two variables can be perfectly correlated without any causal link between them. Confusing the two is one of the most common and consequential errors in data science, journalism, and research.

Why it exists

Correlation is easy to compute and appears everywhere in data analysis. It is a useful signal for finding relationships worth investigating. But acting on correlations as if they were causal leads to bad decisions — spending money on interventions that do not work, or mistaking a symptom for a cause. The distinction exists because the question 'what happens if I intervene?' requires causation, not just correlation.

What it measures

Correlation measures the strength and direction of a linear relationship between two continuous variables. A correlation of 0.9 means that when one variable increases, the other tends to increase in a predictable, linear way. It does not tell you why — just that they move together. Causation goes further: it tells you that changing one variable will produce a change in the other, even if everything else stays the same.

Intuition

Ice cream sales and drowning rates are strongly positively correlated. Does eating ice cream cause drowning? No. Both are caused by hot weather — people buy more ice cream in summer AND swim more in summer. Hot weather is the confounding variable. This is a classic example of spurious correlation. Another: countries with more TVs per household have higher life expectancy. TVs do not cause longevity — both are driven by wealth. Acting on the TV correlation by distributing televisions to poor countries would accomplish nothing.

Example

A company finds that employees who use the company gym have 30% higher performance reviews on average. Correlation: gym usage and performance are positively correlated.

This does not mean the gym causes better performance. It is possible that high-performing, motivated employees are also the ones who use the gym — motivation is the confounding variable driving both. Building more gyms may not improve performance at all. A randomized trial (randomly assign some employees to gym access) would be needed to establish causation.

Formulas

Pearson Correlation Coefficient

r=∑i=1n(xi−xˉ)(yi−yˉ)∑i=1n(xi−xˉ)2⋅∑i=1n(yi−yˉ)2r = \frac{\sum_{i=1}^{n}(x_i - \bar{x})(y_i - \bar{y})}{\sqrt{\sum_{i=1}^{n}(x_i - \bar{x})^2 \cdot \sum_{i=1}^{n}(y_i - \bar{y})^2}}
  • r — Pearson correlation coefficient — ranges from -1 to +1
  • (xᵢ − x̄) — how far each x value is from the mean of x
  • (yᵢ − ȳ) — how far each y value is from the mean of y
  • numerator — covariance — how much x and y vary together
  • denominator — product of standard deviations — normalizes to [-1, +1]

When to use

When not to use

Common mistakes

In practice

In Pandas: df.corr() produces a correlation matrix for all numeric columns — one of the first things to run during EDA. Heatmaps of the correlation matrix (via seaborn) are a standard visualization. In feature selection, you drop one of two features with |r| > 0.9 to reduce multicollinearity. In linear regression, correlated features inflate variance of coefficients. Causal inference methods (propensity score matching, instrumental variables, difference-in-differences) are the tools used when you need to move from correlation to causation in observational data.

Was this concept helpful?

Spot an error or gap? Suggest an edit →

Related concepts

hypothesis-testingnormal-distributionvariance-standard-deviationprobability-basicsconditional-probability
Chirp at me!