Day 61. Endogeneity & the Instrumental-Variables Idea
When the regressor is correlated with the error, OLS is biased whatever the sample size. Omitted variables, measurement error and simultaneity are the three classic causes. An instrument moves the regressor but touches the outcome only through it, and the ratio of two covariances recovers the causal effect.
- ●Diagnose omitted-variable bias, attenuation from measurement error and simultaneity bias, and derive each probability limit.
- ●State the instrumental-variable conditions (relevance, independence, exclusion) and draw them as a DAG.
- ●Compute the IV estimate as reduced form divided by first stage.
- ●Judge candidate instruments in labour, health and industrial-organisation settings.
Theory
Endogeneity
In , OLS estimates consistently only if . Otherwise is endogenous and
More data do not help: the bias does not shrink with .
Three sources
- Omitted variables. If with unobserved, the bias is (Day 50).
- Measurement error. If we observe with classical error , OLS is attenuated: , with reliability .
- Simultaneity. Price and quantity are set jointly by supply and demand; the OLS slope mixes the two curves.
Instruments
A variable is a valid instrument for if
- Relevance: ;
- Independence: is as good as randomly assigned (no common cause with );
- Exclusion: affects only through .
Conditions 2 and 3 together give . As a DAG: , , , with no arrow from to or from to .
The IV estimand
Take covariances of with : . So
where the first stage is the slope of on and the reduced form the slope of on . Intuition: the instrument shifts by the first stage and, through alone, shifts by the reduced form; the ratio is the effect per unit of .
What linearity buys
Day 56 showed that the instrument DAG does not identify nonparametrically. With a constant linear effect it identifies . With heterogeneous effects and a binary treatment it identifies a local effect for compliers (Day 63).
Classic instruments
Quarter of birth for schooling (compulsory-schooling laws); distance to a college; draft lottery numbers for military service; weather for agricultural supply; judge leniency for incarceration; lotteries for school places or health insurance.
Part 1 · Warm-up
Exercise 1 · Name the endogeneity
Which source of endogeneity dominates? (a) Regressing wages on years of schooling without ability. (b) Regressing health on self-reported income. (c) Regressing quantity of coffee sold on its price across months.
Show solution
Step 1. (a) Omitted variable: ability raises both schooling and wages.
Step 2. (b) Measurement error: reported income is noisy (also reverse causality from health to income).
Step 3. (c) Simultaneity: price and quantity are jointly determined by supply and demand.
Exercise 2 · Attenuation
True , measurement-error variance 1, true slope 0.5. What does OLS estimate?
Show solution
Step 1. Reliability: .
Step 2. .
Answer: 0.4, a 20% underestimate.
Exercise 3 · The covariance ratio
and . Compute .
Show solution
Step 1. .
Exercise 4 · Reduced form over first stage
A regression of on gives 0.06; of on gives 0.4. Compute the IV estimate.
Show solution
Step 1. Both slopes share the denominator , which cancels in the ratio.
Step 2. .
Exercise 5 · Check the conditions
For each candidate instrument, which condition is most doubtful? (a) Rainfall as an instrument for farm income in a regression of child health on income. (b) Number of siblings for schooling. (c) A randomised offer of a training voucher for training participation.
Show solution
Step 1. (a) Exclusion: rainfall also affects health directly (malaria, water quality).
Step 2. (b) Independence: family size is chosen and correlated with parental resources.
Step 3. (c) Relevance is testable, independence is guaranteed by randomisation; exclusion is plausible if the offer itself does not change behaviour except through training.
Part 2 · Proofs
Exercise 6 · Omitted-variable bias
Let with uncorrelated with . Prove for the short regression.
Show solution
Step 1. by the LLN.
Step 2. .
Step 3. Divide by .
Exercise 7 · Attenuation bias
Let and , with independent of and mean 0. Prove .
Show solution
Step 1. .
Step 2. .
Step 3. Ratio: .
Exercise 8 · Simultaneity bias
Demand and supply (), with independent shocks of variances . Prove the OLS slope of on converges to .
Show solution
Step 1. Equilibrium: , so .
Step 2. .
Step 3. and .
Step 4. Ratio as stated. OLS is a variance-weighted mix of the supply slope and the demand slope .
Exercise 9 · IV is consistent
With , and , prove .
Show solution
Step 1. Sample covariances converge to population ones (LLN).
Step 2. .
Step 3. By the continuous mapping theorem (denominator non-zero), the ratio converges to .
Exercise 10 · A second measurement as an instrument
Two independent noisy measurements and are available. Prove that IV with as the regressor and as the instrument is consistent for in .
Show solution
Step 1. Write : the error includes .
Step 2. , since are independent of and .
Step 3. .
Step 4. By Exercise 9, IV converges to .
Part 3 · Applied
Exercise 11 · College proximity and the return to schooling
In a stylised version of Card's study, growing up near a four-year college raises schooling by 0.32 years (first stage) and log wages by 0.042 (reduced form). OLS gives 0.075. Compute the IV return and interpret the gap.
Show solution
Step 1. .
Step 2. IV exceeds OLS (13.1% versus 7.5% per year).
Step 3. Possible reasons: measurement error attenuates OLS; the compliers (people whose schooling depends on proximity) may have high returns but face high costs (Day 63).
Answer: about 13% per year. A larger IV than OLS is common in this literature and does not by itself mean ability bias is negative.
Exercise 12 · The demand for fish
At a wholesale fish market, stormy weather at sea reduces the catch (a supply shifter) but does not affect buyers' demand. On stormy days log price is 0.30 higher and log quantity 0.36 lower than on calm days. Estimate the price elasticity of demand. Why not regress quantity on price?
Show solution
Step 1. Weather shifts supply along a fixed demand curve, tracing out its slope.
Step 2. .
Step 3. OLS on price mixes supply and demand responses (Exercise 8).
Answer: demand elasticity about −1.2: a 1% price rise lowers the quantity demanded by 1.2%.
Exercise 13 · Self-reported calories
A nutrition survey regresses weight gain on self-reported daily calories. True intake has variance 160,000 kcal², reporting error variance 90,000 kcal². If each extra kcal per day truly adds 0.002 kg per month, what does OLS find? Suggest a fix.
Show solution
Step 1. .
Step 2. kg per kcal per month.
Step 3. Fix: a second, independent measure (food diary or doubly labelled water) as an instrument (Exercise 10).
Answer: OLS understates the effect by 36%.
Exercise 14 · Rainfall, income and child health
An analyst instruments household income with rainfall in a regression of child height on income. Suppose rainfall also improves child health directly (cleaner water) by 0.02 sd per unit, and raises income by 0.1 units per unit of rainfall. By how much is the IV estimate biased?
Show solution
Step 1. With a direct effect of on : .
Step 2. So , where is the first-stage slope.
Step 3. Bias sd per unit of income.
Answer: a small exclusion violation becomes a large bias when the first stage is weak.
Exercise 15 · The Vietnam draft lottery
Draft eligibility was determined by a lottery on birth dates. Evaluate the three IV conditions for estimating the effect of military service on later earnings.
Show solution
Step 1. Relevance: eligible men served more often (testable: the first stage is about 15 points).
Step 2. Independence: the lottery was random.
Step 3. Exclusion: eligibility could affect earnings other than through service, for example by encouraging men to stay in school to obtain deferments.
Answer: relevance and independence hold; exclusion needs argument and checks (e.g. schooling of eligible versus ineligible men).
Verify in Python
import numpy as np
rng = np.random.default_rng(61); n = 1_000_000
slope = lambda y, x: np.cov(x, y)[0, 1] / np.var(x, ddof=1)
iv = lambda y, x, z: np.cov(z, y)[0, 1] / np.cov(z, x)[0, 1]
# Omitted ability, with an instrument (true effect 0.08)
A = rng.normal(size=n); Z = rng.normal(size=n)
S = 0.3 * Z + 2 * A + rng.normal(0, 2, n)
W = 0.08 * S + 0.10 * A + rng.normal(0, .3, n)
print(f"schooling: OLS {slope(W, S):.4f} IV {iv(W, S, Z):.4f} (truth 0.08)")
# Measurement error: Exercise 2 and a second measurement as instrument
Xs = rng.normal(0, 2, n); Y = .5 * Xs + rng.normal(size=n)
X1 = Xs + rng.normal(size=n); X2 = Xs + rng.normal(size=n)
print(f"attenuation: OLS {slope(Y, X1):.3f} (0.4) IV with second measure {iv(Y, X1, X2):.3f} (0.5)")
# Simultaneity: Exercise 8 with b = 1.2, s = 0.8, sd_d = sd_s = 1, and a supply shifter (weather)
b, s = 1.2, .8
ud = rng.normal(size=n); storm = rng.normal(size=n); us = rng.normal(size=n) - 0.5 * storm
P = (ud - us) / (b + s); Q = -b * P + ud
print(f"market: OLS {slope(Q, P):.3f} (formula {(s * 1 - b * 1.25) / (1 + 1.25):.3f}) IV demand slope {iv(Q, P, storm):.3f} (truth -1.2)")
# Exercises 11-14
print("college IV:", round(.042 / .32, 3), " fish elasticity:", -.36 / .30, " calories:", .64 * .002, " rainfall bias:", round(.02 / .1, 3))
Key takeaways
- Endogeneity () comes from omitted variables, measurement error or simultaneity, and does not vanish with more data.
- An instrument must move the treatment (relevance), be as good as random (independence) and act only through the treatment (exclusion).
- = reduced form ÷ first stage; small exclusion violations are magnified by weak first stages.
Simulation Lab: Endogeneity & the IV Idea
Open full screen →Ability bias and measurement error push OLS off the truth; an instrument's group means recover the return to schooling.
Simulated workers: ability raises both schooling and log wages (true return 0.08). Living near a college (the instrument) raises schooling but has no other route to wages. OLS (orange) absorbs ability bias and measurement-error attenuation; IV (green) uses only the schooling differences created by the instrument: the slope through the two group means (large dots).