Statistics
Intermediate 14 min read Statistics

Correlation vs Causation

Why most 'insights' are associations in disguise

Correlation quantifies association; causation requires an intervention. Confounders, reverse causation and Simpson's paradox explain most 'data says X causes Y' failures in production.

correlationcausationconfounderSimpson's paradoxA/B testingnatural experiment
Before we start

What you will learn

  • Compute and interpret Pearson correlation
  • Explain confounders and reverse causality
  • Recognize Simpson's paradox and how to uncover it
Introduction

What is this?

Correlation is a number measuring how two variables move together (Pearson r ∈ [−1, 1]). Causation means intervening on one changes the other. Correlated variables can share a cause (confounder), have reversed cause and effect, or coincide by chance. Establishing causality demands an intervention — an experiment — not just observed association.

Motivation

Why do you need it?

  • Feature-selection teams mistake predictive association for causal relevance.
  • Dashboards full of 'because' narratives are usually confounded correlations.
  • A/B testing is the industry's tool for actually claiming causation.
  • Simpson's paradox can flip a conclusion inside a sub-group — a top interview favorite.
Think about it

Mental model

Imagine

Fire trucks and fires

Think of

Correlation vs causation

More fire trucks correlate with bigger fires — but trucks don't cause fires. The hidden common driver (the fire) is the confounder. Fitting a model that 'learns' trucks→fires would send fire trucks to every siren.

Mechanics

How it works

  • Pearson r measures linear co-movement: r = cov(X,Y)/(σₓσ_y); |r|=1 perfect line, r=0 none.
  • Correlation is symmetric — it can't tell you which way causality flows.
  • A confounder Z drives both X and Y, creating correlation without a direct causal link.
  • Reverse causation: Y causes X but 'appears' as X → Y because it's measured later.
  • Experiments (randomized assignment) and natural experiments break confounding by design.

Three ways correlation arises.

Direct cause
Confounder
Reverse
Observed r
Needs experiment
Hands-on

Examples

Simpson's paradox in one table

Simpson's paradox in one table
import pandas as pd
df = pd.DataFrame([
{"group": "A", "treated": 1, "recover": 0.70, "n": 100},
{"group": "A", "treated": 0, "recover": 0.65, "n": 100},
{"group": "B", "treated": 1, "recover": 0.40, "n": 100},
{"group": "B", "treated": 0, "recover": 0.30, "n": 100},
])
print(df) # within each group treated > untreated
# But if group B patients dominate the treated arm, the pooled
# 'treated' average can be below 'untreated' — the paradox.

Every row favors treatment within its group, yet an unequal mix across groups makes the aggregate flip. Analysis must stratify by the confounder (group) — the pooled number lies.

Real world

In production

  • An experiment team randomizes users so conversion differences become causal claims.
  • A medical-anomaly model stratifies by hospital before correlating 'readmission' with features.
  • A growth team reads an ice-cream correlation with drowning as a sun-weather confounder cautionary tale.
Guidelines

Best practices

  • Report correlations as associations, verb carefully.
  • Stratify dashboards by obvious confounders (cohort, region, tier).
  • When you must claim causality, run/quote a randomized experiment.
Watch out

Common mistakes

  • Saying 'X causes Y' from a high r on observational data.
  • Drawing conclusions from pooled data without checking sub-groups (the paradox).
  • Selecting features by correlation-to-target when confounding inflates the signal.
When things break

Debugging tips

  • If a feature's correlation flips sign between sub-groups, suspect Simpson's paradox.
  • Control for confounders by stratification or regression before believing an association.
  • Before trusting an observational link, ask: is there a plausible third variable driving both?
Interviews

Interview checkpoint

Test yourself

Quick quiz

0/2
1

Two metrics correlate r=0.9. The safest scientific statement is:

2

Randomized experiments are the gold standard for claiming causation because they break confounding.

Go deeper

Official documentation