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

Option of absorbing continuous variables #255

Open KiraJYQiu opened 2 years ago

KiraJYQiu commented 2 years ago

Hi developers, Is there an option of absorbing variables as continuous? The current absorb options absorbs variables as categorical (fixed effects). For some control variables, I need to include them into the model but I don't need to know their coefficients. Calculating the coefficients of all continuous variables may require much more computation than what I actually need. When there are many continuous variables in the model, my computer can't provide sufficient memory for Stata to perform the regression.

sergiocorreia commented 2 years ago

Something like this should work:

clear
sysuse auto
gen byte c = 1
reghdfe price weight, a(c##c.(headroom trunk length) turn)

Basically, you create the fake variable "c" and then in the inner parenthesis you put all the continuous vars you don't care about.

Also, on memory, look at the compact and poolsize options. Particularly poolsize, which if you set to a low number (like "poolsize(4)" it works great at reducing memory.

Let me know if this works, S

KiraJYQiu commented 2 years ago

Thanks Sergio This method works on my dataset. In addition, is there a way to absorb c.var1#c.var2 and c.var1#c.var2#c.var3? My model has a lot of such interactions.