5.3 — Instrumental Variables

ECON 480 • Econometrics • Fall 2022

Dr. Ryan Safner
Associate Professor of Economics

safner@hood.edu
ryansafner/metricsF22
metricsF22.classes.ryansafner.com

Contents

Instrumental Variables Models

Two Stage Least Squares

Simultaneous Causation & Structural Equation Modeling

Clever Research Designs Identify Causality

Again, this toolkit of research designs to identify causal effects is the economist’s comparative advantage that firms and governments want!

Identification Strategies

  • Endogeneity remains the hardest (and most common) econometric challenge

  • Diff-n-diff/fixed effects are one strategy to minimize endogeneity

    • Requires panel data
    • Can’t use time-varying omitted variables that are correlated with regressors
  • Another strategy to is to find some source of exogenous variation that removes the endogeneity of a variable, using that source as a instrumental variable

Identification Strategies

  • Endogeneity remains the hardest (and most common) econometric challenge

  • Diff-n-diff/fixed effects are one strategy to minimize endogeneity

    • Requires panel data
    • Can’t use time-varying omitted variables that are correlated with regressors
  • Another strategy to is to find some source of exogenous variation that removes the endogeneity of a variable, using that source as a instrumental variable

Instrumental Variables Models

Understanding Instruments

  • X and Y are correlated

  • Consider confounding variable Z that would meet the conditions of omitted variable bias:

    1. Causes Y (in error term u)
    2. Correlated with X
  • Causal pathways from X to Y:

    1. X→Y (causal, front door)
    2. X←Z→Y (non-causal, back door)
  • Consider variable I which causes X but not Y

Understanding Instruments

  • Variable I has no backdoors between it and Y

  • The only way to reach Y from I is through X:

    • I→X→Y
  • Variable I is a good instrument for X if it satisfies two conditions:

    1. Inclusion condition: I statistically-significantly explains X
    2. Exclusion condition: I is uncorrelated with u, so it does not directly affect Y
    • I only affects Y through its effect on X

Example I: Veterans’ Earnings

Example

How does veteran status affect lifetime earnings?

Earningsi=β0+β1Veterani+ui

  • Veterani is endogenous, correlated with other things in ui
    • Choice to enlist in military for non-random reasons

Example I: Exogeneous and Endogenous Variation

  • Imagine if we could split variation in Veterani into an exogenous part and an endogenous part:

Earningsi=β0+β1Veterani+ui

Example I: Exogeneous and Endogenous Variation

  • Imagine if we could split variation in Veterani into an exogenous part and an endogenous part:

Earningsi=β0+β1Veterani+uiEarningsi=β0+β1(VeteranEx.i+VeteranEnd.i)+ui

Example I: Exogeneous and Endogenous Variation

  • Imagine if we could split variation in Veterani into an exogenous part and an endogenous part:

Earningsi=β0+β1Veterani+uiEarningsi=β0+β1(VeteranEx.i+VeteranEnd.i)+uiEarningsi=β0+β1VeteranEx.i+β1VeteranEnd.i+ui⏟wi

Example I: Exogeneous and Endogenous Variation

  • Imagine if we could split variation in Veterani into an exogenous part and an endogenous part:

Earningsi=β0+β1Veterani+uiEarningsi=β0+β1(VeteranEx.i+VeteranEnd.i)+uiEarningsi=β0+β1VeteranEx.i+β1VeteranEnd.i+ui⏟wiEarningsi=β0+β1VeteranEx.i+wi

  • What would a plausible source of VeteranEx.i be?
  • Choices to enlist in the military for “random” reasons, uncorrelated with ui (other things that affect Earningsi)

Inclusion & Exclusion Conditions for Instruments

  • We isolate the exogenous variation in Xi with an instrumental variable that is:
  1. Correlated with the explanatory variable (relevance)
    • Often called the “inclusion condition”
  2. Uncorrelated with the error term (exogenous)
    • Often called the “exclusion condition”
  • So for our example:

Tip

Earningsi=β0+β1Veterani+ui

We want an instrument I for Veterani which is:

  1. Relevant: cor(Veterani,I)≠0
  2. Exogenous: cor(I,ui)≠0

Example Instrument: Relevance

  • Relevance (“inclusion condition”): we need I to vary with our endogenous X variable

  • We can test this condition using a regression and t-test on the relevant coefficient (checking correlations also helps)

Example

For Veterani status, consider several potential I variables:

  1. Social security number

Probably not relevant
uncorrelated with military service

  1. Physical fitness

Possibly relevant
may be correlated with military service

  1. Vietnam War Draft

Relevant
being drawn in draft causes military service

