Causal Inference DAG

Build causal DAGs, explore d-separation, compute do-calculus interventions, and discover Simpson's paradox

Causal DAG

Probability Tables

Evidence Comparison

Causal DAG

A Directed Acyclic Graph (DAG) encodes causal assumptions: each node is a variable, each arrow X→Y means X directly causes Y. The absence of an arrow is a strong claim — it means no direct causal effect. Judea Pearl's framework uses DAGs to determine which causal effects can be identified from observational data and how.

D-Separation

Two variables X and Y are d-separated by a set Z if every path between X and Y is blocked. A path is blocked if it contains: (1) a chain A→B→C where B is in Z, (2) a fork A←B→C where B is in Z, or (3) a collider A→B←C where B and its descendants are NOT in Z. D-separated variables are conditionally independent given Z.

Simpson's Paradox

A treatment appears beneficial overall but harmful in every subgroup (or vice versa). The resolution depends on the causal structure: if the subgrouping variable is a confounder, the stratified analysis is correct; if it is a collider, the overall analysis is correct. Without a DAG, statistics alone cannot tell you which is right.

Real-World Applications

Causal inference is essential in epidemiology (does smoking cause lung cancer or does a genetic factor cause both?), economics (does education increase earnings or do ability and family background cause both?), policy evaluation (does a program work or is selection bias driving results?), and machine learning (fairness, explainability, and domain adaptation all require causal reasoning).

How to Use

Edit Mode: Click 'Add Node' to create variables, then Shift+click two nodes to create an edge. Double-click a node to delete it, and drag nodes to reposition them. D-Separation Mode: Select source and target, then choose conditioning variables. The DAG highlights open paths in green and blocked paths in red. Intervention Mode: Select a node to intervene on (do(X)); incoming edges are cut conceptually to simulate a randomized experiment. Compare P(Y|X=x) vs P(Y|do(X=x)).