Causality Sandbox
Generate synthetic data from different causal structures and inspect how correlation and slope change.
why causal graphs beat correlation tables 🖖
<p>A correlation tells you two variables move together — not why. The same number can arise from three fundamentally different structures:</p><ul><li>Direct cause (X → Y): removing X changes Y.</li><li>Confounder (Z → X, Z → Y): Z causes both; X and Y are correlated but neither causes the other. Controlling for Z kills the correlation.</li><li>Collider (X → Z ← Y): X and Y are independent, but if you select or condition on Z, you create a spurious link between them.</li></ul><p>The Directed Acyclic Graph (DAG) in the chart encodes which variables are causes and which are effects. Without it, you cannot distinguish these cases from a single correlation coefficient — which is why causal inference always starts with a structural model, not a correlation matrix.</p>
correlation is seeing, causation is doing 🖖
The deepest idea in this sandbox is the gap between watching a variable and changing it. Confounders and colliders both fool you because you only ever observe data that some hidden process already shaped. A randomized experiment cuts through this: assigning X by a coin flip severs every arrow pointing into X, so any correlation with Y that survives must be causal. That is why a controlled trial can settle a question no amount of observational data ever can.
the Berkeley admissions paradox 🖖
The Simpson scenario is no toy. In 1973 UC Berkeley's graduate admissions showed about 44% of men admitted against 35% of women, hinting at bias. Yet department by department, women were admitted at slightly higher rates — they had simply applied in far larger numbers to the most competitive departments. Aggregating across departments flipped the within-group trend, exactly the reversal the dashed line traces in this tool.
Example problems
- Causal - Direct causal link X->Y gives strong correlation for the right reason
- Confounder - Hidden Z drives both X and Y, creating correlation without direct causation
- Collider - Conditioning on a collider induces spurious X-Y association
- Simpson - Aggregated trend reverses when data is stratified by subgroup