Instant PDF download, name-and-email checkout. Complete Book Bundle: every Economics, Statistics, Mathematics and Econometrics book
Econometrics guide, Unit 3, step 13 of 20Previous stepNext step

Step 13: Instrumental Variables and 2SLS

SyllabusUndergraduate econometrics · Wooldridge, Introductory Econometrics, Ch. 15
In 30 seconds
  • A regressor is endogenous if it is correlated with the error, \( \text{Cov}(x,u) \neq 0 \). OLS is then biased and inconsistent: more data give a more precise estimate of the wrong number.
  • Endogeneity has three sources: omitted variables, measurement error in \( x \) (attenuation) and simultaneity (\( y \) also affects \( x \)).
  • An instrument \( z \) must be relevant (\( \text{Cov}(z,x) \neq 0 \), testable) and exogenous (\( \text{Cov}(z,u) = 0 \), argued, not tested). The simple IV estimate is \( \text{Cov}(z,y)/\text{Cov}(z,x) \).
  • Two-stage least squares regresses \( x \) on all exogenous variables, then \( y \) on the fitted \( \hat{x} \). Never report hand-made second-stage standard errors.
  • Exam point: check the first-stage \( F \) (below 10 means weak instruments), and say what the Hausman and Sargan tests can and cannot show.

What endogeneity means

Every regression so far has rested on one assumption: nothing in the error is related to the explanatory variables. Heteroskedasticity (Step 11) and autocorrelation (Step 12) only spoil the standard errors. A regressor correlated with the error spoils the coefficient itself.

Key termAn explanatory variable is exogenous if it is uncorrelated with the error, \( \text{Cov}(x,u) = 0 \), and endogenous if \( \text{Cov}(x,u) \neq 0 \). Endogeneity is the general name for any situation in which a regressor is correlated with the error.
Econometrics Made Simple textbook coverChapter 13 of Econometrics Made Simple covers this in full: the three sources of endogeneity, 2SLS by hand and by software, weak instruments and the Hausman and Sargan tests.Get the textbook · $15

Write the OLS slope as the true value plus an error term, and divide top and bottom by \( n \). As \( n \) grows, the numerator goes to \( \text{Cov}(x,u) \) and the denominator to \( \text{Var}(x) \):

\[ \operatorname{plim}\,\hat\beta_1 = \beta_1 + \frac{\text{Cov}(x,u)}{\text{Var}(x)} . \]

If \( \text{Cov}(x,u) \neq 0 \), OLS is inconsistent: even with an infinite sample it estimates the wrong number, and the sign of the error is the sign of \( \text{Cov}(x,u) \). A study of a million workers with an endogenous regressor gives a very precise estimate of the wrong number.

Source 1: omitted variables

If the true model contains \( q \) but you leave it out, \( q \) sits in the error. Whenever \( q \) is correlated with \( x \), so is \( u \). The leading example is ability in a wage equation: able people earn more for given schooling and also stay in education longer. So \( \text{Cov}(\text{educ}, u) > 0 \) and OLS overstates the return to education. (Our article on predicting the direction of omitted variable bias shows how to sign it.) The book’s companion wage data were simulated with a true return of 0.085; OLS gives 0.1054 even with seven controls.

Source 2: measurement error in a regressor

Suppose you observe \( x = x^* + e \), where \( e \) is a random recording error (classical measurement error). The error \( e \) ends up both in \( x \) and in the regression error, so they are correlated, and

\[ \operatorname{plim}\,\hat\beta_1 = \beta_1 \cdot \frac{\sigma_{x^*}^2}{\sigma_{x^*}^2 + \sigma_e^2}. \]

The fraction, the reliability ratio, lies between 0 and 1, so the estimate is shrunk towards zero: attenuation bias. If schooling has true variance 3.5 and is misreported with error variance 0.5, OLS converges to \( 0.875 \times 0.085 = 0.0744 \), 12.5% below the truth. Measurement error in the dependent variable is much less harmful: it joins the error and only costs precision.

Source 3: simultaneity

