sergiocorreia / reghdfe

Linear, IV and GMM Regressions With Any Number of Fixed Effects
http://scorreia.com/software/reghdfe/
MIT License
214 stars 56 forks source link

Is there a way to suppress constant? #258

Open toyokuma opened 2 years ago

toyokuma commented 2 years ago

Dear Sergio,

reghdfeautomatically run an OLS regression with a constant, and the current 'noconstant' option only suppresses the reporting of the constant. Is there a way to run an OLS regression without a constant? I tried to generate a constant variable, and add it into absorb(), so that the constant is absorbed. However, there is still a reported constant there.

e.g. gen cons = 1 reghdfe y x ctrl-vars, absorb(fe-var1 fe-var2 cons)

Is there a way to run an OLS regression without a constant?

Thanks! Toyo

sergiocorreia commented 2 years ago

Hi Toyo,

reghdfe doesn't include constants in the traditional sense, but any model with FEs implicitly has a constant, as the constant can be reproduced as the sum of all the dummies underlying the fixed effect. For instance, if you have country FEs then adding the dummies of each of the countries would give you a vector of 1s.

What reghdfe does is the back-off the constant from the average of the first fixed effect. However, I wonder what exactly are you trying to achieve? EG if in your example you put "cons" first in absorb() then you might be able to do what you are intending.

haoranliu666 commented 1 month ago

I'm facing the same issue here. In a event study setting, where the variables or interest are saturated, using the normal regress, I can discard the constant:

reg y minus3 minus2 minus1 plus0 plus1 plus2 plus3, noconstant

But in reghdfe, the noconstant simply does not report constant, and the estimation of post_plus3 will be automatically dismissed.

reghdfe y minus3 minus2 minus1 plus0 plus1 plus2 plus3, noabsorb noconstant