I created a dataset using following codes
And I regressed the model with "reghdfe" command according to the following code:
I found the estimate results are completely the same whether I added constant or not.
while I regressed the model with "reg" command according to:
the estimate results are different.
I plot the coefficient like this:


I am so confused about the difference where only regression command are changed. I compared the result 1 with result 3, and found the estimation are the same. So theoretically result 2 and 4 should be the same, but it's NOT.
I was wondering what exactly the difference between "reghdfe" and "reg" and "noconstant" option is meaningful in reghdfe ?
Thanks for Answering
Best regards!
Code:
clear set obs 100 gen id = _n expand 10 bysort id : gen year = 2000 + _n -1 xtset id year gen z = rnormal() gen u = rnormal() gen x = 3 * z + u +rnormal() gen y = 6 + 3*x + u
Code:
reghdfe y x z, a(i.id i.year) // model1 est sto r1 reghdfe y x z, a(i.id i.year) noconstant // model2 est sto r2
while I regressed the model with "reg" command according to:
Code:
reg y x z i.id i.year // model3 est sto reg1 reg y x z i.id i.year ,noconstant // model4 est sto reg2
I plot the coefficient like this:
I am so confused about the difference where only regression command are changed. I compared the result 1 with result 3, and found the estimation are the same. So theoretically result 2 and 4 should be the same, but it's NOT.
I was wondering what exactly the difference between "reghdfe" and "reg" and "noconstant" option is meaningful in reghdfe ?
Thanks for Answering
Best regards!
Comment