Correlation Is Not Causation
Hidden causes.
Ice cream sales and drownings are strongly correlated. Does ice cream cause drowning? Of course not. Hot weather makes people buy ice cream, and also makes people swim. Temperature is a hidden cause, called a confounder.

- Ice cream and drownings
- Correlated, not causal
- Hot weather drives both
A confounder in action
We simulate ten years of days. Temperature drives both ice cream sales and swimming accidents, but ice cream has no effect on accidents at all. Run it. A strong correlation anyway. But if we look only at days with similar temperatures, the correlation almost disappears.
import numpy as np
rng = np.random.default_rng(0)
temp = rng.uniform(5, 35, 3650)
ice_cream = 20 * temp + rng.normal(0, 60, 3650)
accidents = 0.3 * temp + rng.normal(0, 2, 3650)
print("overall r:", np.corrcoef(ice_cream, accidents)[0, 1].round(2))
warm = (temp > 25) & (temp < 28)
print("similar days r:", np.corrcoef(ice_cream[warm], accidents[warm])[0, 1].round(2))overall r: 0.75 similar days r: 0.0
How to find causes
The gold standard is a randomized experiment, like an A/B test. Random assignment breaks the link with confounders. When you can't experiment, you can control for known confounders, by comparing similar groups. In machine learning, a model can predict well from correlations, but that doesn't mean changing a feature will change the outcome.
| key | value |
|---|---|
| Confounder | a hidden common cause |
| Experiments | randomize to find causes |
| Observational data | control for confounders |
| ML | prediction isn't causation |
Summary
Correlation doesn't prove causation. Look for confounders, and use experiments when you can. Next, drawing the best straight line through data.
Key takeaways- Look for confounders
- Randomize when possible
- Predict ≠ cause