reghdfe 有效解决数据众多时加入固定效应的问题 Linear and instrumental-variable/GMM regression absorbing multiple levels of fixed effects 公卫考场
reghdfe is a generalization of areg (and xtreg,fe, xtivreg,fe) for multiple levels of fixed effects (including heterogeneous slopes),
alternative estimators (2sls, gmm2s, liml), and additional robust standard errors (multi-way clustering, HAC standard errors, etc).
Additional features include:
a) A novel and robust algorithm to efficiently absorb the fixed effects (extending the work of Guimaraes and Portugal, 2010).
b) Coded in Mata, which in most scenarios makes it even faster than areg and xtreg for a single fixed effect (see benchmarks on the Github page).
c) Can save the point estimates of the fixed effects (caveat emptor: the fixed effects may not be identified, see the references).
d) Calculates the degrees-of-freedom lost due to the fixed effects (note: beyond two levels of fixed effects, this is still an open
problem, but we provide a conservative approximation).
e) Iteratively removes singleton groups by default, to avoid biasing the standard errors (see ancillary document).
安装：ssc install reghdfe
Sergio Correia, Fuqua School of Business, Duke University