Today

Multiple Instruments

IV model with multiple instruments

Interpretation: Causal Graph (code)

#Library to create and analyze causal graphs
library(dagitty) 
library(ggdag) #library to plot causal graphs
#create graph
iv2graph<-dagify(Y1~Y2+Z1+W,Y2~Z1+Z2+W,Z2~Z1) 
#Set position of nodes 
  coords<-list(x=c(Y2 = 0, W = 1, Y1 = 2, Z1=-1, Z2=-1),
          y=c(Y2 = 0, W = 0.1, Y1 = 0, Z1=0.1,Z2=0)) 
  coords_df<-coords2df(coords)
  coordinates(iv2graph)<-coords2list(coords_df)
  #Plot causal graph
ggdag(iv2graph)+theme_dag_blank()+labs(title="Multivariate IV") 

Interpretation: Causal Graph

IV assumptions

Many excluded instruments

Example: Incarceration and crime

Finding the “right” linear combination

Implementing 2SLS

2SLS assumptions

Results

Example: Cigarette Demand with controls (Code)

#Load library containing IV command 'ivreg' 
library(AER)
# Load data on cigarette prices and quantities
data("CigarettesSW")
#Use real prices as X
CigarettesSW$rprice <- with(CigarettesSW, 
                            price/cpi)
#Use changes in cigarette tax 
# as supply curve shifting instrument
CigarettesSW$tdiff <- with(CigarettesSW, 
                           (taxs - tax)/cpi)
#data from different states in 1995
c1995 <- subset(CigarettesSW, 
                year == "1995")

Example: Cigarette Demand with controls

Results (Code 1)

#To get IV estimate of effect of x on y using
#  z as instrument syntax is 
# ivreg(y1 ~ y2 + z1 + ... + zk | z1 + ... + zm)
# Effect of log(price) on log(quantity) 
# controlling for income
# Elasticity
fm_ivreg <- ivreg(log(packs) ~ log(rprice) + income 
                  | tdiff + income, data = c1995)
#Obtain (robust) standard errors
ivresults<-coeftest(fm_ivreg, 
         vcov = vcovHC(fm_ivreg, type = "HC0"))

Results (Code 2)

#Compare to simple IV (no controls), 
#first stage, and reduced form
fm_ols<-lm(log(packs) ~ log(rprice) + income,
           data=c1995)
fm_simpleIV<-ivreg(log(packs) ~ log(rprice) 
                  | tdiff, data = c1995)
fm_firststage<-lm(log(rprice)~tdiff + income,
                  data = c1995)
fm_reducedform<-lm(log(packs)~tdiff + income,
                   data = c1995)

Results (Code 3)

#Obtain robust standard errors for each
fm_ols.coef<-coeftest(fm_ols, 
    vcov = vcovHC(fm_ols, type = "HC0"))
fm_simpleIV.coef<-coeftest(fm_simpleIV, 
    vcov = vcovHC(fm_simpleIV, type = "HC0"))
fm_firststage.coef<-coeftest(fm_firststage, 
    vcov = vcovHC(fm_firststage, type = "HC0"))
fm_reducedform.coef<-coeftest(fm_reducedform, 
    vcov = vcovHC(fm_reducedform, type = "HC0"))

Results (Code 4)

library(stargazer)
stargazer(fm_simpleIV.coef,ivresults,fm_ols.coef,
    type="html",header=FALSE,no.space=TRUE,
    title="2SLS, OLS, Simple IV",
    column.labels=c("Simple IV"), # "2SLS","OLS",
    omit.table.layout="nl")

Results

2SLS, OLS, Simple IV
2SLS OLS Simple IV
(1) (2) (3)
log(rprice) -0.919*** -1.107*** -1.084***
(0.312) (0.187) (0.312)
income -0.000* -0.000
(0.000) (0.000)
Constant 8.974*** 9.865*** 9.720***
(1.487) (0.894) (1.496)

2SLS vs First Stage and Reduced Form (Code)

stargazer(ivresults,fm_firststage.coef,fm_reducedform.coef,
    type="html",header=FALSE,no.space=TRUE,
    title="2SLS, First Stage, and Reduced Form",
    column.labels=c("log(packs)",
                    "log(rprice)",
                    "log(packs)"), 
    omit.table.layout="n")

2SLS vs First Stage and Reduced Form

2SLS, First Stage, and Reduced Form
Dependent variable:
log(packs) log(rprice) log(packs)
(1) (2) (3)
log(rprice) -0.919***
(0.312)
tdiff 0.029*** -0.026***
(0.005) (0.010)
income -0.000* 0.000 -0.000***
(0.000) (0.000) (0.000)
Constant 8.974*** 4.610*** 4.738***
(1.487) (0.028) (0.063)

Multiple endogenous variables

\[E[Y_{-1i}u_i]\neq 0\]

Alternate Representation of 2SLS

Full 2SLS

2SLS assumptions

Results

2SLS inference

Failure of relevance

Testing endogeneity

Testing IV Assumptions: Exclusion

Conclusions