Hi, I am trying to estimate whether the coefficient has changed between two periods using a date dummy (pre- and post-1975). The independent variable is endogenous so I need to use IV. I do not think my implementation is working correctly.
If I do not use interaction effects, when I manually predict the endogenous variables in the first-stage and then apply the second-stage I get the same coefficients as I would from using ivreg2 directly. (Obviously the standard errors are not correct, but for here I am just checking the coeffiicents).
But when I incorporate interactions my results are different. I think it is because the interactions are also being used in the first stage, but i only want to investigate the second stage - and leave the first-stage prediction unchanged.
Here is a reconstructed example:
If I do not use interaction effects, when I manually predict the endogenous variables in the first-stage and then apply the second-stage I get the same coefficients as I would from using ivreg2 directly. (Obviously the standard errors are not correct, but for here I am just checking the coeffiicents).
But when I incorporate interactions my results are different. I think it is because the interactions are also being used in the first stage, but i only want to investigate the second stage - and leave the first-stage prediction unchanged.
Here is a reconstructed example:
Code:
use "http://www.stata-press.com/data/r13/wpi1.dta" , clear *Create endogenous variables gen X1 = wpi*2 + runiform()*200 gen X2 = wpi*0.5 + runiform()*500 *Create exogenous variables gen Z1 = X1 + runiform()*200 gen Z2 = X2 + runiform()*300 *Create date dummy gen post1975 = t>tq(1975q1) *Predict first-stage reg X1 Z1 Z2 predict X1_pred reg X2 Z1 Z2 predict X2_pred * Overall regression ivreg2 wpi (X1 X2 = Z1 Z2), first reg wpi X1_pred X2_pred ** Coefficients match, as expected * Interaction regression ivreg2 wpi (X1 X2 c.X1#i.post = Z1 Z2 c.Z1#i.post c.Z2#i.post) post1975 reg wpi X1_pred X2_pred c.X1_pred#i.post1975 post1975 ** Coefficients do not match. Why not?
Comment