We present an algorithm to estimate the two-way fixed effect linear model. The algorithm relies on the Frisch-Waugh-Lovell theorem and applies to ordinary least squares (OLS), two-stage least squares (TSLS) and generalized method of moments (GMM) estimators. The coefficients of interest are computed using the residuals from the projection of all variables on the two sets of fixed effects. Our algorithm has three desirable features. First, it manages memory and computational resources efficiently which speeds up the computation of the estimates. Second, it allows the researcher to estimate multiple specifications using the same set of fixed effects at a very low computational cost. Third, the asymptotic variance of the parameters of interest can be consistently estimated using standard routines on the residualized data.
Arellano, M. 1987. “Computing Robust Standard Errors for Within-Groups Estimators.” Oxford Bulletin of Economics and Statistics 49 (4): 431–434.10.1111/j.1468-0084.1987.mp49004006.xSearch in Google Scholar
Baum, C. F., M. E. Schaffer, and S. Stillman. 2007. “Enhanced Routines for Instrumental Variables/GMM Estimation and Testing.” Stata Journal 7 (4): 465–506.10.1177/1536867X0800700402Search in Google Scholar
Carneiro, A., P. Guimares, and P. Portugal (2012): “Real Wages and the Business Cycle: Accounting for Worker, Firm, and Job Title Heterogeneity,” American Economic Journal: Macroeconomics 4(2): 133–152.10.1257/mac.4.2.133Search in Google Scholar
Correia, S. 2014. “REGHDFE: Stata Module to Perform Linear or Instrumental-Variable Regression Absorbing Any Number of High-Dimensional Fixed Effects,” Statistical Software Components S457874, Boston College Department of Economics.Search in Google Scholar
Guimaraes, P. 2009. “REG2HDFE: Stata Module to Estimate a Linear Regression Model with two High Dimensional Fixed Effects,” Statistical Software Components S457101, Boston College Department of Economics.Search in Google Scholar
Hayashi, F. 2000. Econometrics. Princeton: Princeton University Press.Search in Google Scholar
Lovell, M. C. 1963. “Seasonal Adjustment of Economic Time Series and Multiple Regression Analysis.” Journal of the American Statistical Association 58 (304): 993–1010.10.1080/01621459.1963.10480682Search in Google Scholar
Ouazad, A. 2008. “A2REG: Stata Module to Estimate Models with Two Fixed Effects,” Statistical Software Components S456942, Boston College, Department of Economics.Search in Google Scholar
Stock, J. H., and M. W. Watson. 2008. “Heteroskedasticity-Robust Standard Errors for Fixed Effects Panel Data Regression.” Econometrica 76 (1): 155–174.10.1111/j.0012-9682.2008.00821.xSearch in Google Scholar
Wooldridge, J. M. 2010. Econometric Analysis of Cross Section and Panel Data. 2nd ed. Cambridge, Mass: The MIT Press.Search in Google Scholar
The online version of this article (DOI: 10.1515/jem-2014-0008) offers supplementary material, available to authorized users.
©2016 by De Gruyter