Dear statalist,
Can I ask a question about what is the difference between i.d1##i.d2 and d1 d2 i.d1#i.d2? I'm running xtreg, d1 and d2 are two dummies, the DV and control variables are all continuous variables (I use x1 x2 x3 here). I tried 2 codes:
1. xtreg y i.d1##i.d2 x1 x2 x3 i.year, fe vce(robust)
2. xtreg y d1 d2 i.d1#i.d2 x1 x2 x3 i.year, fe vce(robust)
From my understanding, these 2 are equivalent, but I get different results.
So for no.1 the result for the relevant dummies is:
And for no.2 is:
So I wonder:
1. why the coefficient for d2 is different in no.1 and 2, and why the interaction term show exactly the opposite sign?
2. what is the 1 0 and 1 1 in no.2, and why they are omitted?
2. If I want to put d1, d2 and the interaction term in the same regression, which is right?
Can I ask a question about what is the difference between i.d1##i.d2 and d1 d2 i.d1#i.d2? I'm running xtreg, d1 and d2 are two dummies, the DV and control variables are all continuous variables (I use x1 x2 x3 here). I tried 2 codes:
1. xtreg y i.d1##i.d2 x1 x2 x3 i.year, fe vce(robust)
2. xtreg y d1 d2 i.d1#i.d2 x1 x2 x3 i.year, fe vce(robust)
From my understanding, these 2 are equivalent, but I get different results.
So for no.1 the result for the relevant dummies is:
Code:
------------------------------------------------------------------------------ | Robust y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- 1.d1 | .3877818 .2135928 1.82 0.070 -.0310241 .8065876 1.d2 | .2719899 .0192595 14.12 0.000 .2342265 .3097533 | d1#d2 | 1 1 | -.2992672 .2683838 -1.12 0.265 -.8255055 .2269712
Code:
------------------------------------------------------------------------------ | Robust y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- d1 | .3877818 .2135928 1.82 0.070 -.0310241 .8065876 d2 | -.0272773 .2690751 -0.10 0.919 -.5548709 .5003164 | d1#d2 | 0 1 | .2992672 .2683838 1.12 0.265 -.2269712 .8255055 1 0 | 0 (omitted) 1 1 | 0 (omitted)
1. why the coefficient for d2 is different in no.1 and 2, and why the interaction term show exactly the opposite sign?
2. what is the 1 0 and 1 1 in no.2, and why they are omitted?
2. If I want to put d1, d2 and the interaction term in the same regression, which is right?
Comment