Example Instrument: Exogeneity

  • Exogeneity (“exclusion condition”) we need I to be “as good as randomly assigned”, uncorrelated with u (other factors that determine Y)

  • This is not testable! (Need a good argument from theory/intuition)

    • Does I only affect Y through X?

Example

For Veterani status, consider several potential I variables:

  1. Social security number

Exogenous
uncorrelated with other factors of earnings

  1. Physical fitness

Not exogeous
correlated with many other factors of earnings

  1. Vietnam War draft

Exogenous
lottery was random!

Exogeneity: The “Huh?” Factor

“A necessary but not a sufficient condition for having an instrument that can satisfy the exclusion restriction is if people are confused when you tell them about the instrument’s relationship to the outcome,” (p.123).

Cunningham, Scott, 2021, Causal Inference: The Mixtape

Good Instruments are Hard to Find (And Weird) I

Outcome Endogenous Variable Unobservables Instrument
Income Education Ability Quarter of birth
Income Education Ability Father’s education
Income Education Ability Distance to college
Income Education Ability Military draft
Health Smoking Other negative health behaviors Tobacco taxes
Crime rates Patrol hours number of criminals Election cycles
Crime rates Patrol hours number of criminals Firefighters
Crime rates Patrol hours number of criminals Terror Alert levels
Crime rates Incarceration rates Simultaneous causality Overcrowding litigations
Labor market success Americanization Ability Scrabble score of name
Conflict Economic growth Simultaneous causality Rainfall

Good Instruments are Hard to Find (And Weird) II

Angrist, Joshua D and Alan B Kreuger, 2001, “Instrumental Variables and the Search for Identification: From Supply and Demand to Natural Experiments,” Journal of Economic Perspectives 15(4): 69-85

Exogeneity: The “Huh?” Factor

“Remember what I said about how instruments having a certain ridiculousness to them? That is, you know you have a good instrument if the instrument itself doesn’t seem relevant for explaining the outcome of interest because that’s what the exclusion restriction implies. Why would quarter of birth affect earnings? It doesn’t make any obvious, logical sense why it should. But, if I told you that people born later in the year got more schooling than those with less because of compulsory schooling, then the relationship between the instrument and the outcome snaps into place. The only reason we can think of as to why the instrument would affect earnings is if the instrument were operating through schooling. Instruments only explain the outcome, in other words, when you understand their effect on the endogenous variable,” (p.123).

Cunningham, Scott, 2021, Causal Inference: The Mixtape

Good Instruments are Hard to Find (And Weird) III

“Testing” the Exclusion Restriction

  • Can you argue that the instrument does not affect outcome Y except only through X?

Examples

  • Instrument → ? → outcome
  • Quarter of birth → ? → wages
  • Rainfall → ? → civil war
  • Scrabble score of name → ? → wages

Example: Review

  • Instrument must be
    1. Correlated with our endogenous variable (Xi) (inclusion restriction)
    2. Uncorrelated with omitted variables that affect Yi (exclusion restriction)
  • To summarize: the instrument only affects the outcome through its relationship with the endogenous variable

Example

For Veterani status, our several potential I variables:

  1. Social security number:

Not relevant
Exogenous

  1. Physical fitness:

Relevant
Not exogenous

  1. Vietnam War Draft:

Relevant
Exogenous

  • The Vietnam War Draft is the only valid instrument

Example I: DAG Form

  • Causal pathways from X to Y:
    1. Vet→Earn
    2. Vet←U→Earn
  • We want the causal effect of

Vet→Earn

  • With our instrument

Draft→Vet→Earn

Example I: DAG Form

  • With our instrument

Draft→Vet→Earn

  • Based on our assumptions on independence and exogeneity:

(Effect of draft on earnings) =
(Effect of draft on veteran) × (Effect of veteran on earnings)

Example I: DAG Form

  • With our instrument

Draft→Vet→Earn

  • Based on our assumptions on independence and exogeneity:

(Effect of draft on earnings) =
(Effect of draft on veteran) × (Effect of veteran on earnings)

  • To find effect of veteran on earnings, rearrange!

(Effect of veteran on earnings) =
(Effect of draft on earnings)
(Effect of draft on veteran)

Estimating The Effect With Instrumental Variables

Recall: We want to estimate the effect of veteran status on earnings.

Earningsi=β0+β1Veterani+ui

  • Consider two other relationships:
  1. Effect of instrument on the endogenous variable

Veterani=γ0+γ1Drafti+wi

  1. Effect of instrument on the outcome variable (“reduced form”)

Earningsi=π0+π1Drafti+vi

  • Using these, we can estimate our desired effect, (Effect of veteran status on earnings):

βIV1=π1γ1

