iv-2sls

Installation
SKILL.md

Instrumental Variables and Two-Stage Least Squares (IV/2SLS)

IV estimation addresses endogeneity — the core challenge in causal inference when the error term is correlated with the regressor of interest. A valid instrument Z must satisfy: (1) Relevance: Cov(Z, X) ≠ 0 (testable), and (2) Exclusion restriction: Cov(Z, u) = 0 (untestable, requires economic reasoning).


Conceptual Framework

The Endogeneity Problem

OLS: y = Xβ + u, but Cov(X, u) ≠ 0 ⟹ E[β̂_OLS] ≠ β.

Sources of endogeneity:

  • Omitted variables (unmeasured ability in earnings equations)
  • Simultaneous causality (price and quantity in supply/demand)
  • Measurement error in X (attenuation bias toward zero)
Installs
8
GitHub Stars
38
First Seen
Mar 30, 2026