Correlation, Causation and Confounding

Measuring relationships between variables and reasoning carefully about whether one actually causes the other.

Intermediate · about 4 hours · difficulty 3/5

Learn first: Sampling, Bias and Data Collection

Stakeholders almost always want causal answers ("did the campaign increase sales?") while most business data only shows associations. Bridging that gap carefully is a core analyst skill.

Measuring association

  • Pearson correlation measures linear relationships between two numeric variables, from -1 to 1.
  • Spearman correlation uses ranks; better for monotonic but non-linear or outlier-heavy data.
  • Always plot a scatter first. Very different patterns can produce the same correlation coefficient (see Anscombe's quartet).

Why correlation is not causation

  • Confounders: a third factor drives both (hot weather drives ice cream sales and sunburn).
  • Reverse causation: loyal customers use more features, not necessarily the other way round.
  • Selection effects and coincidence in large searches for patterns.

Getting closer to causality

  • Randomised experiments (A/B tests) are the most reliable.
  • Natural experiments and difference-in-differences: compare changes over time between affected and unaffected groups.
  • Controlling for confounders with segmentation or regression, while accepting you can only control for what you measured.

Language matters

Say "users who did X were 20% more likely to Y" rather than "X increases Y by 20%" unless you have causal evidence.

Pitfall: recommending big investments based on a correlation in observational data. Move on when you can list at least two alternative explanations for any correlation someone shows you.

Key concepts

  • Pearson and Spearman correlation
  • Scatter plots and Anscombe's quartet
  • Confounding variables
  • Reverse causation
  • Difference-in-differences
  • Causal language in reporting

Mini project

Using Gapminder or Our World in Data country indicators, find a strong correlation (e.g. internet usage vs life expectancy) and write up at least three alternative explanations and what data could separate them.

Check yourself

Customers who use the mobile app spend more. List two reasons this might be true even if the app itself causes no extra spending.

Free resources