Data Science ยท Chapter 20 of 43
Correlation vs Causation
CORRELATION means two variables move together. CAUSATION means one causes the other.
Correlation is easy to measure. Causation requires experiments or careful causal inference.
Example 1 (python)
import pandas as pd
df = pd.DataFrame({'x':[1,2,3,4,5], 'y':[2,4,6,8,10]})
print(df.corr())Output
x y
x 1.0 1.0
y 1.0 1.0Perfect linear correlation.
Example 2 (python)
# Ice cream sales & drownings both rise in summer
# โ correlated, but neither causes the other (heat does)Classic confounder example.
Key points
- Correlation != causation.
- Confounders can create spurious correlations.
- A/B tests are the gold standard for causation.
- Domain knowledge helps spot false causal claims.
๐ก Note: 'Correlation does not imply causation' is a headline you'll write in a report at least once a quarter.
