I am replicating a paper in an economic journal which uses an unbalanced panel of firms over 10 year period. The main specification in the paper is a two-way fixed effects model with firm and year fixed effects. Usually, I think the model would be straightforward as I either could use -xtreg- control for i.year or -reghdfe- with a(firm year) option. However, the author estimate this simple model this way:
1. First, they demeaned the model by(firm)
2. Then they estimate the already demeaned model using reg and control for dummy i.year
This is strange for me because I always thought that the authors' approach is only equivalent to the first one when the panel is balanced. Indeed, I check manually and the two approaches come up with totally different results. The author didn't explain why they did this in the paper but this is what they did in their published code. I think their approach is inappropriate but couldn't figure out why the authors did that. In another specification, they use IV for their model but they implemented the same way and use -ivregress- in the second step. I use -xtivreg- and -reghdfe- to come up with different results from them.
I would appreciate your thoughts on these two approach. Thanks a lot. Sample code of two approach is attached.
Authors' code
HTML Code:
for var tfp* mum1 ltar_* lmaxt_* YY* logy logl logx SOE PRI share outputr: egen MX=mean(X), by(firm) for var tfp* mum1 ltar_* lmaxt_* YY* logy logl logx SOE PRI: gen DX=X-MX for var tfpA mum1: xi: ivregress 2sls DX (Dltar_* = Dlmaxt_*) i.year , cluster(ccyy) \ estimates store FE1_X
HTML Code:
for var tfpA mum1: reghdfe DX (Dltar_* = Dlmaxt_*), a(firm year) vce(cluster firm ccyy)
0 Response to Two-way fixed effects in unbalanced panel
Post a Comment