In a market, price and quantity are set together. Demand is \( q = \alpha_0 + \alpha_1 p + u_d \) with \( \alpha_1 < 0 \), and supply is \( q = \gamma_0 + \gamma_1 p + u_s \) with \( \gamma_1 > 0 \). Solving for the equilibrium price gives \( p = (\alpha_0 – \gamma_0 + u_d – u_s)/(\gamma_1 – \alpha_1) \), so a positive demand shock raises the price. Price is correlated with the demand error, and a regression of \( q \) on \( p \) is pulled from the demand slope towards the positive supply slope. Police and crime, investment and growth: wherever \( y \) feeds back into \( x \), suspect endogeneity.

SourceExampleUsual effect on OLS
Omitted variableAbility left out of a wage equationBias in the direction of \( \beta_q\,\text{Cov}(x,q) \); here upwards
Measurement error in \( x \)Schooling or income misreportedAttenuation towards zero
SimultaneityPrice and quantity; police and crimeA mixture of the two relationships

The idea of an instrument

The variation in an endogenous \( x \) is a mixture: some of it moves with \( u \), some does not. If a variable shifts \( x \) but has nothing to do with \( u \), the movements in \( x \) it causes are “clean”. Tracing how \( y \) responds to those movements alone reveals \( \beta_1 \).

Key termAn instrumental variable \( z \) for an endogenous regressor \( x \) satisfies two conditions. Relevance: \( \text{Cov}(z,x) \neq 0 \); it can be tested by regressing \( x \) on \( z \). Exogeneity: \( \text{Cov}(z,u) = 0 \), which includes the exclusion restriction that \( z \) has no direct effect on \( y \). With one instrument it cannot be tested, because \( u \) is never observed; it must be argued.

Take the covariance of \( y = \beta_0 + \beta_1x + u \) with \( z \): \( \text{Cov}(z,y) = \beta_1\text{Cov}(z,x) + \text{Cov}(z,u) \). Exogeneity sets the last term to zero, and relevance lets us divide:

\[ \hat\beta_1^{\,IV} = \frac{\sum (z_i – \bar{z})(y_i – \bar{y})}{\sum (z_i – \bar{z})(x_i – \bar{x})} = \frac{\text{slope of } y \text{ on } z\ (\text{reduced form})}{\text{slope of } x \text{ on } z\ (\text{first stage})} . \]

The first stage measures how much the instrument moves \( x \); the reduced form how much it moves \( y \). Because \( z \) affects \( y \) only through \( x \), dividing one by the other isolates \( \beta_1 \). When \( z \) is a dummy, both slopes are differences in group means and the ratio is the Wald estimator, \( (\bar{y}_1 – \bar{y}_0)/(\bar{x}_1 – \bar{x}_0) \). OLS is the special case \( z = x \).

IV is consistent but not unbiased: in small samples it is biased towards OLS. It is also less precise. With homoskedastic errors, approximately

\[ \text{se}\big(\hat\beta_1^{\,IV}\big) \approx \frac{\text{se}\big(\hat\beta_1^{\,OLS}\big)}{|\text{Corr}(x,z)|}. \]
Common mistakeThinking an instrument must be uncorrelated with \( y \). It must be uncorrelated with \( u \), the error. A good instrument is correlated with \( y \), through \( x \): that is the reduced form.

Worked example: the return to education

The book’s wage data contain dist_college, the distance in kilometres from a worker’s home at 16 to the nearest college. The argument, first made by Card (1995) with US data: living near a college makes study cheaper, so it raises schooling (relevance); where a family lived is, arguably, unrelated to ability and has no direct effect on adult wages (exogeneity). The second claim is not watertight: families who value education may live near colleges, and colleges cluster in cities, where wages are higher. In the simulated data the instrument is valid by construction; in a real study you would have to defend it.

Worked example

With no controls, \( \text{Cov}(z,y) = -0.3813 \) and \( \text{Cov}(z,x) = -5.3758 \), where \( z \) is distance, \( x \) is schooling and \( y \) is log wage. Workers living at most 20.65 km away (the median) have mean log wage 2.8994 and mean schooling 11.944 years; those further away, 2.8685 and 11.338. Compute the IV estimate and the Wald estimate.

