Instrumental Variables — IV Estimation
Statistics
Isolating Exogenous Variation to Solve Endogeneity
Instrumental variables exploit external variation that affects the treatment but not the outcome directly. Two-stage least squares uses this exogenous variation to produce consistent causal estimates even when OLS fails.
-
Economics — Estimate returns to education using quarter of birth as an instrument
-
Healthcare — Assess treatment effects when?? assignment is non-random
-
Political Science — Evaluate policy impacts with institutional instruments
A valid instrument creates a natural experiment that breaks the correlation between treatment and error.
Instrumental variables (IV) methods address endogeneity — when a covariate is correlated with the error term. IV uses an external variable (the instrument) to isolate exogenous variation in the treatment.
The IV Approach
Required Conditions
Relevance
The instrument must be strongly correlated with the endogenous variable.
Exogeneity (Exclusion Restriction)
The instrument must be uncorrelated with the error term — it affects only through .
Two-Stage Least Squares (2SLS)
The most common IV estimation method.
Stage 1
Regress on (and any exogenous covariates):
Stage 2
Regress on :
IV Estimator Formula
Weak Instruments
Testing for Weak Instruments
| F-statistic | Interpretation |
|------------|---------------|
| F > 10 | Rule of thumb: instrument is strong |
| F < 10 | Potentially weak; use weak-IV robust methods |
Overidentification
When you have more instruments than endogenous variables, you can test whether the instruments are valid.
| Decision | Interpretation |
|---------|---------------|
| Reject | At least one instrument is invalid |
| Fail to reject | Instruments are jointly valid |
Hausman Test for Endogeneity
If is rejected, endogeneity is present and IV is preferred.
Python Implementation
import numpy as np
import pandas as pd
import statsmodels.api as sm
from linearmodels.iv import IV2SLS
import matplotlib.pyplot as plt
np.random.seed(42)
# Simulate endogeneity
n = 1000
Z = np.random.randn(n) # Instrument
U = np.random.randn(n) # Unobserved confounder
X = 0.8 * Z + 0.5 * U + np.random.randn(n) * 0.5 # Endogenous
Y = 2.0 * X + 1.5 * U + np.random.randn(n) # Outcome
# Naive OLS (biased)
ols = sm.OLS(Y, sm.add_constant(X)).fit()
print(f"OLS estimate: {ols.params[1]:.3f} (true: 2.0)")
# IV/2SLS
iv_model = IV2SLS.from_formula('Y ~ 1 + [X ~ Z]',
data=pd.DataFrame({'Y': Y, 'X': X, 'Z': Z})).fit()
print(f"IV estimate: {iv_model.params['X']:.3f} (true: 2.0)")
# First-stage F-stat
first_stage = sm.OLS(X, sm.add_constant(Z)).fit()
f_stat = first_stage.fvalue
print(f"\nFirst-stage F-statistic: {f_stat:.1f}")
print(f"Weak instrument: {'Yes' if f_stat < 10 else 'No'}")
# Hausman test
diff = ols.params[1] - iv_model.params['X']
var_diff = ols.bse[1]**2 - iv_model.std_errors['X']**2
hausman_stat = diff**2 / var_diff
print(f"\nHausman test: {hausman_stat:.3f} (p ~ {1 - stats.chi2.cdf(hausman_stat, 1):.3f})")
Worked Example
Key Takeaways
Related Topics
-
See Causal Inference for the potential outcomes framework
-
See Regression Discontinuity for another quasi-experimental method
-
See Difference-in-Differences for policy evaluation
Extended Learning: Beyond the Basics
Key Concepts Summary
This lesson covers fundamental concepts that serve as building blocks for more advanced topics. Master these basics before moving to intermediate and advanced material.
Prerequisite Knowledge
Before studying this topic in depth, ensure you understand:
- Basic definitions and terminology
- Core formulas and their derivations
- Common applications in real-world scenarios
- Typical pitfalls and misconceptions
Step-by-Step Walkthrough
Let us work through a complete example to solidify understanding:
Step 1: Identify the problem type. Determine which category this problem falls into and which approach is most appropriate.
Step 2: Apply the relevant formula. Substitute known values into the appropriate equation, paying attention to units and constraints.
Step 3: Simplify and solve. Work through the algebra step by step, checking each intermediate result.
Step 4: Verify the answer. Check that the solution satisfies the original conditions and makes logical sense.
Common Mistakes to Avoid
- Misidentifying the problem type — Always start by categorizing the problem
- Incorrect formula application — Verify the formula applies to your specific case
- Unit errors — Always check units are consistent throughout
- Sign errors — Pay careful attention to positive and negative values
- Rounding too early — Keep full precision until the final answer
- Forgetting constraints — Check that solutions satisfy all given conditions
Real-World Applications
Understanding this concept is essential for:
- Advanced problem solving in examinations
- Building intuition for more complex topics
- Developing analytical thinking skills
- Applying mathematical reasoning to practical situations
Practice Exercises
- Basic: Solve 5 problems of increasing difficulty using the core concept.
- Intermediate: Apply the concept to word problems with multiple steps.
- Advanced: Combine this concept with 2-3 other topics in a comprehensive problem.
- Challenge: Create your own problem that requires this concept plus additional knowledge.
Interview and Exam Tips
- Common question patterns: Identify which exam or interview formats test this topic
- Time management: Practice completing problems within time constraints
- Common traps: Know the typical mistakes examiners set as distractors
- Verification strategy: Develop a quick method to check your answer
Related Topics
- Previous Topic — Build on the foundation laid here
- Next Topic — See how this concept extends to more advanced material
- Practice Problems — Additional exercises with solutions
- Video Explanation — Visual walkthrough of key concepts
Quick Reference Card
| Concept | Formula/Rule | Key Insight | Common Use |
|---|---|---|---|
| Core Definition | See main text | Understand the intuition | Foundation for all applications |
| Key Formula | See main text | Memorize the derivation | Direct problem solving |
| Special Case | See main text | Recognize when it applies | Simplifies complex problems |
| Edge Case | See main text | Know the limitations | Avoids errors |
Further Reading
For students who want to go deeper:
- Standard textbooks on the subject
- Research papers applying this concept
- Online courses with video explanations
- Practice problem collections with detailed solutions