Estimating The Effect With Instrumental Variables

  • With our instrument, we estimate β1 using

ˆβIV1=ˆπ1ˆγ1

where ˆπ1 and ˆγ1 come from the regressions in the last slide

  • Is this estimator unbiased?

E[ˆβIV1]=β1+cov(Instrument,u)cov(Instrument,Endog. variable)

  • Yes: so long as the instrument is valid, i.e. exogenous (numerator) and relevant (denominator)

Example: Education

Example

Consider the age-old question of how education affects wages.

wagei=β0+β1educationi+ui

ols_reg <- lm(wage ~ education, data = wage_df)
tidy(ols_reg)
ABCDEFGHIJ0123456789
term
<chr>
estimate
<dbl>
std.error
<dbl>
statistic
<dbl>
p.value
<dbl>
(Intercept)176.5039589.1519501.9798104.810523e-02
education58.593936.4392629.0994798.755353e-19
2 rows
  • education is endogenous
  • What if we use mother's education as an instrument?

Example: Instrument

  • Causal pathways from educ to wage:
    1. educ→wage
    2. educ←U→wage
  • We want the causal effect of

educ→wage

  • With our instrument

mom→educ→wage

Example: Relevance

  • We can check the relevance of mother’s education as an instrument for education

  • This regression is known as the “first stage”: effect of the instrument on the endogenous variable

Educationi=γ0+γ1Mother's educationi+vi

first_stage <- lm(education ~ education_mom, data = wage_df)
tidy(first_stage)
ABCDEFGHIJ0123456789
term
<chr>
estimate
<dbl>
std.error
<dbl>
statistic
<dbl>
p.value
<dbl>
(Intercept)10.48674660.3055746534.318121.125629e-153
education_mom0.29397190.0273575110.745574.408584e-25
2 rows
  • p-value suggests this is a very relevant instrument!

First-Stage Visualized

Exogeneity

  • We need our instrument, mother’s education to be exogenous
  1. Mother’s education must only affect wages through (own) education
  2. Mother’s education must be uncorrelated with other factors that affect wages (i.e. the error term ui)
  • We want to be able to compare two individuals A and B whose mothers have different levels of education and say their only differences between A and B are their mothers’ education levels.

Reduced Form

  • The estimate for the reduced form (effect of instrument on outcome)

Wagei=π0+π1Mother's educationi+vi

ABCDEFGHIJ0123456789
term
<chr>
estimate
<dbl>
std.error
<dbl>
statistic
<dbl>
p.value
<dbl>
(Intercept)633.3367258.57775410.811902.369599e-25
education_mom31.811835.2443536.065922.118840e-09
2 rows

The Effect We’re After

  • So what’s our estimate of the returns to education on wages

Wagesi=β0+β1Educationi+ui

  • We know the IV estimate for β1 is

βIV1=π1γ1

  1. In the reduced form equation, we estimated ˆπ1≈31.81
  1. In the first-stage equation, we estimated ˆγ1≈0.294

ˆβIV1=ˆπ1ˆγ1≈31.810.294≈108.2

Example in R: estimatr

  • estimatr package
library(estimatr)

iv_reg <- iv_robust(wage ~ education | education_mom, data = wage_df)
summary(iv_reg)

Call:
iv_robust(formula = wage ~ education | education_mom, data = wage_df)

Standard error type:  HC2 

Coefficients:
            Estimate Std. Error t value  Pr(>|t|) CI Lower CI Upper  DF
(Intercept)   -501.5     226.48  -2.214 2.712e-02  -946.11   -56.84 720
education      108.2      16.81   6.437 2.220e-10    75.21   141.22 720

Multiple R-squared:  0.02917 ,  Adjusted R-squared:  0.02783 
F-statistic: 41.44 on 1 and 720 DF,  p-value: 2.22e-10
tidy(iv_reg)
ABCDEFGHIJ0123456789
term
<chr>
estimate
<dbl>
std.error
<dbl>
statistic
<dbl>
p.value
<dbl>
(Intercept)-501.4743226.47608-2.2142482.712420e-02
education108.213816.810316.4373482.219782e-10
2 rows | 1-5 of 9 columns

Example in R: fixest

  • fixest package
library(fixest)

iv_reg_2 <- feols(wage ~ 1 | education ~ education_mom, data = wage_df)
summary(iv_reg_2)
TSLS estimation, Dep. Var.: wage, Endo.: education, Instr.: education_mom
Second stage: Dep. Var.: wage
Observations: 722 
Standard-errors: IID 
              Estimate Std. Error  t value   Pr(>|t|)    
(Intercept)   -501.474   246.6842 -2.03286 4.2433e-02 *  
fit_education  108.214    18.0210  6.00486 3.0367e-09 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
RMSE: 401.8   Adj. R2: 0.027825
F-test (1st stage), education: stat = 115.5    , p < 2.2e-16 , on 1 and 720 DoF.
                   Wu-Hausman: stat =   9.63706, p = 0.001982, on 1 and 719 DoF.
tidy(iv_reg_2)
ABCDEFGHIJ0123456789
term
<chr>
estimate
<dbl>
std.error
<dbl>
statistic
<dbl>
p.value
<dbl>
(Intercept)-501.4743246.68425-2.0328594.243317e-02
fit_education108.213818.021046.0048603.036728e-09
2 rows

Two-Stage Least Squares (2SLS)

Instrumental Variables & 2SLS

  • Now we know how to use instruments (when there is 1 endogenous X variable, and 1 instrumental variable I):
    1. Estimate reduced form (regress outcome ~ instrument)
    2. Estimate first stage (regress endog. variable ~ instrument)
    3. Calculate IV-estimate of outcome ~ endog. variable using (1) and (2)
  • Instrument isolates only the exogenous variation in the endogenous variable
  • What if we want to use multiple endogenous variables and/or multiple instruments?
  • Extend this approach using two-stage least squares (2SLS)1
  1. In practice, since 2SLS is used so commonly, most people conflate instrumental variables approaches with 2SLS, but it is just one approach to using instruments.

Intuitions from Instruments & 2SLS

  • We already have a lot of intuitions from IV to talk about 2SLS:

Endogenous modelOutcomei=β0+β1(Endog. var.)i+uiFirst stage(Endog. var.)i=π0+π1Instrumenti+viSecond stageOutcomei=δ0+δ1^(Endog. var.)i+εiReduced formOutcomei=π0+π1Instrumenti+wi

where ^(Endog. var.)i are the predicted values (fitted values) from the first-stage regression

2SLS: Advantages

  • 2SLS is very flexible:
    • Can add additional endogenous variables
    • Can use additional instruments for endogenous variables
    • Can add additional (exogenous) control variables (X2,⋯,Xk)
  • Of course, your instruments still need to be valid:
    1. Exogenous
    2. Relevant

2SLS: Multiple Instruments

Example

Come back to to our returns to education on wages example.

wagei=β0+β1educationi+ui

  • Suppose both mother’s education and father’s education are valid instruments (relevant and exogenous)
  • Then the first stage regression is:

Educationi=γ0+γ1Mother's educationi+γ2Father's educationi+vi

ABCDEFGHIJ0123456789
term
<chr>
estimate
<dbl>
std.error
<dbl>
statistic
<dbl>
p.value
<dbl>
(Intercept)9.84536000.3047088032.3107183.586474e-142
education_mom0.14869080.032159314.6235694.471844e-06
education_dad0.21563540.027517757.8362291.672522e-14
3 rows

First Stage: Checking Relevance

ABCDEFGHIJ0123456789
term
<chr>
estimate
<dbl>
std.error
<dbl>
statistic
<dbl>
p.value
<dbl>
(Intercept)9.84536000.3047088032.3107183.586474e-142
education_mom0.14869080.032159314.6235694.471844e-06
education_dad0.21563540.027517757.8362291.672522e-14
3 rows
  • Both instruments appear to be relevant (small p-values), but we can more formally test their relevance jointly (i.e., an F-test)
library(car)
linearHypothesis(first_stage_multiple_IVs, c("education_mom", "education_dad"))
ABCDEFGHIJ0123456789
 
 
Res.Df
<dbl>
RSS
<dbl>
Df
<dbl>
Sum of Sq
<dbl>
17213607.215NANA
27192864.0672743.1482
2 rows | 1-5 of 7 columns
  • p-value is small, so they are jointly significant, i.e. relevant instruments

Aside: The Problem of Weak Instruments

  • Weak instruments have low relevance (i.e. cor(X,I) is weak) and add little explanatory power

  • This can make OLS (and 2SLS) unreliable in small samples, and significantly raises the variance of OLS estimates

  • This likelihood also increases when we have multiple instruments, or more instruments than endogenous variables (a problem of “overidentification”)

Second-Stage

# add fitted values from first stage
wage_df$education_hat <- first_stage_multiple_IVs$fitted.values
  • Now run the second stage regression:

Wagei=δ0+δ1^(education)i+εi

ABCDEFGHIJ0123456789
term
<chr>
estimate
<dbl>
std.error
<dbl>
statistic
<dbl>
p.value
<dbl>
(Intercept)-454.6828198.14948-2.2946452.204034e-02
education_hat104.789314.462367.2456541.110314e-12
2 rows

Comparing Results

