Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CausalLab — Interactive Causal Inference & Discovery Laboratory

Live Demo Built with Claude License: MIT

The first interactive web laboratory for Judea Pearl's causal inference framework. Learn, visualize, and experiment with structural causal models, do-calculus, causal discovery algorithms, and counterfactual reasoning — all in-browser with zero dependencies.

6 Interactive Modules

1. SCM Builder

Build structural causal models with a drag-and-drop DAG editor. Define structural equations, check d-separation, identify confounders/mediators/colliders, and enumerate paths. Preset models include confounding, mediation, collider, front-door, IV, and the Napkin problem.

2. do-Calculus Engine

Pearl's 3 rules of do-calculus with step-by-step derivations. Visualize graph surgery (removing incoming edges for the do-operator). Automatic identification via back-door and front-door criteria.

3. Causal Discovery (PC Algorithm)

Run the PC algorithm on simulated data with adjustable sample size, significance level, and noise. Watch the constraint-based skeleton discovery, v-structure orientation, and Meek's rules. Compare true DAG vs discovered graph with SHD, precision, recall metrics.

4. Simpson's Paradox Explorer

Interactive demonstration of how confounding creates paradoxes. Adjust confounder strength and watch the apparent treatment effect reverse. Includes Berkeley admissions and drug trial presets.

5. Instrumental Variables Lab

Estimate causal effects with unobserved confounders using 2SLS. Visual walkthrough of two-stage least squares. Monte Carlo simulations (100 runs). Weak instrument diagnostics with Stock-Yogo threshold.

6. Counterfactual Reasoning

Pearl's Ladder Rung 3: twin network model for computing probabilities of causation (PN, PS, PNS). Drug treatment, hiring bias, and legal liability scenarios. Visualize the abduction-action-prediction workflow.

Why Causal Inference?

"Correlation does not imply causation" — but causal inference tells us what does.

  • MIT Technology Review 2026 lists World Models as the #1 AI trend — causal reasoning is the backbone
  • Judea Pearl won the Turing Award for this work
  • Causal AI is the frontier connecting AI safety, scientific reasoning, and robust decision-making
  • This bridges statistics, philosophy, computer science, and epidemiology

Tech Stack

  • Single HTML file (~94KB), zero dependencies
  • Canvas-based graph rendering
  • Pure JS causal graph algorithms (d-separation, Bayes-Ball, topological sort)
  • PC algorithm with partial correlation CI tests
  • 2SLS instrumental variable estimation
  • Monte Carlo simulation engine
  • Dark theme with responsive design

License

MIT — Built with Claude Code as part of the Daily Webapp series.

About

CausalLab — Interactive Causal Inference & Discovery Laboratory. 6 modules: SCM Builder, do-Calculus, PC Algorithm, Simpson's Paradox, IV Lab, Counterfactuals. Zero dependencies.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages