Day 66. Over-Identification & Instrument Validity
With more instruments than endogenous regressors, the instruments can be checked against each other. The Sargan–Hansen J test, endogeneity (Hausman and control-function) tests, and sensitivity analysis for "plausibly exogenous" instruments, with a clear view of what each can and cannot reveal.
- ●Compute the Sargan statistic as n R² and state its degrees of freedom.
- ●Test whether the regressor is endogenous with the control-function (Durbin–Wu–Hausman) approach.
- ●Prove that over-identification tests have no power against instruments that are invalid in the same direction.
- ●Bound an IV estimate when the exclusion restriction may be slightly violated.
Theory
Over-identifying restrictions
With instruments and endogenous regressors (), the moment conditions are more than needed. If all instruments are valid, every just-identified subset estimates the same (with a constant effect), and the residual should be unrelated to every instrument.
The Sargan–Hansen J test
- Estimate by 2SLS and compute residuals .
- Regress on all instruments (and controls); record .
- under the null that all instruments are valid (homoskedastic errors). Hansen's J, the minimised two-step GMM objective, is the robust version.
What J can and cannot do
- If one instrument is invalid and others valid, J has power to detect the disagreement, but it cannot say which instrument is wrong.
- If all instruments are invalid in the same way (estimates biased by the same amount), J has no power (Exercise 9).
- With heterogeneous effects, valid instruments can identify different LATEs (Day 63), so J can reject even when every instrument is valid.
Is the regressor endogenous?
The Durbin–Wu–Hausman test compares OLS and IV. A convenient regression version is the control function: (1) run the first stage and save the residual ; (2) regress on , controls and . The coefficient on equals 2SLS, and a significant coefficient on rejects exogeneity of .
Plausibly exogenous instruments
If has a small direct effect on , then . Allowing , the union of the IV confidence intervals shifted by gives a sensitivity interval (Conley, Hansen and Rossi). Weak first stages magnify small violations.
Part 1 · Warm-up
Exercise 1 · Degrees of freedom
A model has 2 endogenous regressors and 5 excluded instruments. What are the degrees of freedom of the J test?
Show solution
Step 1. over-identifying restrictions.
Answer: .
Exercise 2 · Computing J
With , regressing the 2SLS residuals on 3 instruments (1 endogenous regressor) gives . Compute J and test at 5% ().
Show solution
Step 1. .
Step 2. : reject (barely).
Answer: the instruments disagree more than chance would explain, at the 5% level.
Exercise 3 · Comparing two just-identified estimates
Two instruments give 0.15 (SE 0.02) and 0.10 (SE 0.04), with approximately independent estimates. Test their equality.
Show solution
Step 1. Difference: 0.05; SE .
Step 2. .
Answer: not rejected; the instruments are statistically compatible.
Exercise 4 · A control-function test
In the regression of on and the first-stage residual , the coefficient on has . What do you conclude?
Show solution
Step 1. : reject that is exogenous.
Answer: OLS and IV differ significantly; use IV (assuming the instrument is valid).
Exercise 5 · Just identified
What is J in a just-identified model, and why?
Show solution
Step 1. With , 2SLS sets exactly (Day 64, Exercise 7).
Step 2. The residuals are orthogonal to all instruments, so and .
Answer: zero: just-identified models have nothing to test.
Part 2 · Proofs
Exercise 6 · J = 0 at an exact fit
Prove that in a just-identified model .
Show solution
Step 1. .
Step 2. .
Step 3. Subtract.
Exercise 7 · The control function reproduces 2SLS
Scalar endogenous , instrument vector , first stage . Prove that in the OLS regression of on and , the coefficient on equals 2SLS.
Show solution
Step 1. By FWL, the coefficient on uses residualised on .
Step 2. is orthogonal to , and , so residualising on gives exactly .
Step 3. The coefficient is , the 2SLS estimator.
Exercise 8 · Disagreement is what J detects
With two instruments (one endogenous regressor), show that if both single-instrument estimands are equal, the population over-identifying restriction holds in the sense that some satisfies both moment conditions.
Show solution
Step 1. Moment conditions: for , i.e. .
Step 2. If both ratios equal the same , then solves both.
Step 3. Conversely, if the ratios differ, no single solves both, and J diverges with .
Exercise 9 · No power against common invalidity
Suppose each instrument has a direct effect proportional to its first stage: . Show that every single-instrument estimand equals , so J has no power.
Show solution
Step 1. From Day 62, Exercise 10: instrument gives .
Step 2. for all , so all estimands equal .
Step 3. By Exercise 8, the moment conditions are jointly satisfied at : J converges to as under validity.
Exercise 10 · Plausibly exogenous bounds
Let with unknown. Show that the IV estimand is and that .
Show solution
Step 1. .
Step 2. Divide by : .
Step 3. , which ranges over the stated interval as ranges over .
Part 3 · Applied
Exercise 11 · Two instruments for schooling
Day 64's instruments give single-instrument returns of 0.15 (SE 0.02, the quarter-of-birth indicator) and 0.10 (SE 0.04, the schooling-law indicator). Is there evidence of invalidity? What else could explain a difference?
Show solution
Step 1. By Exercise 3, : no significant disagreement.
Step 2. Even a significant difference could reflect different LATEs: compulsory-schooling laws affect students at risk of dropping out, while quarter of birth matters for others.
Answer: no evidence against validity; and disagreement would not prove invalidity.
Exercise 12 · One bad instrument in a simulation
In the simulation below, two instruments are valid when the second's direct effect is 0, and the second is invalid when its direct effect is 0.05 or 0.10. How do the 2SLS estimate (truth 0.5) and the J test's rejection rate change?
Show solution
Step 1. Direct effect 0: 2SLS ≈ 0.50 and J rejects about 5% of the time (correct size).
Step 2. Direct effect 0.05: 2SLS ≈ 0.58; J rejects about 22%.
Step 3. Direct effect 0.10: 2SLS ≈ 0.67; J rejects about 65%.
Answer: J detects the bad instrument only part of the time, while the bias is already substantial: failing to reject is weak evidence of validity.
Exercise 13 · Is insurance endogenous?
Using the Oregon-style lottery (Day 62), the control-function regression of ER visits on insurance and the first-stage residual gives a residual coefficient of −0.3 (SE 0.1). Interpret.
Show solution
Step 1. : insurance is endogenous.
Step 2. The negative sign means that, holding insurance fixed, unobservables that raise insurance take-up lower ER visits (for example, people who sign up for insurance are healthier or better organised).
Answer: OLS of ER visits on insurance would understate the effect; IV is preferred.
Exercise 14 · Plausibly exogenous college proximity
Distance to college might affect wages directly (urban labour markets). Allow the direct effect on log wages to be between −0.01 and 0.01, with first stage 0.32 and IV estimate 0.131 (95% CI [0.05, 0.21]). Compute the sensitivity interval.
Show solution
Step 1. Shift: .
Step 2. Union of shifted intervals: .
Answer: the return stays positive, but the range widens considerably; a weaker first stage would widen it more.
Exercise 15 · Rejection with valid instruments
A study of the effect of child care subsidies on maternal employment uses two valid instruments: a lottery for subsidised places and the birth date cutoff for kindergarten eligibility. J rejects strongly. Give an explanation consistent with validity and what to report.
Show solution
Step 1. The lottery's compliers are mothers who applied (motivated to work); the birth-date compliers are all mothers of children near the cutoff.
Step 2. With heterogeneous effects, the two LATEs differ, so a constant-effect J test rejects.
Answer: report the two estimates separately, describe each set of compliers (Day 63), and avoid pooling them into one 2SLS number.
Verify in Python
import numpy as np
from scipy import stats
rng = np.random.default_rng(66); n = 1000
def tsls(y, X, Z):
Xh = Z @ np.linalg.lstsq(Z, X, rcond=None)[0]
return np.linalg.solve(Xh.T @ Xh, Xh.T @ y)
print("direct effect J rejection mean 2SLS (truth 0.5)")
for d in (0, .05, .10):
rej, est = 0, []
for _ in range(1000):
Z = rng.normal(size=(n, 2)); u = rng.normal(size=n); v = .5 * u + rng.normal(size=n)
x = Z @ [.3, .3] + v; y = 1 + .5 * x + d * Z[:, 1] + u
X = np.column_stack([np.ones(n), x]); ZZ = np.column_stack([np.ones(n), Z])
b = tsls(y, X, ZZ); r = y - X @ b
g = np.linalg.lstsq(ZZ, r, rcond=None)[0]
R2 = 1 - ((r - ZZ @ g) @ (r - ZZ @ g)) / ((r - r.mean()) @ (r - r.mean()))
rej += n * R2 > stats.chi2.ppf(.95, 1); est.append(b[1])
print(f"{d:13.2f} {rej / 1000:11.3f} {np.mean(est):.3f}")
# Exercise 7: the control function reproduces 2SLS
Z = rng.normal(size=(n, 2)); u = rng.normal(size=n); x = Z @ [.3, .3] + .5 * u + rng.normal(size=n); y = .5 * x + u
ZZ = np.column_stack([np.ones(n), Z]); vhat = x - ZZ @ np.linalg.lstsq(ZZ, x, rcond=None)[0]
cf = np.linalg.lstsq(np.column_stack([np.ones(n), x, vhat]), y, rcond=None)[0]
print("control function:", cf[1].round(5), " 2SLS:", tsls(y, np.column_stack([np.ones(n), x]), ZZ)[1].round(5), " residual coef:", cf[2].round(3))
# Exercises 2, 3 and 14
print("J:", 1000 * .006, "crit", round(stats.chi2.ppf(.95, 2), 2), "| z:", round(.05 / np.sqrt(.02**2 + .04**2), 2),
"| sensitivity interval:", np.round([.05 - .01 / .32, .21 + .01 / .32], 3))
Key takeaways
- With extra instruments, J = nR² tests whether the instruments agree; it cannot identify which is wrong and has no power when all are wrong in the same way.
- The control-function regression reproduces 2SLS and tests whether OLS is biased.
- With heterogeneous effects, disagreement can reflect different LATEs; sensitivity intervals show how much a small exclusion violation matters.
Simulation Lab: Over-Identification & the J Test
Open full screen →Give one instrument a direct effect and see the estimates drift and the J test catch it only sometimes.
Two instruments for one endogenous regressor (true effect 0.5); 400 simulated studies of 500 observations. Give instrument 2 a direct effect on the outcome and watch its estimate drift, 2SLS follow it, and the J test reject only some of the time.