OLS IV 2SLS (two instruments)
Constant 176.50** −501.47** −454.68**
(89.15) (226.48) (198.15)
education 58.59*** 108.21*** 104.79***
(6.44) (16.81) (14.46)
n 722 722 722
Adj. R2 0.10 0.03 0.07
SER 386.21 401.82 393.71
* p < 0.1, ** p < 0.05, *** p < 0.01

Using estimatr or fixest

  • You can do this “by hand” as we did, but R packages will run both stages for you

  • estimatr package: iv_robust(y ~ x1 + x2 + ... | z1 + z2 + ..., data = df)

    • x1, x2, ... are your endogenous variables
    • z1, z2, ... are instruments
    • df is the dataframe
iv_robust(wage ~ education | education_mom + education_dad, data = wage_df)
             Estimate Std. Error   t value     Pr(>|t|)   CI Lower  CI Upper
(Intercept) -454.6828  199.94577 -2.274030 2.325766e-02 -847.22915 -62.13638
education    104.7893   14.85244  7.055357 4.051281e-12   75.62999 133.94851
             DF
(Intercept) 720
education   720

Using estimatr or fixest

  • fixest package: feols()
feols(wage ~ 1 | education ~ education_mom + education_dad, data = wage_df)
TSLS estimation, Dep. Var.: wage, Endo.: education, Instr.: education_mom, education_dad
Second stage: Dep. Var.: wage
Observations: 722 
Standard-errors: IID 
              Estimate Std. Error  t value   Pr(>|t|)    
(Intercept)   -454.683   201.2012 -2.25984 2.4129e-02 *  
fit_education  104.789    14.6851  7.13576 2.3529e-12 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
RMSE: 399.8   Adj. R2: 0.037696
F-test (1st stage), education: stat = 93.3     , p < 2.2e-16 , on 2 and 719 DoF.
                   Wu-Hausman: stat = 13.6     , p = 2.448e-4, on 1 and 719 DoF.
                       Sargan: stat =  0.111147, p = 0.738842, on 1 DoF.

Another Example: Levitt (2002) I

Example

How do police affect crime?

Crimeit=β0+β1Policeit+uit

  • Police→crime (more police reduces crime)
  • Crime→Police (high crime areas tend to have more police)
  • cor(Police,ϵ)≠0: population, income per capita, drug use, recessions, demography, etc.

Another Example: Levitt (2002) II

  • Levitt (2002): use number of firefighters as an instrumental variable

  • Some police are hired for endogenous reasons (respond to crime, changes in economy, demographics, etc)

  • Some police are hired for exogenous reasons (city just gains a larger budget and so hires more police)

    • These exogenous dynamics affect the number of firefighters in a city — not due to crime, but due to excess budgets, etc.
  • Isolate that portion of variation in Police that covaries with Firefighters for those exogenous changes (i.e. for reasons other than crime or its causes), see how these changes in Police affect crime

Levitt, Steven D, (2002), “Using Electoral Cycles in Police Hiring to Estimate the Effect of Police on Crime: Reply,” American Economic Review 92(4): 1244-1250

Another Example: Levitt (2002) III

  • Levitt’s (2002) paper, First Stage:

ln(Policect)=γ1ln(Firefightersct)+αc+τt+γ2Controlsct+νct

subscripts for city c at year t, two-way fixed effects: αc city fixed-effects, τt year fixed-effects

  • Second stage:

^ln(Crimect)=β1^ln(Policect−1)+αc+τt+β2Controlsct+ϵct

lag for police (last year’s police force determines this year’s crime rates)

Another Example: Levitt (2002) IV

Instrument is statistically significant (t≈5), inclusion condition met

A 1% increase in firefighters is associated with a 0.206-0.251% increase in police

Another Example: Levitt (2002) V

A 1% increase in police (last year) leads to a 0.435% decrease in violent crimes, 0.501% decrease in property crimes

Another Example: AJR (2001) I

Another Example: AJR (2001) II

  • Acemoglu, Johnson, and Robinson (2001): countries’ wealth or poverty today depends strongly on how they were colonized.
  • Europeans set up one of two types of colonies depending on the disease environment of the country:
    • “Extractive institutions”: Europeans facing high mortality rates set up extractive colonies primarily to exploit indigenous population to mine resources to ship back to Europe
    • “Inclusive institutions”: Europeans facing low mortality rates set up inclusive colonies primarily for settlement and promoting open access to trade and politics
  • Those initial colonies carried through to institutions in present countries; inclusive colonies grew wealthy, extractive colonies remain stagnant

Acemoglu, Daron, Simon Johnson, and James A Robinson, (2001), “The Colonial Origins of Comparative Development: An Empirical Investigation,” American Economic Review 91(5): 1369-1401