Step 1IV: \( -0.3813/(-5.3758) = 0.0709 \). Each extra year of schooling raises wages by about 7.1%, against 10.3% from simple OLS.
Step 2First stage: each extra kilometre lowers schooling by 0.0181 years (\( t = -5.36 \)), about 1.8 fewer years per 100 km. The instrument is relevant.
Step 3Wald: \( (2.8994 – 2.8685)/(11.944 – 11.338) = 0.0309/0.606 = 0.051 \).

Growing up near a college raises wages by about 3.1% and schooling by 0.6 years, so a year of schooling is worth about 5.1%. The Wald estimate is cruder, because splitting at the median throws away information. Both lie below OLS, in line with upward ability bias.

The price is precision. The correlation between schooling and distance is only −0.167, so the IV standard error should be about \( 1/0.167 \approx 6 \) times the OLS one: \( 0.00809/0.167 = 0.048 \), close to the 0.0487 from a 2SLS command. The 95% interval runs from about −0.03 to 0.17. It contains the OLS estimate, the true value of 0.085, and zero.

The data also contain parent_educ, the schooling of the better-educated parent. It is a much stronger predictor of schooling (correlation 0.373). But is it exogenous? Educated parents tend to have higher incomes and better networks, which may raise their children’s earnings directly, and parents’ education is probably correlated with the child’s own ability, the very variable causing the problem. Most economists would treat it with suspicion.

Exam tipWhen asked to “evaluate” an instrument, write two paragraphs. Relevance: why would \( z \) move \( x \), and what does the first stage show? Exogeneity: name a specific channel through which \( z \) might affect \( y \) directly or be linked to an omitted variable. “Exogeneity cannot be tested” on its own earns little credit.

Two-stage least squares

Real models have control variables \( w_1, \dots, w_k \) and sometimes several instruments \( z_1, \dots, z_m \). The structural equation is \( y = \beta_0 + \beta_1x + \delta_1w_1 + \dots + \delta_kw_k + u \). Two-stage least squares (2SLS) works in two steps.

StageWhat you do
1Regress \( x \) on all exogenous variables, the instruments and the controls. Save the fitted values \( \hat{x} \): they are built only from exogenous variables.
2Regress \( y \) on \( \hat{x} \) and the controls. The coefficient on \( \hat{x} \) is the 2SLS estimate.

The idea is to keep only the part of the variation in \( x \) that the instruments explain. With one instrument and no controls, 2SLS gives exactly the simple IV formula.

Common mistakeReporting standard errors from a hand-made second stage. The second-stage regression computes residuals with the fitted \( \hat{x} \), but the structural equation is about the actual \( x \). In the wage data the hand-made standard error is 0.0482 instead of the correct 0.0448. Use a 2SLS command: IV2SLS in Python’s linearmodels, ivreg in R’s AER, ivregress 2sls in Stata. And never leave the controls out of the first stage.

With the seven controls of the book’s Model (4), the results are in Figure 1.

Estimates of the return to schooling with 95% intervals log wage, n = 1,000
estimate and 95% confidence intervaltrue value in the simulation
-0.050.000.050.100.150.20return to a year of educationOLS, 7 controls2SLS: distance2SLS: distance + parents0.10540.06120.0801true 0.085
Figure 1. 2SLS with distance to college removes the upward ability bias of OLS (0.0612 against 0.1054) but its interval is six times wider and includes zero. Adding parents’ education as a second instrument narrows the interval a lot, but that instrument is doubtful in real data. Data: wages.csv, recomputed.

2SLS with distance gives 0.0612 (standard error 0.0448), against 0.1054 (0.0075) from OLS. The point estimate is well below OLS, as ability bias predicts, but the interval from −0.027 to 0.149 cannot rule out the OLS value or zero. Adding parent_educ as a second instrument gives 0.0801 with a standard error of 0.0182: a stronger first stage buys precision, but only by leaning on the doubtful instrument. With more instruments than endogenous regressors the model is overidentified; with exactly as many it is just identified; with fewer it cannot be estimated. In your own work use heteroskedasticity-robust 2SLS standard errors (here 0.0427 instead of 0.0448).

