The command regife estimates linear models with interactive fixed effects following Bai (2009).
Note: Interactive fixed effects are factor models (loadings x factors). If you want interacted fixed effects (e.g., i.state#i.year), use reghdfe instead.
For an observation i, denote (j_id(i), j_time(i)) the associated pair (id x time). The command estimates models of the form
by finding the coefficients beta, factors (f1, .., fd), and loadings (lambda1, ..., lambdad) that minimize
The command is slow. A much faster implementation is available in Julia.
regife is available on SSC. It requires reghdfe. Using absorb() with multiple variables additionally requires hdfe.
ssc install reghdfe
ssc install regifeTo install the latest version from GitHub:
net install regife, from("https://raw.githubusercontent.com/matthieugomez/regife/main/")regife depvar [indepvars] [if] [in] [weight], ife(idvar timevar, d) [options]
ife(idvar timevar, d)specifies the id variable, time variable, and the dimensiondof the factor model.
absorb(absvar [...])absorbs standard fixed effects (passed toreghdfe). Example:absorb(state year).vce(vcetype)specifies the variance-covariance estimator:unadjusted(default),robust,bootstrap, orcluster clustvar. Monte Carlo evidence suggests bootstrap performs better in finite samples.residuals(newvar)saves residuals to a new variable.tolerance(#)convergence tolerance; default1e-9.maxiterations(#)maximum iterations; default10000.bstart(matrix)provides a starting value for the coefficient vector.
Weights (fweight, aweight, pweight) are supported but must be constant within idvar.
ife extracts factors and loadings from a single variable (without regression). This is useful for 3-step estimation: extract factors from a variable, then use them as controls in a second regression.
ife varname [if] [in] [weight], factors(idvar timevar, d) [absorb(absvar) residuals(newvar)]
webuse nlswork
keep if id <= 100
regife ln_w tenure, ife(id year, 1)Impose id and/or time fixed effects alongside the interactive fixed effects:
regife ln_w tenure, ife(id year, 2) absorb(id year)Specify new variable names at the left-hand side of = inside ife():
regife ln_w tenure, ife(ife_id=id ife_year=year, 2)This creates variables ife_id1, ife_id2 (loadings) and ife_year1, ife_year2 (factors). Similarly for absorb():
regife ln_w tenure, absorb(fe_id=id) ife(ife_id=id ife_year=year, 2)regife ln_w tenure, ife(id year, 2) residuals(newres)regife ln_w tenure, ife(id year, 1) vce(bootstrap)
regife ln_w tenure, ife(id year, 1) vce(bootstrap, cluster(id))ife ln_w, factors(fei=id fey=year, 2) absorb(id) residuals(res)This decomposes ln_w (after absorbing the id fixed effect) into loadings (fei1, fei2), factors (fey1, fey2), and residuals (res).
The command handles unbalanced panels (i.e., missing observations for a given id-time pair) as described in the appendix of Bai (2009).
Interactive fixed effects are useful when unobserved heterogeneity has a factor structure -- for instance, when units respond differently to common shocks. Some applications:
- Eberhardt, Helmers, Strauss (2013) Do Spillovers Matter When Estimating Private Returns to R&D?
- Hagedorn, Karahan, Manovskii (2015) Unemployment Benefits and Unemployment in the Great Recession: The Role of Macro Effects
- Hagedorn, Karahan, Manovskii (2015) The Impact of Unemployment Benefit Extensions on Employment: The 2014 Employment Miracle?
- Totty (2015) The Effect of Minimum Wages on Employment: A Factor Model Approach
Standard errors are obtained by regressing y on x and covariates of the form i.id#c.factor and i.time#c.loading, as suggested in Section 6 of Bai (2009). Monte Carlo evidence suggests bootstrap standard errors (vce(bootstrap)) perform better in finite samples.
No. In the presence of cross-sectional or time-series correlation beyond the factor structure, the estimator for beta is consistent but biased (see Theorem 3 in Bai 2009, which derives the correction term in special cases). This package does not implement any bias correction. You may want to check that your residuals are approximately i.i.d.
Fix cluster bootstrap. In previous versions, vce(bootstrap, cluster()) silently ignored the absorb() option and used the wrong panel id for resampling when variable names were abbreviated. Point estimates from regife without bootstrap were unaffected. Standard errors from vce(bootstrap) without cluster() were also unaffected.
Remove error when N < T. Preserve tsset.
Correct weight handling.
Correct normalization for loadings.
First release.
Bai, Jushan. Panel Data Models with Interactive Fixed Effects. Econometrica, 2009.
Matthieu Gomez, 2015. "REGIFE: Stata module to estimate linear models with interactive fixed effects."
Statistical Software Components, Boston College Department of Economics.
https://ideas.repec.org/c/boc/bocode/s458042.html

