HomeData ScienceInstrumental Variables: Untangling a Confounded Cause

Instrumental Variables: Untangling a Confounded Cause

Interactive 3D instrumental-variables simulator: a hidden confounder biases the naive treatment-effect estimate, and a valid instrument recovers the true causal effect via two-stage least squares.

Data Science3DAdvanced60 FPS
ds-topic-73 ↗ Open standalone

Correlation between a treatment X and an outcome Y is not proof that X causes Y — a hidden confounder U can drive both and bias any naive regression. This simulator generates a synthetic cohort where that is exactly what happens, renders it as a live 3D point cloud (X, Y, and the normally-invisible U as depth), and fits two regression lines side by side: the biased naive OLS line, and a two-stage-least-squares line built from a valid instrument Z that moves the treatment without ever touching the outcome directly. Sliders let you dial the true causal effect, the confounding strength, the instrument's strength, and the noise level, while live readouts track the true β against both estimates and the instrument's relevance — the same diagnostic economists and epidemiologists run before trusting an IV study.

⚙ Under the hood

A live 3D point cloud of a confounded cohort shows how a hidden variable biases the naive treatment-effect estimate, and how two-stage least squares with a valid instrument recovers the true causal effect.

causal inferenceinstrumental variables2SLSconfoundingregressiondata science

3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)