Weak instruments

An instrument only loosely related to \( x \) is weak. Weakness is more than a wide interval: 2SLS is then biased towards OLS, its distribution is far from normal, and the usual tests are unreliable. The standard check is the first-stage \( F \) statistic for the excluded instruments (the controls stay in). With one instrument it is the square of its \( t \) statistic.

\[ \text{Rule of thumb (Staiger and Stock, 1997): instruments are weak if the first-stage } F < 10 . \]

Newer work is stricter. Stock and Yogo (2005) tabulated critical values that depend on the number of instruments and the bias you will tolerate, and Lee, McCrary, Moreira and Porter (2022) showed that with one instrument the usual 5% \( t \) test is reliable only when \( F \) exceeds about 104.7. For the wage equation the first-stage \( F \) is 29.38 with distance alone and 101.73 with both instruments. By the old rule both are strong; by the newer one the single-instrument \( t \) test deserves caution.

The book’s simulation (5,000 samples, true slope 1, strongly endogenous \( x \)) shows what goes wrong. OLS has a median of about 1.75–1.80 either way. With a strong instrument (mean \( F = 32.6 \)) the median IV estimate is 1.005 and a 5% test rejects the truth 5.9% of the time. With a weak one (mean \( F = 2.2 \)) the median is 1.250, dragged towards OLS, the middle 90% of estimates runs from −2.73 to 5.26, and the test rejects 10.4% of the time. A weak instrument also magnifies any small failure of exogeneity, because \( \operatorname{plim}\hat\beta_1^{IV} = \beta_1 + \text{Cov}(z,u)/\text{Cov}(z,x) \).

Testing endogeneity and the instruments

Durbin–Wu–Hausman. If \( x \) is exogenous, OLS and 2SLS are both consistent and OLS is more precise. The regression version: save the first-stage residuals \( \hat{v} \), add them to the structural equation, and \( t \)-test their coefficient. In the wage data it is 0.0455 with \( t = 1.019 \), \( p = 0.308 \): we cannot reject exogeneity. That is a lesson in power, not evidence. The gap between OLS and the truth is 0.02 while the IV standard error is 0.045.

Sargan overidentification test. With more instruments than you need, you can check whether they agree. Regress the 2SLS residuals on all exogenous variables; \( nR^2 \sim \chi^2_q \), where \( q \) is the number of extra instruments. With distance and parents’ education, \( nR^2 = 0.221 \), \( p = 0.638 \): they agree. But agreement is not validity. Two instruments that are invalid in the same way, both linked to ability, can agree perfectly and both be wrong.

Exam tipFor each test state \( H_0 \) and what rejection means. Hausman: \( H_0 \) is “\( x \) is exogenous”; rejection favours IV. First-stage \( F \): \( H_0 \) is “instruments irrelevant”; you want a large \( F \). Sargan: \( H_0 \) is “all instruments exogenous”; you want not to reject, and should add that not rejecting does not prove validity.

Worked example: the demand for coffee

The book’s file coffee_market.csv has 240 months of simulated price and quantity data, generated with a true demand elasticity of −0.6. Each month shows only an equilibrium point, so when demand and supply both shift the points form a cloud that traces neither curve. But if something shifts only supply, the equilibria slide along the demand curve and trace it out. Rainfall in the growing region and a transport fuel-cost index are such supply shifters.

Coffee market: 240 monthly equilibria logs
monthly price and quantitynaive OLS line2SLS demand curve at mean income
3.954.054.154.254.355.05.15.25.35.45.5log quantitylog pricenaive OLS: −0.172SLS demand: −0.59
Figure 2. Naive OLS of quantity on price gives a slope of −0.17 (the steep line): a blend of demand and supply. Using rainfall and fuel cost as supply-shifting instruments, 2SLS estimates a demand elasticity of −0.59 (the flatter dashed line through the sample means); the true value in the simulation is −0.6. Data: coffee_market.csv, recomputed.

Naive OLS of log quantity on log price gives −0.1721. It is not a demand elasticity at all, but a blend of the demand and supply slopes; adding log income moves it to −0.4044. In the first stage, more rain lowers the price and dearer fuel raises it, with an \( F \) of 281.6 for the two instruments, far above both 10 and 104.7. 2SLS gives a price elasticity of −0.5879 (standard error 0.0395, interval −0.666 to −0.510), which contains the true −0.6. The Wu–Hausman statistic of 128.88 rejects exogeneity of price decisively, and the Sargan statistic of 1.348 (\( p = 0.246 \)) says the two instruments agree.

Worked example

A roaster is considering a 5% price rise. Using the 2SLS elasticity, what happens to quantity and revenue? What would naive OLS have suggested?

Step 12SLS: quantity falls by about \( 0.5879 \times 5 = 2.94\% \), so revenue rises by about \( 5 – 2.94 = 2.06\% \). Demand is inelastic.
Step 2Naive OLS: quantity falls by only \( 0.1721 \times 5 = 0.86\% \), suggesting a revenue gain of about 4.14%.

OLS would have doubled the expected gain from raising prices. Note the identification rule: to estimate demand you need variables that shift supply only. Income shifts demand, so it belongs in the demand equation and cannot instrument for price there.

What IV estimates when effects differ

If the return to schooling differs across people, Imbens and Angrist (1994) showed that IV estimates a local average treatment effect (LATE): the average effect for the compliers, the people whose schooling the instrument actually changed. Distance to college identifies the return for people who studied because a college was nearby, not for those who would have gone anyway. So two valid instruments can legitimately give different answers. When you report an IV result, say whose behaviour the instrument moves. Famous examples include Angrist and Krueger’s (1991) quarter of birth and Angrist’s (1990) Vietnam-era draft lottery. For a longer treatment, read our article Instrumental Variables and Two-Stage Least Squares.

Econometrics Made Simple Practice Questions coverEvaluate instruments and compute IV estimates until it is second nature: the Practice Questions book has worked answers to every question.1,150+ questions · $9

Practise: 6 questions

Try each one on paper first, then check the worked answer.

EasyQ1. Household income in a survey has true variance 4 and is reported with classical measurement error of variance 1. The true effect of income on saving is 0.10. What will OLS estimate in a large sample? Show worked answer
Reliability ratio \( = 4/(4+1) = 0.8 \).
\( \operatorname{plim}\hat\beta_1 = 0.8 \times 0.10 = 0.08 \): attenuated by 20% towards zero.
A larger sample does not help; it only makes the wrong number more precise.
EasyQ2. In a lottery for places at a selective school, winners later earn 2.4% more (in logs, 0.024) and have 0.4 more years of schooling than losers. Compute the Wald estimate of the return to a year of schooling and state the assumption it needs. Show worked answer
\( \hat\beta^W = 0.024/0.4 = 0.06 \): about 6% per year of schooling.
Assumption: winning the lottery affects earnings only through extra schooling (the exclusion restriction). If the selective school also raised earnings through networks, the estimate would mix the two.
MediumQ3. In a sample, \( \text{Cov}(z,y) = 1.2 \) and \( \text{Cov}(z,x) = 8 \). The OLS slope has standard error 0.02 and \( \text{Corr}(x,z) = 0.25 \). Compute the IV estimate, its approximate standard error, and an approximate 95% interval. Show worked answer
\( \hat\beta^{IV} = 1.2/8 = 0.15 \).
\( \text{se} \approx 0.02/0.25 = 0.08 \).
Interval: \( 0.15 \pm 1.96 \times 0.08 = [-0.007, 0.307] \). It just includes zero: the instrument removes bias at a large cost in precision.
MediumQ4. A first-stage regression with one excluded instrument and several controls gives \( t = 3.1 \) on the instrument. Is the instrument weak by the Staiger–Stock rule? What are the consequences if it is? Show worked answer
\( F = t^2 = 3.1^2 = 9.61 < 10 \): weak by the rule of thumb (and far below the 104.7 threshold for reliable \( t \) tests).
Consequences: 2SLS is biased towards OLS, its distribution is far from normal, and nominal 5% tests reject too often. Any small violation of exogeneity is magnified.
Remedies: look for a stronger instrument or report weak-instrument-robust (Anderson–Rubin) intervals.
MediumQ5. A model with one endogenous regressor uses two instruments on \( n = 500 \) observations. Regressing the 2SLS residuals on all exogenous variables gives \( R^2 = 0.009 \). Carry out the Sargan test at 5% and interpret. Show worked answer
\( q = 2 – 1 = 1 \) overidentifying restriction.
\( nR^2 = 500 \times 0.009 = 4.5 \), against the \( \chi^2_1 \) critical value 3.84: reject (\( p = 0.034 \)).
At least one instrument appears correlated with the error, or the two give genuinely different estimates (for example different LATEs). The test cannot tell you which instrument is at fault.
ExamQ6. A researcher wants the price elasticity of demand for fresh fish in a coastal city, using monthly data on price and quantity. (a) Explain why OLS of log quantity on log price will not estimate the demand elasticity. [2] (b) From these candidates, choose a suitable instrument and explain your choice: average temperature in the city; storm days at sea; household income. [3] (c) 2SLS gives an elasticity of −1.25. What does a 4% price rise do to revenue? [2] Show worked answer
(a) Price and quantity are determined together by demand and supply. [B1] Demand shocks raise the price, so price is correlated with the demand error and OLS mixes the demand and supply slopes. [B1]
(b) Storm days at sea. [B1] They reduce the catch and so shift supply (relevance). [B1] They plausibly do not change how much fish consumers want at a given price (exogeneity); temperature and income shift demand, so they belong in the demand equation and cannot be excluded. [B1]
(c) Quantity falls by about \( 1.25 \times 4 = 5\% \). [M1] Revenue changes by about \( 4 – 5 = -1\% \): it falls, because demand is elastic. [A1]
Total: 7 marks.

Check yourself

1. Which instrument condition can be tested directly from the data?

Relevance is tested in the first stage. Exogeneity involves the unobserved error and must be argued (with extra instruments you can only test whether they agree).

2. Classical measurement error in a regressor makes the OLS slope

\( \operatorname{plim}\hat\beta_1 = \beta_1 \times \) reliability ratio, which lies between 0 and 1: attenuation.

3. A first-stage \( F \) statistic of 6 for one instrument suggests

\( F < 10 \) signals weakness. Weakness is about relevance, not validity, though it magnifies any failure of exogeneity.

Your score: 0 out of 3

The short version

  • Endogeneity, \( \text{Cov}(x,u) \neq 0 \), makes OLS inconsistent: \( \operatorname{plim}\hat\beta_1 = \beta_1 + \text{Cov}(x,u)/\text{Var}(x) \).
  • Sources: omitted variables, measurement error in \( x \) (attenuation) and simultaneity.
  • A valid instrument is relevant (testable) and exogenous (argued). Simple IV is reduced form over first stage; with a dummy instrument it is the Wald estimator. IV is consistent but less precise.
  • 2SLS: regress \( x \) on all exogenous variables, then \( y \) on \( \hat{x} \) and the controls; use a 2SLS command for standard errors.
  • Wage data: OLS 0.1054, 2SLS with distance 0.0612 (se 0.0448), with both instruments 0.0801; truth 0.085. Coffee: 2SLS elasticity −0.588 against naive OLS −0.172; truth −0.6.
  • First-stage \( F < 10 \) means weak instruments. Hausman tests endogeneity, Sargan tests agreement; neither proves validity. IV estimates a local effect for compliers.
  • The full chapter in Econometrics Made Simple has the code in Python, R and Stata, the weak-instrument simulation and a complete set of exercises with answers.
Econometrics Made Simple Complete Bundle coverTextbook and practice questions together: get both Econometrics Made Simple books for $19 (was $24).Both books · $19

Studying more than one subject? The Complete Book Bundle gives you every Economics, Statistics, Mathematics and Econometrics book in one download.

Want more questions like these, with worked answers?
The practice book has over 1,150 more, graded from easy to exam level.
Next: step 14 of 20Logit, Probit and Binary Outcomes