Bartik instrument exploration in R
Paul Goldsmith-Pinkham and co-authors have a nice paper on "shift share" or Bartik instruments that I'm working my way through. Whenever I'm doing some econometric exploration, I like to create a simulation where I "know" the right answer and confirm I can recover it with the method. I was doing this for the Bartik instrument and thought other people might find it useful to see a simple example.
And here we have the results---the biased OLS in the left column, and the IV estimate in the right column. We can see that w/ our 1,000 example, we can recover the correct supply elasticity (in the code, I passed an elasticity of labor supply of 1).
Dependent variable:
----------------------------
y
(1) (2)
-----------------------------------------------------------
x -0.499***
(0.027)
`x(fit)` 1.001***
(0.110)
Constant 1.042*** -0.0004
(0.020) (0.077)
-----------------------------------------------------------
Observations 1,000 1,000
R2 0.249 -2.000
Adjusted R2 0.249 -2.003
Residual Std. Error (df = 998) 0.177 0.354
===========================================================
Note: *p<0.1; **p<0.05; ***p<0.01