CAUSALLAB

INTERACTIVE CAUSAL INFERENCE & DISCOVERY LABORATORY
Structural Causal Model

Build a DAG

Click canvas to add nodes. Drag from one node to another to add directed edges. Right-click to remove.
Preset Models
Actions
d-Separation Query
|
Structural Equations
Add nodes to define equations
Graph Properties
Nodes0
Edges0
Is DAG
Topological Order
Node Roles
Select a preset to see roles
Paths Between Selected
Select two nodes
Pearl's Causal Hierarchy

Rung 1: Association

P(Y|X) — What is? Seeing X tells us about Y.

Rung 2: Intervention

P(Y|do(X)) — What if? Forcing X and observing Y.

Rung 3: Counterfactual

P(Y_x|X=x',Y=y') — What if I had acted differently?
do-Calculus Engine

Graph Surgery

The do-operator do(X=x) simulates an intervention by removing all arrows INTO X, fixing X=x, and computing the resulting distribution.
Select Model
Causal Query
Treatment
Outcome
Identification Criteria
Select a model and run identification
Derivation Steps
Run identification to see steps
do-Calculus Rules

Rule 1: Insertion/deletion of observations

P(y|do(x),z,w) = P(y|do(x),w) if (Y ⊥ Z | X,W) in Ḡ_X

Rule 2: Action/observation exchange

P(y|do(x),do(z),w) = P(y|do(x),z,w) if (Y ⊥ Z | X,W) in Ḡ_X,G_Z̲

Rule 3: Insertion/deletion of actions

P(y|do(x),do(z),w) = P(y|do(x),w) if (Y ⊥ Z | X,W) in Ḡ_X,G_{Z̲(S)}
Result
Causal Discovery

PC Algorithm

Constraint-based causal discovery: starts with a complete graph, removes edges using conditional independence tests, then orients v-structures and applies Meek's rules.
True Model
Parameters
Sample Size500
Significance (α)0.05
Noise Level1.0
Algorithm Phase
Click "Run" to start
Discovery Metrics
SHD (Structural Hamming)
Edge Precision
Edge Recall
Orientation Accuracy
CI Tests Performed
Discovered Graph
Run algorithm to see results
Algorithm Log
Simpson's Paradox

The Paradox

A trend that appears in several groups REVERSES when the groups are combined. Only causal reasoning (not statistics alone) can resolve which analysis is correct.
Dataset
Confounding Strength
Confounder → Treatment0.7
Confounder → Outcome0.8
True Treatment Effect0.1
Sample Size2000
Analysis Results

Marginal (Naive) Analysis

Conditional (Stratified) Analysis

The Causal DAG
ZXYZ

Z (confounder) causes both X (treatment) and Y (outcome). The back-door path X ← Z → Y creates spurious correlation.

Resolution

Condition on Z (the confounder)

The stratified analysis gives the correct causal effect because conditioning on Z blocks the back-door path.

Key Insight

Statistics alone cannot resolve this

Whether to condition on Z depends on the causal structure, not the data. If Z were a collider instead, conditioning would be WRONG.

Instrumental Variables

When Experiments Fail

IVs let us estimate causal effects even with unobserved confounders. An instrument Z must: (1) affect X, (2) affect Y only through X, (3) be independent of confounders U.
Parameters
True Causal Effect (β)0.5
Instrument Strength (π)0.8
Confounding Strength1.0
Sample Size500
Estimation Comparison
True β0.5
OLS (biased)
2SLS (IV)
OLS Bias
2SLS Bias
First-Stage F
2SLS Walkthrough
Stage 1: Regress X on Z
X̂ = π·Z + e
Get predicted values X̂ that are "clean" of confounding
Stage 2: Regress Y on X̂
Y = β·X̂ + ε
β̂_IV = Cov(Z,Y)/Cov(Z,X) — the Wald estimator
Instrument Diagnostics
Run 2SLS to see diagnostics
Monte Carlo Results
Click Monte Carlo to see distribution
Counterfactual Reasoning

Rung 3 of Pearl's Ladder

"Would the patient have recovered if given the treatment, given that they weren't treated and didn't recover?"

This requires the twin network model — two copies of the SCM sharing the same exogenous noise.
Scenario
Model Parameters
P(X=1) Treatment Rate0.5
P(Y=1|X=1) Success w/ Treatment0.8
P(Y=1|X=0) Success w/o Treatment0.4
Monotonicity
Probabilities of Causation
PN (Probability of Necessity)
PS (Probability of Sufficiency)
PNS (Necessity & Sufficiency)
Interpretation

Select a scenario

Choose a preset to explore counterfactual reasoning.

Response Types
Helped
Hurt
Always
Never
Twin Network

How it works

1. Abduction: Use evidence to infer exogenous noise U
2. Action: Modify the model (set X to counterfactual value)
3. Prediction: Compute Y under the modified model with inferred U