এই বইটি এখনো বাংলা ভাষায় পাওয়া যায় না। সংস্করণ: English।
University Economics — Year 3 · স্নাতক তৃতীয় বর্ষ
1Instrumental Variables
Countries that trade more are richer. In 2019, across 157 countries, a least-squares line through the logarithm of output per worker and the logarithm of the trade share says that ten per cent more trade comes with about eight per cent more output. Nobody can read that slope as the effect of trade. Rich countries can afford ports, roads and the institutions that make trading cheap, so income may cause trade as much as trade causes income, and whatever makes a country productive may make it open too. The Year 2 volume met the same trap in a single equation and called it omitted-variable bias. This chapter is about the oldest way out of it: find something that moves the cause and touches the outcome through no other channel. For trade, that something can be geography. A country cannot choose its distance from its neighbours, and distance, population and shared borders predict a good part of who trades with whom.
Each dot is a country. The horizontal position is not a measurement of trade: it is what a regression that knows only distances, borders and populations predicts that country’s trade to be. The vertical position is the trade the country actually did. The cloud slopes up. A country whose geography predicts ten per cent more trade trades, on average, about 2.4 per cent more
(slope 0.235, standard error 0.058), and the statistic of that slope is 16.7. The cloud is wide: Fiji, far from everyone, trades more than its geography predicts, and Singapore and Hong Kong trade far more, because they re-export what passes through their ports. Congo is the other extreme: its capital faces Kinshasa across a river, so its predicted share is huge.
That upward slope is the first of two things an instrument needs. The second cannot be seen on any chart, and most of this chapter is about it.
You already know
The Year 2 volume wrote the multiple regression , solved the normal equations, , and proved that OLS is consistent when . When a regressor that matters is left in the error, : omitted-variable bias. It also defined potential outcomes and , the average treatment effect, selection bias, natural experiments, classical measurement error and its attenuation bias, the statistic and heteroskedasticity-robust standard errors. The Year 1 volume posed the identification problem: a cloud of prices and quantities is not a curve.
Notation 1.1 (Symbols of this chapter)
In this chapter is an instrument and the matrix of instruments, the number of columns of , and the matrix of exogenous controls (not a nominal wage). A first-stage coefficient is written , and , are shares of compliance types: none of them is inflation. is a binary treatment (in a diagram, the curve is still a demand curve); is years of schooling and ability. In the supply-and-demand example, , , and are the curves’ coefficients, not a capital share.
1.1 Endogenous regressors
Throughout this section the model is the simple linear regression
with independent and identically distributed draws. The coefficient is a causal effect: the change in that a unit change in would cause with held fixed. The question is whether OLS recovers it.
Definition 1.2 (Endogenous regressor)
In model (1.1), the regressor is an endogenous regressor when , and an exogenous regressor when .
The word is borrowed from the Year 1 volume’s models, where an endogenous variable is one the model solves for. Here it means something narrower: a regressor correlated with the error. The two senses meet in the first of three classic cases.
- Simultaneity. In a market, the price and the quantity are both solved for by supply and demand. A regression of quantity on price mixes the two curves, which is the Year 1 volume’s identification problem in a regression’s clothes. The end of Section 1.3 draws it.
- Omitted variables. A worker’s ability raises both her schooling and her wage. If ability is not measured, it sits in , and schooling is correlated with . This is ability bias.
- Measurement error. If schooling is recorded with a classical error, the recorded value is correlated with the error of the regression on the recorded value, and OLS is attenuated towards zero.
In each case OLS converges to the wrong number. With ,
and the second term is the bias. No amount of data removes it: a larger sample only estimates the wrong number more precisely.
A simulated town
A simulation shows the size of the problem when the truth is known. In Listing 1.1, ability is a standard normal variable that the economist never sees. Schooling is twelve years, plus one year per standard deviation of ability, plus of a year for people who grew up near a college, plus noise. The log wage rises by per year of school, the true return, and by per standard deviation of ability.
"""A simulated town: schooling, earnings, and an ability nobody records."""
import numpy as np
def draw(n, seed, pull=0.8):
rng = np.random.default_rng(seed)
ability = rng.normal(0, 1, n) # unseen by the economist
near = rng.integers(0, 2, n) # 1 if a college is near home
school = 12 + pull * near + 1.0 * ability + rng.normal(0, 1, n)
log_wage = 1.5 + 0.08 * school + 0.10 * ability + rng.normal(0, 0.3, n)
return {"ability": ability, "near": near, "school": school,
"log_wage": log_wage}
"""Ability bias: OLS overstates the return to schooling when ability is unseen."""
import numpy as np
from schooling_data import draw
def slope(x, y):
return np.cov(x, y)[0, 1] / np.var(x, ddof=1)
d = draw(n=10_000, seed=1)
school, log_wage = d["school"], d["log_wage"]
print(f"true return to a year {0.08:.4f}")
print(f"OLS slope {slope(school, log_wage):.4f}")
# the omitted-variable formula: beta + gamma * (slope of ability on school)
print(f"0.08 + 0.10 * slope(a, s) {0.08 + 0.10 * slope(school, d['ability']):.4f}")
$ python ability_bias.py
true return to a year 0.0800
OLS slope 0.1259
0.08 + 0.10 * slope(a, s) 0.1266
The OLS slope is 0.1259 against a true 0.08. The formula of the Year 2 volume predicts the gap. The variance of schooling is and its covariance with ability is 1, so the limit of OLS is . A regression with more controls would not help unless one of them were ability itself. What helps is a variable that moves schooling for reasons that have nothing to do with ability. Growing up near a college is such a variable in this town, by construction.
1.2 The instrument and the Wald estimator
Definition 1.3 (Instrumental variable)
In model (1.1), a variable is an instrumental variable (an instrument) for when it satisfies two conditions:
- the relevance condition, ;
- the exclusion restriction, : the instrument is uncorrelated with every other cause of , so it affects only through .
Relevance is a statement about two observed variables and can be checked; the opening chart checks it for geography. The exclusion restriction is a statement about , which is never observed. It is argued, not tested, and every application of the method stands or falls on that argument. The argument has two halves. The instrument must be as good as randomly assigned, so that it is not correlated with the unobserved causes; and it must have no path to of its own.
Proposition 1.4 (Consistency of the instrumental-variables estimator)
Let be an instrument for in model (1.1), and let
Then . If the exclusion restriction fails, .
Proof. Substitute in the numerator:
By the law of large numbers the sample covariances converge in probability to and . The second is not zero by relevance, so the ratio converges to (a continuous function of the two limits). It is zero under the exclusion restriction. ∎
The second sentence of the proposition is the one to remember. A failure of the exclusion restriction, , is divided by the strength of the first stage, . With a strong instrument a small violation does small harm. With a weak one, the same small violation is magnified: Section 1.4 returns to it.
When the instrument takes two values, as an offer, a lottery or a birth date before or after a cut-off does, the estimator has a simple form.
Definition 1.5 (Wald estimator)
When the instrument is binary, the Wald estimator is the ratio of the difference in mean outcomes to the difference in mean regressors between the two groups:
where and are the sample means among the observations with .
Proposition 1.6 (The Wald estimator is the IV estimator)
With a binary instrument, .
Proof. Let observations have and have , and let , so . For any variable ,
using , then and . Apply this with and ; the factor cancels in the ratio. ∎
Example 1.7 (The Wald estimate of the return to schooling, from four means)
In the United States, a child must usually start school in the calendar year in which she turns six and may leave on her sixteenth or seventeenth birthday. A child born in January therefore reaches the leaving age with a little less schooling than a child born in December. Angrist and Krueger (1991) used the quarter of birth as an instrument for years of education. Their published means for 327,509 men born 1930–1939, from the 1980 census, are:
| Born in quarter 1 | Born in quarters 2–4 | Difference (s.e.) | |
|---|---|---|---|
| Log weekly wage | 5.8916 | 5.9027 | (0.00274) |
| Years of education | 12.6881 | 12.7969 | (0.0132) |
The Wald estimate is : one more year of schooling raises the weekly wage by about ten log points. The authors report it with a standard error of 0.0239, against an OLS estimate of 0.0709 (0.0003) in the same sample. The ratio uses only the two differences. Every unobserved cause of wages that is spread evenly over birth dates cancels from both.
The instrumental-variables estimate is larger than OLS, not smaller, though ability bias pushes OLS up. Two readings compete. Measurement error in reported schooling pulls OLS down, and the instrument corrects that too. Or the men moved by compulsory schooling laws, who leave as soon as they may, have a higher return to a year than the average man. Section 1.5 makes the second reading exact.
1.3 Two-stage least squares
Applied work rarely has one instrument and no controls. Write the model in matrix form,
where is and holds the constant, the exogenous controls and the endogenous regressors. Let be , holding the constant, the same exogenous controls (each is its own instrument) and the excluded instruments, the variables that appear in but not in . The conditions of the definition become (exclusion and exogeneity of the controls) and (relevance), which requires : at least as many excluded instruments as endogenous regressors. With the model is just identified; with it is over-identified. Let , the matrix that projects on the columns of ; it is symmetric and idempotent, .
Definition 1.8 (First stage, reduced form, two-stage least squares)
In model (1.2) with instruments :
- the first stage is the regression of each endogenous regressor on all the columns of ; its fitted values are (the exogenous columns of are their own fitted values);
- the reduced form is the regression of on all the columns of ;
the two-stage least squares (2SLS) estimator is
Proposition 1.9 (What two-stage least squares does)
- is the OLS coefficient of on the first-stage fitted values .
- If and is invertible, ; with one regressor and a constant this is the estimator of Proposition 1.4.
- If and the rank condition holds, is consistent.
Proof. (1) OLS of on is . Since is symmetric and idempotent, and . (2) With , is square and invertible, so has the inverse . Multiply by : the factors and cancel and leave . With and , solving the two equations gives the ratio of covariances. (3) Substitute :
Each sample moment converges to its expectation; , and the matrix in brackets converges to an invertible limit by the rank condition. The product converges to zero. ∎
The name comes from part (1): regress each endogenous regressor on the instruments, then regress on the fitted values. Done literally, the second step gives the right coefficients and the wrong standard errors, because its residuals are , while the error of the model is , with the actual regressor. Under homoskedasticity the variance is estimated by
and the heteroskedasticity-robust version replaces by inside the sandwich of the Year 2 volume. The estimator is asymptotically normal with this variance.
Proof. Admitted at this level. ∎
A proof follows the Year 2 volume’s proof for OLS, with in the place of ; graduate texts on econometrics give it with the conditions on the moments of .
Listing 1.3 computes everything by hand on the simulated town, with the college nearby as the instrument.
"""The Wald ratio and two-stage least squares, by hand, on the simulated town."""
import numpy as np
from schooling_data import draw
d = draw(n=10_000, seed=1)
y, x, z = d["log_wage"], d["school"], d["near"]
n = len(y)
first = x[z == 1].mean() - x[z == 0].mean() # first stage
reduced = y[z == 1].mean() - y[z == 0].mean() # reduced form
print(f"first stage {first:.4f}")
print(f"reduced form {reduced:.4f}")
print(f"Wald ratio {reduced / first:.4f}")
X = np.column_stack([np.ones(n), x]) # regressors
Z = np.column_stack([np.ones(n), z]) # instruments
X_hat = Z @ np.linalg.solve(Z.T @ Z, Z.T @ X) # fitted first stage
beta = np.linalg.solve(X_hat.T @ X, X_hat.T @ y)
print(f"2SLS slope {beta[1]:.4f}")
A_inv = np.linalg.inv(X_hat.T @ X_hat)
u = y - X @ beta # residual with actual x
u_naive = y - X_hat @ beta # residual with fitted x
se = np.sqrt(u @ u / (n - 2) * A_inv[1, 1])
se_naive = np.sqrt(u_naive @ u_naive / (n - 2) * A_inv[1, 1])
print(f"2SLS s.e. {se:.4f}")
print(f"naive s.e. {se_naive:.4f} (OLS on the fitted x)")
pi = np.linalg.lstsq(Z, x, rcond=None)[0] # first-stage coefficients
v = x - Z @ pi
se_pi = np.sqrt(v @ v / (n - 2) * np.linalg.inv(Z.T @ Z)[1, 1])
print(f"first-stage F {(pi[1] / se_pi) ** 2:.1f}")
$ python tsls_by_hand.py
first stage 0.7811
reduced form 0.0610
Wald ratio 0.0781
2SLS slope 0.0781
2SLS s.e. 0.0081
naive s.e. 0.0091 (OLS on the fitted x)
first-stage F 782.1
The four group means give a first stage of 0.7811 years and a reduced form of 0.0610 log points. Their ratio, 0.0781, is also the 2SLS slope, to every digit printed, as Proposition 1.9 says it must be; it lies within one standard error (0.0081) of the true 0.08, where OLS gave 0.1259.
The naive standard error, 0.0091, is wrong by about an eighth. In real data the gap can go either way and be much larger; no applied paper reports it, and no reader should compute 2SLS in two literal steps.
More instruments than regressors
When , each subset of instruments gives its own just-identified estimate, and 2SLS combines them, weighting each instrument by how much of the regressor it predicts. If all the instruments are valid, the estimates differ only by sampling error. The over-identification test (Sargan’s test) asks whether they do: it regresses the 2SLS residuals on and compares with a distribution. The test can reject a set of instruments that disagree. It can never accept the exclusion restriction: if all the instruments share the same violation, they agree on the same wrong number. It also assumes that every instrument estimates the same effect, which Section 1.5 will drop.
Simultaneity in supply and demand
The oldest use of instruments is the market of the Year 1 volume. A demand curve and a supply curve , where is the weather in the growing region, are solved together for the price and the quantity. Both depend on both errors, so price is an endogenous regressor in either equation. Weather moves the supply curve and, being weather, nothing else. It is excluded from the demand equation, and it is relevant to price. The equilibria it generates slide along a fixed demand curve, and the Wald ratio of the change in quantity to the change in price, between good and bad seasons, is the slope of demand, . A shifter of supply identifies demand; a shifter of demand would identify supply.
1.4 Weak instruments
Proposition 1.4 is a statement about the limit. In a finite sample, the denominator of the IV estimator, the sample covariance of and , is itself noisy. When its true value is small, the noise dominates.
Definition 1.10 (Weak instrument)
An instrument is a weak instrument when the first stage explains so little of the endogenous regressor that the sampling distribution of the 2SLS estimator is far from its normal approximation. In practice an instrument is called weak when the statistic of the excluded instruments in the first stage is small; How it is measured below gives the thresholds.
The mechanism is visible in the just-identified case. Write the first stage as , where the error is correlated with (that correlation is why is endogenous). The IV estimate minus the truth is . When is small, the term is no longer large next to the noise , and the noise in the numerator and the noise in the denominator are correlated, because and are. The ratio then leans toward , which is the OLS bias. A weak instrument does not merely add noise: it pulls the estimate back toward the very bias it was meant to remove, and its usual standard error does not warn of it.
Proof. Admitted at this level. ∎
The exact statement uses an asymptotic theory in which shrinks with (Staiger and Stock 1997), beyond this volume; the simulation below shows the result.
Listing 1.4 sets the true effect to zero, the correlation of and to 0.8, and , and chooses so that the expected first-stage is 2, 10 or 50. It repeats the experiment 2,000 times for each.
"""Weak instruments: 2SLS drifts toward OLS and its t-test lies (2,000 draws)."""
import numpy as np
rng = np.random.default_rng(7)
n, reps, rho = 200, 2000, 0.8 # rho: correlation of the two errors
print("target F mean F median 2SLS mean OLS rejects b = 0")
for target in (2, 10, 50):
pi = np.sqrt((target - 1) / n) # first stage giving E[F] about target
b_iv, b_ols, f_stat, reject = [], [], [], 0
for _ in range(reps):
z = rng.normal(size=n)
v = rng.normal(size=n)
u = rho * v + np.sqrt(1 - rho**2) * rng.normal(size=n)
x = pi * z + v
y = 0.0 * x + u # the true effect is zero
zc, xc, yc = z - z.mean(), x - x.mean(), y - y.mean()
b = (zc @ yc) / (zc @ xc)
e = yc - b * xc
se = np.sqrt(e @ e / (n - 2) * (zc @ zc)) / abs(zc @ xc)
p = (zc @ xc) / (zc @ zc)
r = xc - p * zc
f_stat.append(p**2 * (zc @ zc) / (r @ r / (n - 2)))
b_iv.append(b)
b_ols.append((xc @ yc) / (xc @ xc))
reject += abs(b / se) > 1.96
print(f"{target:8d} {np.mean(f_stat):6.1f} {np.median(b_iv):11.3f}"
f" {np.mean(b_ols):8.3f} {reject / reps:12.3f}")
$ python weak_iv.py
target F mean F median 2SLS mean OLS rejects b = 0
2 2.0 0.266 0.796 0.107
10 10.1 0.009 0.766 0.072
50 50.5 0.004 0.642 0.045
At an of 2 the median 2SLS estimate is 0.266, about a third of the way from the truth, zero, to the OLS mean, 0.796; a test at 5 % rejects the true value in 10.7 % of the samples. At an of 50 the median is 0.004 and the rejection rate 4.5 %. With one instrument the median moves only when the instrument is very weak. The spread is the larger damage: the chart below shows how wide the distribution becomes.
At the estimates gather tightly around zero. At they spread over the whole window and beyond, with a lump between zero and the OLS value; 27 % of them fall outside the window altogether (against 6 % at ), because the denominator can come close to zero. The test is the most practical worry. The second chart runs the experiment at eleven strengths and records how often a test of nominal size 5 % rejects the true value.
The rejection rate is 13.9 % at and 7.0 % at , and it reaches the nominal 5 % only when is several tens.
How fast it falls depends on the correlation between and , which is 0.8 here; with a smaller correlation the test is less distorted. A reader cannot know that correlation in real data, so the thresholds below are set for the worst case.
How it is measured — The first-stage statistic
The first-stage statistic tests that the coefficients of the excluded instruments are all zero in the first stage; with one instrument it is the square of that coefficient’s statistic. Three thresholds are in use.
- The rule of thumb. Staiger and Stock (1997) proposed calling instruments weak when .
- Critical values. Stock and Yogo (2005) tabulated the needed for the actual size of a nominal 5 % test to be at most a chosen level. With one endogenous regressor and one instrument, a size of at most 10 % needs ; at most 15 % needs ; at most 20 %, ; at most 25 %, .
- The procedure. Lee, McCrary, Moreira and Porter (2022) showed that the usual 1.96 is valid at 5 % only when , and that a researcher who keeps 10 as the threshold must use 3.43 in place of 1.96.
With heteroskedastic or clustered errors the must itself be robust; the classical can overstate strength. An above every threshold does not make an instrument valid. It says only that the first stage is not the problem.
On the record — Quarter of birth, examined
Angrist and Krueger (1991) also ran regressions with many instruments: the quarter of birth interacted with the year of birth, and with the state of birth, up to 180 excluded instruments. Bound, Jaeger and Baker (1995) re-examined them. With 28 instruments and controls for age within the year, the first-stage was 1.613 and the IV estimate 0.060 (0.029), close to the OLS estimate of 0.063; with the three quarter dummies alone the was 13.486 and the estimate 0.142 (0.033). They then replaced the true quarter of birth with a random draw, 500 times. With instruments that by construction carry no information, the mean estimate was 0.061 and the mean reported standard error 0.039, estimates that look reasonable and are the OLS bias in disguise. The lesson is now part of every applied paper: report the first stage, and add instruments only when each adds strength.
1.5 Local average treatment effects
The model of Section 1.1 gives every person the same . Most treatments do not work that way: a year of college pays more for some than for others, and people who expect a high return are more likely to go. With unequal effects, what does an instrument estimate? The answer uses the potential outcomes of the Year 2 volume, for a binary treatment (going to college) and a binary instrument (an offer). Each person has two potential outcomes, and , and two potential treatments: , whether she would go if offered, and , whether she would go if not. The observed treatment is and the observed outcome .
Definition 1.11 (Compliance types and monotonicity)
With a binary instrument and a binary treatment, each person has one of four types, fixed by the pair :
- a complier has and : treated if and only if offered;
- an always-taker has ;
- a never-taker has ;
- a defier has and : treated if and only if not offered.
The instrument satisfies monotonicity when there are no defiers: for every .
The observed data never reveal a person’s type: someone treated without an offer is an always-taker, someone untreated with an offer is a never-taker, but someone treated with an offer may be a complier or an always-taker. The shares of the types are identified all the same.
Theorem 1.12 (The local average treatment effect theorem)
Suppose that
- (independence) is independent of ;
- (exclusion) the instrument affects the outcome only through the treatment, which the notation , with no in it, already assumes;
- (relevance) ;
- (monotonicity) for every .
Then
and the denominator is the share of compliers.
Proof. By exclusion, with . By independence,
so the numerator is . The difference is 1 for compliers, for defiers and 0 for everyone else. Monotonicity rules out defiers, so the numerator equals . By the same argument, the denominator is , which is not zero by relevance. Divide. ∎
Definition 1.13 (Local average treatment effect)
The local average treatment effect (LATE) of a binary instrument is the average treatment effect among its compliers, .
Proof. With no defiers, the people treated without an offer are exactly the always-takers, and by independence their share in the group is their share in the population. Likewise the people untreated with an offer are exactly the never-takers. The three shares sum to one. ∎
Model — The local average treatment effect
Assumes. An instrument assigned as if at random, which moves the treatment in one direction only and touches the outcome only through it; effects may differ from person to person.
Predicts. The Wald ratio equals the average effect among compliers. Two valid instruments that move different people may give different, equally correct, estimates. The first stage measures the share of compliers.
Tested. In simulations with known effects, such as Listing 1.5, and in lottery and randomised-offer studies, where independence holds by design: there the shares of the types and the characteristics of the compliers can be computed and compared across sites and years.
Breaks. When some people do the opposite of what the instrument pushes (defiers), the ratio mixes effects with opposite signs and can lie outside the range of every person’s effect. When the policy question is about people who are not compliers, the LATE does not answer it.
Listing 1.5 builds a population with 20 % always-takers, whose gain from treatment is 0.30, 30 % compliers, whose gain is 0.15, and 50 % never-takers, whose gain is 0.02. The always-takers also start from a higher untreated outcome.
"""LATE: with unequal gains, IV recovers the compliers' average effect."""
import numpy as np
rng = np.random.default_rng(11)
n = 200_000
kind = rng.choice(["always", "never", "complier"], size=n, p=[0.2, 0.5, 0.3])
gain = np.select([kind == "always", kind == "complier"], [0.30, 0.15], 0.02)
gain = gain + rng.normal(0, 0.05, n) # gains also vary inside a type
y0 = 10 + 0.2 * (kind == "always") + rng.normal(0, 0.5, n)
z = rng.integers(0, 2, n) # the offer, at random
d = (kind == "always") | ((kind == "complier") & (z == 1))
y = y0 + d * gain # observed outcome
first = d[z == 1].mean() - d[z == 0].mean()
wald = (y[z == 1].mean() - y[z == 0].mean()) / first
print(f"share treated if offered {d[z == 1].mean():.3f}")
print(f"share treated if not offered {d[z == 0].mean():.3f}")
print(f"first stage (complier share) {first:.3f}")
print(f"Wald estimate {wald:.3f}")
print(f"compliers' mean gain {gain[kind == 'complier'].mean():.3f}")
print(f"everyone's mean gain (ATE) {gain.mean():.3f}")
print(f"treated minus untreated {y[d].mean() - y[~d].mean():.3f}")
$ python late_sim.py
share treated if offered 0.499
share treated if not offered 0.198
first stage (complier share) 0.301
Wald estimate 0.143
compliers' mean gain 0.150
everyone's mean gain (ATE) 0.115
treated minus untreated 0.351
The treated share is 0.499 with an offer and 0.198 without, so the first stage, 0.301, is the share of compliers and the share treated without an offer is the share of always-takers. The Wald estimate, 0.143, is within sampling error of the compliers’ mean gain, 0.150; the average gain over everyone is 0.115, and the naive comparison of treated and untreated, 0.351, adds the always-takers’ head start to their larger gain. Nothing in the data distinguishes the 0.143 from an average effect: the assumptions do.
The theorem changes how the Wald estimate of Example 1.7 reads. Its compliers are men whom the school-leaving age kept in school for a few extra months, men who would have left at the first chance. Their return to a year, about ten per cent, need not be the return for a man choosing between college and work. An instrument answers the question it was given, about the people it moves.
1.6 Instruments examined
Every instrument in applied economics has been attacked on its exclusion restriction, and the attacks follow a few patterns. The method below collects them.
Method 1.15 (Examining an instrument)
- Report the first stage, its sign, its size and its robust , and compare the with the thresholds of How it is measured.
- Report the reduced form. If the instrument has no effect on the outcome, the IV estimate is zero or undefined, whatever the regressions say.
- State the story of the exclusion restriction: why the instrument is as good as random, and why it has no path of its own to the outcome. List the other channels and say which data could rule each out.
- Test what can be tested: balance of the instrument across predetermined characteristics, and placebo outcomes that the treatment cannot affect but the other channels would.
- Say who the compliers are, and whether the policy question is about them.
Geography and trade
The opening chart is the first stage of a design due to Frankel and Romer (1999). Listing 1.6 rebuilds it for 2019 and carries it through. The gravity regression, over the 29,083 country pairs that trade at all, finds a distance elasticity of and a contiguity coefficient of 0.96. The 2SLS regression of log output per worker on the log trade share controls for log population in both stages, because large countries trade less with others for reasons of size alone, and size may affect productivity directly.
"""Does trade raise output per worker? Geography as an instrument, 2019."""
import numpy as np
import pandas as pd
from econdata import gravity, pwt, wdi
from ivtools import first_stage_f, ols, tsls
cols = ["year", "iso3_o", "iso3_d", "tradeflow_baci", "distw_harmonic",
"contig", "pop_o", "pop_d", "gdp_o"]
g = gravity(2019, 2019, columns=cols)
back = g.rename(columns={"iso3_o": "iso3_d", "iso3_d": "iso3_o",
"tradeflow_baci": "back"})[["iso3_o", "iso3_d", "back"]]
g = g.merge(back, on=["iso3_o", "iso3_d"], how="left").fillna({"back": 0})
g["share"] = (g.tradeflow_baci + g.back) / g.gdp_o # pair trade / GDP
g = g.dropna(subset=["share", "pop_o", "pop_d", "distw_harmonic"])
g = g[g.share > 0]
# 1. A gravity fit that sees only geography and size
G = np.column_stack([np.ones(len(g)), np.log(g.distw_harmonic),
np.log(g.pop_o), np.log(g.pop_d), g.contig])
g["fit"] = np.exp(G @ ols(np.log(g.share), G)["beta"])
built = g.groupby("iso3_o").fit.sum().mul(100).rename("built")
# 2. Actual trade share, output per worker, population
w = wdi("NE.TRD.GNFS.ZS", since=2019, until=2019, countries_only=True)
p = pwt(since=2019, until=2019, cols=["rgdpo", "emp", "pop"]).set_index("iso3")
d = pd.concat([built, w.set_index("iso3").value.rename("trade"), p], axis=1,
join="inner").dropna()
y = np.log(d.rgdpo / d.emp)
one, lpop = np.ones(len(d)), np.log(d["pop"])
X = np.column_stack([one, lpop, np.log(d.trade)])
Z = np.column_stack([one, lpop, np.log(d.built)])
print(f"countries {len(d)}")
print(f"first-stage F {first_stage_f(X[:, 2], Z[:, 2], Z[:, :2]):.1f}")
for name, r in (("OLS ", ols(y, X, se="HC1")), ("2SLS", tsls(y, X, Z, se="HC1"))):
b, s = r["beta"][2], r["se"][2]
print(f"{name} elasticity {b:.3f} (s.e. {s:.3f})")
$ python geography_iv.py
countries 157
first-stage F 35.4
OLS elasticity 0.866 (s.e. 0.149)
2SLS elasticity 0.428 (s.e. 0.382)
With the population control the first-stage is 35.4, above every threshold but the one. OLS gives an elasticity of 0.866 (0.149) and 2SLS gives 0.428 (0.382). The point estimate halves, and its 95 % interval, from about to , includes both zero and the OLS value. On these data, geography cannot tell whether trade raises output per worker. That is a result, not a failure: it says how much the instrument can and cannot carry.
Open question — Does trade raise income?
- Frankel and Romer (1999) estimated, with geography as the instrument for trade in 1985, an effect of trade on income at least as large as OLS, though imprecise. Grade 3 on the evidence scale of Chapter 6: a correlation with controls and a plausible mechanism, since the exclusion restriction is disputed.
- Rodríguez and Rodrik (2000) argued that the openness measures and methods of this literature leave its findings open to other interpretations, and found little evidence that open trade policies are associated with growth; the same doubt applies to geography, which can reach income through climate, disease and institutions as well as trade. Grade 3.
- The refit in this chapter, with 2019 data, finds a positive point estimate that is not distinguishable from zero. Grade 3.
- Designs built on changes over time answer narrower questions. Feyrer (2021) used the closing of the Suez Canal from 1967 to 1975, which lengthened some countries’ sea routes and not others’, and Donaldson (2018) the arrival of railways in the districts of colonial India; both find that lower trade costs raised income (Chapter 3 has the tools). Grade 2 for the episodes they study, which are not the cross-country question.
On the record — Rainfall, growth and conflict
Miguel, Satyanath and Sergenti (2004) used rainfall as an instrument for economic growth in 41 African countries over 1981–1999, arguing that rain moves farm output and touches civil conflict through income alone. They found that a negative growth shock of five percentage points raised the likelihood of conflict in the following year by about one-half. The design was then examined on both of its conditions. On relevance, Miguel and Satyanath (2011) reported that the first stage, the effect of rainfall on growth, is weaker in the years after 2000. On exclusion, Sarsons (2015) studied Indian districts downstream of dams, where rainfall moves farm income much less, and found that riots responded to rainfall there as much as elsewhere: rain reaches conflict through some channel other than income. A rainy day also keeps people indoors.
The two records share a pattern. A design is proposed with a plausible story, the first stage is measured, and later work finds either that the first stage is weaker than it looked or a channel the story left out. Neither invalidates the method. They are the method doing its work, in public.
1.7 Exercises
Exercise 1.1 ★
Read the opening chart and its table.
- The slope of the line is 0.235. Say in one sentence what it means for two countries whose predicted trade shares differ by 20 %.
- Fiji’s predicted share is 2.3 % and its actual share 111 %; the United States’ are 5.1 % and 26 %. Which of the two lies further from the line, in logarithms?
- Does the strength of this first stage say anything about whether geography affects output per worker only through trade? Explain.
Solution
Solution of Exercise 1.1.
- The slope is an elasticity: a country whose predicted share is 20 % higher trades, on average, % more (the linear approximation % is close).
- The line predicts % for a built share of % (the left end of the line) and about % at %. In logarithms Fiji lies above the line and the United States below it: the United States is slightly further away, on the other side. Large economies trade less with others than geography predicts, because so much of their trade is internal.
- No. The first stage measures relevance, the correlation of the instrument with trade. The exclusion restriction is about the unobserved causes of output per worker, which the chart does not show; a strong first stage and a direct effect of geography on output can coexist.
Exercise 1.2 ★
Angrist and Krueger (1991) also report means for 247,199 men born 1920–1929, from the 1970 census: the log weekly wage is 5.1484 for men born in the first quarter and 5.1574 for the others, a difference of ; years of education are 11.3996 and 11.5252, a difference of .
- Compute the Wald estimate of the return to a year of education from the two printed differences.
- The OLS estimate in the same sample is 0.0801. Is the Wald estimate above or below it, and how does that compare with the 1980 sample of Example 1.7?
Solution
Solution of Exercise 1.2.
- .
- It is below OLS (0.0801) in the 1970 sample, whereas in the 1980 sample IV (0.1020) was above OLS (0.0709). The two cohorts disagree on the sign of the gap, which is a reminder that a gap of this size between IV and OLS is within the IV estimates’ sampling error (standard errors 0.0219 and 0.0239).
Exercise 1.3 ★
In a population, , where is schooling, is unmeasured ability, and is uncorrelated with both. The slope of a regression of on is 0.25.
- Compute the probability limit of the OLS slope of on .
- By how much, in per cent, does OLS overstate the return?
- What would the limit be if ability raised schooling but not wages?
Solution
Solution of Exercise 1.3.
- By the omitted-variable formula, .
- By %.
- : the omitted variable biases OLS only if it enters the wage equation () and is correlated with schooling.
Exercise 1.4 ★
A study uses the distance from a person’s childhood home to the nearest college as an instrument for her years of schooling.
- State the relevance condition and the exclusion restriction for this instrument in words.
- Give two channels through which distance to a college could affect adult wages other than through schooling.
- For one of them, say what data would show that the channel is at work.
Solution
Solution of Exercise 1.4.
- Relevance: people who grew up closer to a college get, on average, more schooling. Exclusion: distance to a college is unrelated to the other causes of adult wages and affects wages only through schooling.
- Colleges are built in towns, so a short distance means an urban childhood, with its better schools and denser job networks; and families who value education may choose to live near a college, so distance is correlated with parental background.
- For the urban channel: compare the wages of people who grew up near and far from a college among those who never attended any college. If distance affected wages only through schooling, the gap within this group, conditional on schooling, would be zero; a gap shows the other channel. For the family channel: check whether distance predicts parents’ education, which schooling cannot have caused.
Exercise 1.5 ★★
In a sample of , the sample moments of an instrument , a regressor and an outcome are , and .
- Compute the first-stage slope, the reduced-form slope and the IV estimate.
- The residuals have variance . Under homoskedasticity the standard error of the IV slope is . Compute it and a 95 % confidence interval.
- Show that the formula in (2) is the entry of when .
Solution
Solution of Exercise 1.5.
- First stage ; reduced form ; IV estimate , which is also .
- ; the interval is , from 0.104 to 0.196.
- The fitted value is with . For a regression on a constant and one variable, the entry of is (variances with divisor ). Substituting gives , and multiplying by gives the formula.
Exercise 1.6 ★★
In Example 1.7, IV (0.1020) exceeds OLS (0.0709).
- Suppose recorded schooling is the true schooling plus a classical error whose variance is 10 % of the variance of recorded schooling, and there is no ability bias. What does OLS converge to, if the true return is ? What does IV with a valid instrument converge to?
- Ability bias alone would make OLS exceed IV. Combine (1) with an ability bias of : for which values of would OLS fall below IV?
- Give a third reason, not about bias, why a valid IV estimate can exceed OLS.
Solution
Solution of Exercise 1.6.
- With classical error the OLS slope converges to , where is the share of the variance of recorded schooling that is true variance: , so OLS converges to . A valid instrument is uncorrelated with the measurement error, so IV converges to .
- OLS converges to , which is below when , that is .
- With unequal returns, IV estimates the average return among compliers, which can be larger than the average return that OLS (if it were unbiased) would weight differently. Men kept in school by the leaving age may gain more from a year than the average man.
Exercise 1.7 ★★
A charity offered free tutoring, by lottery, to half of the applicants of a Brenland school. Of the pupils offered, 62 % took it up; of those not offered, 14 % found a tutor elsewhere. The share passing the final examination was 0.53 among the pupils offered and 0.47 among the others.
- Compute the first stage, the reduced form and the Wald estimate, and state what the Wald estimate measures.
- Compute the shares of always-takers, never-takers and compliers.
- What assumption makes the share of compliers in (2) correct? Give an example of a pupil who would violate it.
Solution
Solution of Exercise 1.7.
- First stage ; reduced form ; Wald estimate . Among pupils who take tutoring if and only if offered it, tutoring raises the chance of passing by 12.5 percentage points.
- Always-takers , never-takers , compliers .
- Monotonicity: no pupil is tutored if not offered but untutored if offered. A violation: a family that would have paid a private tutor, but accepts the charity’s offer, then finds the charity’s sessions at an impossible time and stops.
Exercise 1.8 ★★
Run Listing 1.6 without the population control: drop population from both and .
- Report the first-stage , the OLS and the 2SLS elasticities with their robust standard errors.
- The first-stage falls by about half. Compute the correlations of log population with the log built share and with the log actual share, and explain why controlling for population strengthens the first stage.
- Without the control, is the exclusion restriction more or less plausible? Explain.
Solution
Solution of Exercise 1.8.
The tested solution is ex08_no_population.py, in the chapter’s exercises/ folder.
- First-stage 16.7; OLS 0.833 (0.124); 2SLS 0.376 (0.451).
- The correlation of log population with the log built share is 0.092 and with the log actual share . Population explains much of the actual trade share and almost none of the built share. Controlling for it removes a large part of the first stage’s residual variance without changing much the variation of the instrument, so the statistic of the instrument, and its , rise.
- Less plausible. Large countries trade less and may have different productivity for reasons of size (larger markets, more varied industries); without the control, those channels sit in the error. Since the built share is nearly uncorrelated with population the damage is small here, but the control is the safer specification.
Exercise 1.9 ★★
In the rainfall design of the On the record box, rainfall in year instruments growth in year , and the outcome is conflict in year .
- Propose a placebo outcome: a variable that rainfall in year should not predict if the exclusion restriction holds.
- Sarsons’s districts downstream of dams have a weaker first stage. If the exclusion restriction held, what should the reduced form be in those districts, compared with the others? What did she find, and what does it imply?
- Suppose rainfall affects conflict directly with a coefficient in the reduced form, and the first stage is . Write the probability limit of the IV estimate, and say what happens to the bias when falls.
Solution
Solution of Exercise 1.9.
- Conflict in year : rainfall in year cannot have caused it through growth in year . If rainfall in predicts conflict in , rainfall is correlated with persistent causes of conflict.
- The reduced form is the first stage times the effect of growth on conflict, so with a weaker first stage the reduced form should be smaller downstream of dams. Sarsons found that riots responded as much there as elsewhere: rainfall reaches conflict through another channel, and the exclusion restriction fails.
- The reduced form is , so the IV estimate converges to . The bias grows without bound as the first stage weakens: the weaker the rainfall–growth link becomes, the more a small direct effect of rain distorts the estimate.
Exercise 1.10 ★★★
Adapt Listing 1.4 to a single strength, an expected first-stage of 5, with 4,000 samples.
- Report the mean first-stage , the median 2SLS estimate, the mean OLS estimate and the rejection rate of the true value at 5 %.
- What share of the samples has a first-stage above 10? Report the median 2SLS estimate among those samples and among the others. A literature that publishes only studies with selects on the first stage: explain the direction in which that selection moves the published estimates.
- Compare the rejection rate with the Stock–Yogo critical values of How it is measured.
Solution
Solution of Exercise 1.10.
The tested solution is ex10_weak_f5.py, in the chapter’s exercises/ folder.
- Mean first-stage 5.06; median 2SLS 0.028; mean OLS 0.784; the 5 % test rejects the true value in 9.0 % of the samples.
- 13.0 % of the samples have . Their median 2SLS estimate is 0.357, against in the others. A large sample first stage, , is often large because happens to be large; since and are correlated, is then large too, with the sign of the OLS bias. Selecting on the first stage therefore selects samples whose estimates lean toward OLS, and a literature filtered on is biased toward OLS.
- An of 5 is below every critical value of the table, including the 5.53 needed for a size of at most 25 %: the table cannot promise even that. The 9.0 % found here is for a correlation of 0.8 between and ; the critical values guard against the worst correlation.
Exercise 1.11 ★★★
In model (1.2), let and , where holds the constant and the exogenous controls and and are single columns.
- Show that the 2SLS coefficient on equals the ratio of the reduced-form coefficient on to the first-stage coefficient on . (Hint: use part (1) of Proposition 1.9, write the first-stage fitted value as , and apply the Frisch–Waugh–Lovell theorem of the Year 2 volume.)
- Deduce that the 2SLS estimate is zero whenever the reduced-form coefficient is zero, whatever the first stage.
Solution
Solution of Exercise 1.11.
By part (1) of Proposition 1.9, 2SLS is OLS of on , where is the first-stage fitted value and its coefficient on . Let be the matrix that residualises on and write . By the Frisch–Waugh–Lovell theorem, the coefficient on is . Since , , so the coefficient is
By the same theorem, is the reduced-form coefficient on . The 2SLS coefficient is the reduced-form coefficient divided by the first-stage coefficient.
- If the reduced-form coefficient is zero, the ratio is zero, whatever the value of . An instrument that does not move the outcome cannot produce an effect.
Exercise 1.12 ★★★
Drop monotonicity from Theorem 1.12, keeping the other three assumptions.
- Show that the Wald ratio equals , where and are the shares of compliers and defiers and and their average effects.
- With , , and , compute the Wald ratio. Every person’s effect is positive: comment.
- Give a setting where defiers are plausible.
Solution
Solution of Exercise 1.12.
- As in the proof of Theorem 1.12, the numerator is . The factor is 1 for compliers and for defiers, so the numerator is . The denominator is .
- . Every effect is positive and the ratio is negative, outside the range of every individual effect: without monotonicity, the Wald ratio is not an average effect of anyone.
- Defendants assigned at random to judges: a judge who is lenient on average may still be harsher than another judge towards some kinds of case, so some defendants would be jailed by the lenient judge and freed by the strict one.
1.8 Problem: The Brenland College Lottery
Problem 1.1
Weekend problem — the Brenland college lottery
Brenland (invented) opened a new college in 2010 with more applicants than places, and allocated the places by lottery. Ten years later a survey followed all 4,000 applicants: the 2,000 who won a place and the 2,000 who did not. Some losers enrolled later through a waiting list or another route; some winners never took up their place. Earnings at age thirty are in logarithms of dalens per year.
| Mean log earnings | |||||
| Applicants | Enrolled | all | enrolled | not enrolled | |
| Lottery winners | 2,000 | 1,400 | 10.095 | 10.2214 | 9.80 |
| Lottery losers | 2,000 | 400 | 9.995 | 10.40 | 9.89375 |
The standard deviation of log earnings is 0.60 within each lottery group.
Part I — the naive comparison.
- Compute the share enrolled among all applicants and the mean log earnings of all enrolled and of all non-enrolled applicants.
- Compute the naive difference in mean log earnings between enrolled and non-enrolled applicants.
- Name two reasons why this difference need not be the effect of college.
- Would a regression of log earnings on enrolment and the applicants’ school grades remove the bias? Explain in two sentences.
- The college’s prospectus quotes the naive difference as the gain from studying there. Convert it to a percentage gain in earnings.
Part II — the lottery as an instrument.
- State the relevance condition and the exclusion restriction for the lottery, and say why the lottery makes independence credible.
- Compute the first stage and the reduced form.
- Compute the Wald estimate.
- The standard error of the first stage is . Compute it and the first-stage . Is the instrument weak?
- Compute the standard error of the reduced form from the standard deviation of log earnings within groups.
- When the first stage is precisely estimated, the standard error of the Wald estimate is approximately the standard error of the reduced form divided by the first stage. Compute it.
- Give the 95 % confidence interval of the Wald estimate.
Part III — who the compliers are.
- Assuming monotonicity, compute the shares of always-takers, never-takers and compliers.
- What is the mean log earnings of always-takers? Of never-takers?
- The enrolled winners are a mix of always-takers and compliers. Use the shares of Question 13 to show that the compliers’ mean of is , and compute it.
- In the same way, compute the compliers’ mean of from the non-enrolled losers and the non-enrolled winners.
- Check that the difference of the answers to Questions 15 and 16 equals the Wald estimate.
- Compare the compliers’ mean of with the never-takers’ mean, and the compliers’ mean of with the always-takers’ mean. What do the two comparisons say about who enrols, and about the naive comparison of Part I?
Part IV — a second campus.
- A smaller campus held its own lottery among 1,200 applicants, 600 winners and 600 losers. Of the winners 26 % enrolled, of the losers 20 %. Compute its first stage and the standard error , and its first-stage .
- The reduced form at the second campus is 0.02. Compute its Wald estimate.
- With the same within-group standard deviation of 0.60, compute the standard error of the reduced form and, by the approximation of Question 11, of the Wald estimate.
- Is the second campus’s estimate statistically different from the first campus’s? Compute the standard error of the difference, treating the two as independent.
- By the How it is measured thresholds, how would you describe the second instrument? Should a study pool the two lotteries as two instruments in one 2SLS regression?
- Even if both lotteries were strong, why might their LATEs differ? State the effect of college that this problem estimates, with its 95 % interval, and for whom.
Solution
Solution of Problem 1.1.
1. enrolled. The enrolled mean is ; the non-enrolled mean is .
2. .
3. Applicants who enrol differ from those who do not in ways that matter for earnings: those who enrol after losing (always-takers) are determined or well-connected, and those who decline a place they won (never-takers) may have good alternatives or poor prospects. And the gain from college may differ between those who choose it and those who do not.
4. No. Grades capture part of what the applicants differ in, but the selection runs on motivation, family resources and alternatives, which grades do not measure; the residual difference is still not the effect of college.
5. : the prospectus claims earnings 48 % higher.
6. Relevance: winning raises the chance of enrolling. Exclusion: winning affects earnings only through enrolment, not, for instance, through the encouragement of having won. The lottery assigns winning by chance, so winners and losers have the same distribution of potential outcomes and potential enrolments: independence holds by design.
7. First stage ; reduced form .
8. .
9. ; and . Not weak: far above every threshold.
10. .
11. .
12. , from 0.126 to 0.274.
13. Always-takers: the enrolled share among losers, 0.20. Never-takers: the non-enrolled share among winners, 0.30. Compliers: the first stage, 0.50.
14. The enrolled losers are all always-takers: their mean of is 10.40. The non-enrolled winners are all never-takers: their mean of is 9.80. (The always-takers’ and the never-takers’ are never seen.)
15. Among winners, is the share-weighted mean of of the always-takers (share 0.2, mean 10.40) and the compliers (share 0.5), by independence. So the compliers’ mean is .
16. Among losers, the non-enrolled are never-takers (share 0.3, mean 9.80) and compliers (share 0.5): .
17. , the Wald estimate.
18. Without college the compliers earn more than the never-takers (9.95 against 9.80), and with college less than the always-takers (10.15 against 10.40). Enrolment rises with earnings potential: the people who enrol whatever happens are the highest earners, those who never enrol the lowest. The naive comparison of Part I adds that ordering to the effect of college, which is why it is about twice the Wald estimate.
19. First stage ; standard error ; and .
20. .
21. ; the Wald estimate’s standard error is about .
22. The difference is , with standard error ; the statistic is 0.23. The two estimates are not distinguishable: the second campus’s is too imprecise to agree or disagree with anything.
23. Weak: an of about 6.2 is below the rule of thumb of 10 and below the Stock–Yogo critical values for a size of 10 %, 15 % and 20 %; its -test could be badly oversized, and the normal approximation behind Question 21 is itself unreliable. Pooling adds almost no information, because 2SLS weights each instrument by its first-stage strength, and adding a weak instrument moves 2SLS toward OLS in finite samples. Report the main campus, and the second campus separately as a weak, uninformative estimate.
24. The two lotteries may move different people: the compliers at a small campus, those who enrol only if they win a place there, may have different gains from those at the main campus. Two valid LATEs can differ without either being wrong. The named result: for applicants to the main campus who enrol if and only if they win a place, college raises log earnings at thirty by 0.200, about 22 % (), with a 95 % interval of 0.126 to 0.274 log points.