Another Example: AJR (2001) III

  • Instrument: Settler Mortality in 1500
  • Inclusion Restriction: Settler mortality in 1500 determines risk of expropriation today
  • {Exclusion Restriction: Settler mortality in 1500 does not affect Present GDP
    • Settler mortality in 1500 only affects Present GDP through institutions determined by historical path set by settler mortality rates

Acemoglu, Daron, Simon Johnson, and James A Robinson, (2001), “The Colonial Origins of Comparative Development: An Empirical Investigation,” American Economic Review 91(5): 1369-1401

Another Example: AJR (2001) IV

  • First Stage:

Expropriation Riski=γ0+γ1ln(Settler Mortality in 1500i)+γ2Controls+νi

  • Second Stage:

ln(Present GDP per capita)=β0+β1^Expropriation Riski+⋯+β2Controls+ui

Another Example: AJR (2001) V

Relationship Between Y and IV

Another Example: AJR (2001) VI

Relationship Between X and Y

Another Example: AJR (2001) VII

Relationship Between X and IV

Another Example: AJR (2001) VIII

2SLS Results

Simultaneous Causation & Structural Equation Modeling

Simultaneous Causation

  • Another classic use of instrumental variables in econometrics is to break through the problem of simultaneous causation

X↔Y

  • This is a major source of endogeneity

Supply and Demand

  • A famous example, foundational to our discipline, Supply and Demand

  • Suppose you have data on price and quantity, and want to estimate a Demand curve with regression

Supply and Demand

  • A famous example, foundational to our discipline, Supply and Demand

  • Suppose you have data on price and quantity, and want to estimate a Demand curve with regression

  • Why can’t we estimate the demand curve with a simple regression here?

ln(Quantityit)=β0+β1ln(Priceit)+uit

  • With natural logs, β1 is the price elasticity of Demand

Supply and Demand: Simultaneous Causality

  • The data are actually all equilibrium (Q∗,P∗) points!

  • Result of many demand and supply curve shifts & intersections!

Supply and Demand: Simultaneous Causality

  • Structural equation model (SEM) of demand and of supply:

QD=α0+α1P+α2M+uDQS=β0+β1P+β2C+uS

  • α’s and β’s are parameters (to be estimated), u’s are unobserved error terms
  • P is price
    • Notice P simultaneously determines QD and QS!
  • M are variables that shift demand (i.e. income, prices of other goods, etc)
  • C are variables that shift supply (i.e. costs, etc)

Supply and Demand: Simultaneous Causality

QD=α0+α1P+α2M+uD

  • Why can’t we just estimate price elasticity of demand (α1) with the demand equation?

  • P is partially a function of quantity supplied!

Supply and Demand: Simultaneous Causality

  • Instrumental variables can identify the demand relationship

  • Conceptually, use some supply shifter (like cost changes, C) correlated with price P, but not correlated with uD

  • Essentially: traces out unique demand relationship by allowing supply to vary & shift

  • Then, can estimate demand elasticity β1

Demand Example

Example

Consider the consumption of broiler chickens from 1960-1999

lnquantityt=β0+β1lnprice of chickent+β2lnprice of beeft+β3lnpopulationt+β4lnincomet+ut

Data from Epple, Dennis and Bennett T McCallum, 2006, “Simultaneous Equation Econometrics: The Missing Example,” Economic Inquiry 44(2): 374-384

Demand Example

Demand Example 😨

Demand Example 😨

demand_reg <- lm(log_quantity ~ log_price, data = chick) 
demand_reg %>% tidy()
ABCDEFGHIJ0123456789
term
<chr>
estimate
<dbl>
std.error
<dbl>
statistic
<dbl>
p.value
<dbl>
(Intercept)10.6242430.2437918543.579164.710787e-34
log_price1.2582340.0544564123.105355.633462e-24
2 rows

Demand Example With Controls

demand_reg_2 <- lm(log_quantity ~ log_price + log_income + log_beef + log_pop + CPI, data = chick) 
demand_reg_2 %>% tidy()
ABCDEFGHIJ0123456789
term
<chr>
estimate
<dbl>
std.error
<dbl>
statistic
<dbl>
p.value
<dbl>
(Intercept)-3.2920700751.5759805026-2.08890284.427456e-02
log_price-0.2809419240.0902419635-3.11320713.740775e-03
log_income0.1156684640.21695794410.53313775.974062e-01
log_beef-0.0489776310.0630734442-0.77651754.428124e-01
log_pop3.5928758880.59499732176.03847417.677372e-07
CPI0.0047185080.00093822115.02920691.574394e-05
6 rows
  • ^β1: price elasticity of demand is -0.28%

  • But this is biased! Endogeneity from simultaneous causation with supply and demand!

Consider the Causality

  • Factors that influence quantity demanded:
    • price (endogenous! — partly determined by supply!)
    • price of substitutes (beef)
    • income
    • number of buyers (population)
    • price level (CPI)
    • other unobservables (u)
  • Factors that influence price (on the supply side)
    • price of inputs/costs (feed and corn)
    • use these as instruments for price!

Instruments

  • Use supply shifters, Price of Feed and Price of Corn (inputs/costs to raising chickens) as instruments for Chicken price

  • Are they relevant? Check the first stage

demand_first_stage <- lm(log_price ~ log_feed_price + log_corn_price + log_income + log_beef + log_pop + CPI, data = chick)
tidy(demand_first_stage)
ABCDEFGHIJ0123456789
term
<chr>
estimate
<dbl>
std.error
<dbl>
statistic
<dbl>
p.value
<dbl>
(Intercept)3.0913945443.0366795351.018018040.316075264
log_feed_price0.2918914040.1451999512.010272060.052634060
log_corn_price0.0125005120.0972848210.128493960.898537994
log_income0.7333913030.3691706691.986591470.055323296
log_beef-0.0053442960.121075174-0.044140310.965058576
log_pop-1.3979975931.102062552-1.268528350.213485189
CPI0.0061404110.0018253063.364045680.001958978
7 rows
glance(demand_first_stage)
ABCDEFGHIJ0123456789
r.squared
<dbl>
adj.r.squared
<dbl>
sigma
<dbl>
statistic
<dbl>
p.value
<dbl>
0.98642290.98395440.0539911399.59472.450699e-29
1 row | 1-5 of 12 columns
  • statistic (F) is high enough, jointly significant

  • Can also see correlations: ::: {.cell} ::: {.cell-output .cell-output-stdout}

               log_price log_feed_price log_corn_price
log_price      1.0000000      0.9464933      0.7742719
log_feed_price 0.9464933      1.0000000      0.9097980
log_corn_price 0.7742719      0.9097980      1.0000000

::: :::

Instruments

  • Use supply shifters, Price of Feed and Price of Corn (inputs/costs to raising chickens) as instruments for Chicken price

  • Are they exogenous?

cor(Feed price,uD)=0cor(Corn price,uD)=0

  • Argue that costs don’t affect factors that affect demand (in error term); only affect supply

Second Stage

chick$price_hat <- demand_first_stage$fitted.values

Now regress quantity on the fitted values of ^price (from first stage) with all the covariates (from first stage)

demand_second_stage <- lm(log_quantity ~ price_hat + log_income + log_beef + log_pop + CPI, data = chick)
tidy(demand_second_stage)
ABCDEFGHIJ0123456789
term
<chr>
estimate
<dbl>
std.error
<dbl>
statistic
<dbl>
p.value
<dbl>
(Intercept)-2.6866736171.690775142-1.589018881.213132e-01
price_hat-0.4375516950.158858181-2.754354179.375725e-03
log_income0.2092269040.2353866080.888864943.803215e-01
log_beef0.0044141430.0782199950.056432419.553277e-01
log_pop3.3882829170.6327822465.354579625.948795e-06
CPI0.0055376230.0011752134.712017254.045652e-05
6 rows
glance(demand_second_stage)
ABCDEFGHIJ0123456789
r.squared
<dbl>
adj.r.squared
<dbl>
sigma
<dbl>
statistic
<dbl>
p.value
<dbl>
0.99647640.99595820.035287811923.0271.160973e-40
1 row | 1-5 of 12 columns

Using fixest

iv_demand_reg <- feols(log_quantity ~ log_income + log_beef + log_pop + CPI | log_price ~ log_feed_price + log_corn_price, data = chick)
iv_demand_reg
TSLS estimation, Dep. Var.: log_quantity, Endo.: log_price, Instr.: log_feed_price, log_corn_price
Second stage: Dep. Var.: log_quantity
Observations: 40 
Standard-errors: IID 
               Estimate Std. Error   t value   Pr(>|t|)    
(Intercept)   -2.686674   1.721040 -1.561075 1.2777e-01    
fit_log_price -0.437552   0.161702 -2.705918 1.0572e-02 *  
log_income     0.209227   0.239600  0.873234 3.8866e-01    
log_beef       0.004414   0.079620  0.055440 9.5611e-01    
log_pop        3.388283   0.644109  5.260417 7.8866e-06 ***
CPI            0.005538   0.001196  4.629155 5.1702e-05 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
RMSE: 0.033116   Adj. R2: 0.995812
F-test (1st stage), log_price: stat = 8.46361, p = 0.001079, on 2 and 33 DoF.
                   Wu-Hausman: stat = 1.57081, p = 0.218897, on 1 and 33 DoF.
                       Sargan: stat = 2.88552, p = 0.089379, on 1 DoF.

Comparing

OLS OLS 2SLS (by hand) 2SLS (fixest)
Constant 10.624*** −3.292** −2.687 −2.687
(0.244) (1.576) (1.691) (1.721)
Log Price/lb of Chicken 1.258*** −0.281*** −0.438*** −0.438**
(0.054) (0.090) (0.159) (0.162)
Log Income 0.116 0.209 0.209
(0.217) (0.235) (0.240)
Log Price/lb of Beef −0.049 0.004 0.004
(0.063) (0.078) (0.080)
Log Population 3.593*** 3.388*** 3.388***
(0.595) (0.633) (0.644)
CPI 0.005*** 0.006*** 0.006***
(0.001) (0.001) (0.001)
n 40 40 40 40
Adj. R2 0.93 1.00 1.00 1.00
SER 0.14 0.03 0.03 0.03
* p < 0.1, ** p < 0.05, *** p < 0.01

ECON 480 — Econometrics

1
5.3 — Instrumental Variables ECON 480 • Econometrics • Fall 2022 Dr. Ryan Safner Associate Professor of Economics safner@hood.edu ryansafner/metricsF22 metricsF22.classes.ryansafner.com

  1. Slides

  2. Tools

  3. Close
  • Title Slide
  • Contents
  • Clever Research Designs Identify Causality
  • Identification Strategies
  • Identification Strategies
  • Instrumental Variables Models
  • Understanding Instruments
  • Understanding Instruments
  • Example I: Veterans’ Earnings
  • Example I: Exogeneous and Endogenous Variation
  • Example I: Exogeneous and Endogenous Variation
  • Example I: Exogeneous and Endogenous Variation
  • Example I: Exogeneous and Endogenous Variation
  • Inclusion & Exclusion Conditions for Instruments
  • Example Instrument: Relevance
  • Example Instrument: Exogeneity
  • Exogeneity: The “Huh?” Factor
  • Good Instruments are Hard to Find (And Weird) I
  • Good Instruments are Hard to Find (And Weird) II
  • Exogeneity: The “Huh?” Factor
  • Good Instruments are Hard to Find (And Weird) III
  • “Testing” the Exclusion Restriction
  • Example: Review
  • Example I: DAG Form
  • Example I: DAG Form
  • Example I: DAG Form
  • Estimating The Effect With Instrumental Variables
  • Estimating The Effect With Instrumental Variables
  • Example: Education
  • Example: Instrument
  • Example: Relevance
  • First-Stage Visualized
  • Exogeneity
  • Reduced Form
  • The Effect We’re After
  • Example in R: estimatr
  • Example in R: fixest
  • Two-Stage Least Squares (2SLS)
  • Instrumental Variables & 2SLS
  • Intuitions from Instruments & 2SLS
  • 2SLS: Advantages
  • 2SLS: Multiple Instruments
  • First Stage: Checking Relevance
  • Aside: The Problem of Weak Instruments
  • Second-Stage
  • Comparing Results
  • Using estimatr or fixest
  • Using estimatr or fixest
  • Another Example: Levitt (2002) I
  • Another Example: Levitt (2002) II
  • Another Example: Levitt (2002) III
  • Another Example: Levitt (2002) IV
  • Another Example: Levitt (2002) V
  • Another Example: AJR (2001) I
  • Another Example: AJR (2001) II
  • Another Example: AJR (2001) III
  • Another Example: AJR (2001) IV
  • Another Example: AJR (2001) V
  • Another Example: AJR (2001) VI
  • Another Example: AJR (2001) VII
  • Another Example: AJR (2001) VIII
  • Simultaneous Causation & Structural Equation Modeling
  • Simultaneous Causation
  • Supply and Demand
  • Supply and Demand
  • Supply and Demand: Simultaneous Causality
  • Supply and Demand: Simultaneous Causality
  • Supply and Demand: Simultaneous Causality
  • Supply and Demand: Simultaneous Causality
  • Demand Example
  • Demand Example
  • Demand Example 😨
  • Demand Example 😨
  • Demand Example With Controls
  • Consider the Causality
  • Instruments
  • Instruments
  • Second Stage
  • Using fixest
  • Comparing
  • f Fullscreen
  • s Speaker View
  • o Slide Overview
  • e PDF Export Mode
  • b Toggle Chalkboard
  • c Toggle Notes Canvas
  • d Download Drawings
  • ? Keyboard Help