Lesson M10.L03: Two-Stage Least Squares (2SLS)
| Field | Detail |
|---|---|
| Module | M10 — Instrumental Variables |
| Level | Graduate (ECMT5001 S1 2027) |
| Duration | 35 min |
| Learning Objective | Implement 2SLS with multiple instruments; understand over-, under-, and exact-identification; correctly interpret first- and second-stage output; avoid the SEs mistake from naive two-step OLS |
| Provenance | Wooldridge, Introductory Econometrics, Ch 15.3–15.4 |
Explanation
Why 2SLS?
The simple IV estimator from M10.L02 handles one endogenous variable with one instrument. In practice, we often have:
- Multiple instruments for one endogenous variable (over-identified)
- Multiple endogenous variables requiring multiple instruments
- Exogenous control variables that must be included in both stages
Two-stage least squares (2SLS) is the general framework that handles all these cases efficiently, combining all instruments optimally.
The 2SLS Procedure
Setup: Structural model with one endogenous regressor \(x\), exogenous controls \(\mathbf{w}\), and instruments \(\mathbf{z}\):
where \(\text{Cov}(x, u) \neq 0\), \(\text{Cov}(\mathbf{w}, u) = 0\), \(\text{Cov}(\mathbf{z}, u) = 0\).
Stage 1: First-Stage Regression
Regress the endogenous variable \(x\) on all instruments \(\mathbf{z}\) and all exogenous controls \(\mathbf{w}\):
Save the fitted values \(\hat{x}\) from this OLS regression. The fitted values represent the "clean" (exogenous) variation in \(x\) — the part driven by instruments.
Important: Include all exogenous controls \(\mathbf{w}\) in Stage 1, even though they're already exogenous. Omitting them leads to misspecification.
Stage 2: Second-Stage Regression
Regress \(y\) on \(\hat{x}\) (from Stage 1) and the exogenous controls \(\mathbf{w}\):
The OLS coefficients from this second regression are the 2SLS estimates \(\hat{\boldsymbol{\beta}}^{\text{2SLS}}\).
Intuition: Stage 2 uses only the variation in \(x\) that is explained by the instruments — the part uncorrelated with \(u\). The endogenous variation (correlated with \(u\)) is "projected out" in Stage 1.
Equivalence to Simple IV
With one instrument and one endogenous variable, 2SLS = IV.
Stage 1: \(\hat{x} = \hat{\pi}_0 + \hat{\pi}_z z\)
Stage 2 coefficient on \(\hat{x}\): \(\hat{\beta}_1^{\text{2SLS}} = \hat{\beta}_1^{\text{IV}} = \widehat{\text{Cov}}(z,y)/\widehat{\text{Cov}}(z,x)\) ✓
The advantage of 2SLS is that it generalises to multiple instruments by projecting \(x\) onto the instrument subspace optimally.
Identification: Under-, Exact-, and Over-Identification
Let:
- \(m\) = number of endogenous regressors
- \(\ell\) = number of instruments (excluded from structural equation)
| Case | Condition | Implication |
|---|---|---|
| Under-identified | \(\ell < m\) | Cannot identify all endogenous coefficients; 2SLS not feasible |
| Exactly identified | \(\ell = m\) | Unique 2SLS solution; cannot test instrument validity |
| Over-identified | \(\ell > m\) | Multiple instruments; 2SLS uses them efficiently; can test exogeneity |
Over-identification is a gift — it provides testable restrictions (Sargan-Hansen \(J\)-test) on instrument validity, and the extra instruments improve efficiency.
The Sargan-Hansen J-Test (Over-Identified Case)
When \(\ell > m\), we can test whether the instruments are jointly exogenous.
Steps:
- Estimate by 2SLS and save residuals \(\hat{u}_t^{\text{2SLS}}\)
- Regress \(\hat{u}_t^{\text{2SLS}}\) on all instruments \(\mathbf{z}\) and exogenous controls \(\mathbf{w}\)
- \(J = n \cdot R^2_{\text{aux}} \xrightarrow{d} \chi^2_{\ell - m}\) under \(H_0\)
- Reject \(H_0\) if \(J > \chi^2_{\ell-m, \alpha}\)
Limitation: The \(J\)-test requires the model to be over-identified (\(\ell > m\)). In the exactly-identified case (\(\ell = m\)), \(J = 0\) identically — you cannot test instrument validity. This is why finding multiple valid instruments is valuable.
Caution: Failing to reject \(H_0\) does NOT confirm instrument validity — it only says the over-identifying restrictions are not rejected. All instruments could be endogenous if they are endogenous in the same direction.
2SLS Standard Errors
2SLS SEs are always larger than OLS SEs — this is the efficiency cost of using IV.
The asymptotic variance of \(\hat{\beta}_1^{\text{2SLS}}\) (simplified for one endogenous variable):
where \(R^2_1\) is the R² from the first-stage regression. Since \(R^2_1 \leq 1\), \(\text{Var}^{\text{2SLS}} \geq \text{Var}^{\text{OLS}}\).
Use robust (heteroskedasticity-consistent) SEs in 2SLS — most software does this by default. Stata: ivregress 2sls ... , robust.
Worked Example
Setup: Estimate the return to education with two instruments.
where exper (work experience) is exogenous. Two instruments:
- \(z_1\): proximity to 4-year college (binary)
- \(z_2\): proximity to 2-year college (binary)
Since \(m = 1\) (one endogenous variable: education) and \(\ell = 2\) (two instruments), this is over-identified (\(\ell - m = 1\) degree of freedom for J-test).
Stage 1: Regress educ on exper, \(z_1\), \(z_2\):
| Variable | \(\hat{\pi}\) | SE | \(t\) |
|---|---|---|---|
| Intercept | 14.32 | 0.58 | 24.7 |
| exper | −0.073 | 0.018 | −4.1 |
| near4yr (\(z_1\)) | 0.442 | 0.107 | 4.13 |
| near2yr (\(z_2\)) | 0.312 | 0.098 | 3.18 |
First-stage F-statistic (joint test of \(\pi_2 = \pi_3 = 0\)): \(F = 12.4 > 10\) → instruments are relevant (not weak).
Stage 2: Regress \(\log(\text{wage})\) on \(\hat{\text{educ}}\), exper:
| Variable | \(\hat{\beta}^{\text{2SLS}}\) | SE (robust) | \(t\) |
|---|---|---|---|
| Intercept | 3.41 | 0.72 | 4.74 |
| educ | 0.129 | 0.047 | 2.74 |
| exper | 0.032 | 0.011 | 2.91 |
Second-stage interpretation: Each additional year of education raises wages by approximately 12.9% (2SLS), compared to an OLS estimate of 4.0%. The 2SLS SE (0.047) is larger than the hypothetical OLS SE, reflecting the efficiency cost.
Sargan-Hansen J-test:
Regress 2SLS residuals on all instruments and controls; \(n \cdot R^2_{\text{aux}} = 2.14\). Critical value \(\chi^2_{1,0.05} = 3.84\).
Since \(2.14 < 3.84\) → fail to reject \(H_0\). Over-identifying restriction not rejected — instruments appear jointly exogenous.
Common Misconception
"2SLS is just running two separate OLS regressions and plugging in predicted values from the first — you can do it manually in two steps."
This gives wrong standard errors. If you manually run Stage 2 with \(\hat{x}\) as a regressor, the Stage 2 residuals are computed as:
These residuals are based on \(\hat{x}\), not \(x\). The Stage 2 OLS formula uses \(\hat{e}\) to estimate \(\sigma^2\), but \(\hat{e}\) is not the correct structural residual \(u = y - \beta_0 - \beta_1 x - \boldsymbol{\beta}_w' \mathbf{w}\). The proper 2SLS variance formula corrects for this substitution — manual two-step OLS does not. Always use a proper 2SLS command (ivregress 2sls in Stata, IV2SLS in statsmodels or linearmodels.IV2SLS in Python).
The coefficient estimates from manual two-step OLS and proper 2SLS are identical; only the SEs differ.
Practice Prompts
-
A researcher has two endogenous variables (education and experience) and three instruments (proximity to college, quarter of birth, and state compulsory schooling laws). Is the model under-, exactly-, or over-identified? How many degrees of freedom does the Sargan-Hansen J-test have?
-
In the worked example, the Sargan-Hansen J-statistic is 2.14. Interpret this result carefully: does it confirm that both instruments are valid? If one instrument were endogenous but both instruments were endogenous in the same direction, would the test detect this?
-
Explain why 2SLS standard errors are always at least as large as OLS standard errors, using the formula \(\text{Var}(\hat{\beta}_1^{\text{2SLS}}) \approx \sigma_u^2 / (n \cdot R^2_1 \cdot \text{Var}(x))\). Under what limiting condition would 2SLS be equally efficient as OLS, and why can that condition never hold in practice for a truly endogenous regressor?
Further Resources
- Wooldridge, Introductory Econometrics (7th ed.), Ch 15.3–15.4
- Angrist, J.D. & Pischke, J.-S. (2009), Mostly Harmless Econometrics, Ch 4.6
- Sargan, J.D. (1958), "The Estimation of Economic Relationships Using Instrumental Variables," Econometrica
- Python:
linearmodels.iv.model.IV2SLS; Stata:ivregress 2sls y (x = z1 z2) w, robust