degruyter.com uses cookies to store information that enables us to optimize our website and make browsing more comfortable for you. To learn more about the use of cookies, please read our Privacy Policy. OK

An Algorithm to Estimate the Two-Way Fixed Effects Model

Paulo Somaini 1  and Frank A. Wolak 2
  • 1 Department of Economics, MIT, Cambridge, MA, USA
  • 2 Department of Economics, Stanford University, Stanford, CA, USA
Paulo Somaini and Frank A. Wolak

Abstract

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.

    • Supplementary material
  • Abowd, J. M., F. Kramarz, and D. N. Margolis (1999): “High Wage Workers and High Wage Firms,” Econometrica 67 (2): 251–333.

    • Crossref
    • Export Citation
  • Arellano, M. 1987. “Computing Robust Standard Errors for Within-Groups Estimators.” Oxford Bulletin of Economics and Statistics 49 (4): 431–434.

    • Crossref
    • Export Citation
  • 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.

    • Crossref
    • Export Citation
  • 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.

    • Crossref
    • Export Citation
  • Cornelissen, T. 2008. “The Stata Command Felsdvreg to Fit a Linear Model with Two High-Dimensional Fixed Effects.” Stata Journal 8 (2): 170–189.

    • Crossref
    • Export Citation
  • 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.

  • Davis, P. 2002. “Estimating Multi-Way Error Components Models with Unbalanced Data Structures.” Journal of Econometrics 106 (1): 67–95.

    • Crossref
    • Export Citation
  • Frisch, R., and F. V. Waugh. 1933. “Partial Time Regressions as Compared with Individual Trends.” Econometrica 1 (4): 387–401.

    • Crossref
    • Export Citation
  • Gaure, S. 2013a. “Lfe: Fitting Linear Models with Multiple Factors with Many Levels.” The R Journal 5(2): 104–116.

    • Crossref
    • Export Citation
  • Gaure, S. 2013b. “OLS with Multiple High Dimensional Category Variables.” Computational Statistics & Data Analysis 66: 8–18.

    • Crossref
    • Export Citation
  • Giles, D. E. A. 1984. “Instrumental Variables Regressions Involving Seasonal Data.” Economics Letters 14 (4): 339–343.

    • Crossref
    • Export Citation
  • 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.

  • Guimaraes, P., and P. Portugal. 2010. “A Simple Feasible Procedure to Fit Models with High-Dimensional Fixed Effects.” Stata Journal 10 (4): 628–649.

    • Crossref
    • Export Citation
  • Hayashi, F. 2000. Econometrics. Princeton: Princeton University Press.

  • Lovell, M. C. 1963. “Seasonal Adjustment of Economic Time Series and Multiple Regression Analysis.” Journal of the American Statistical Association 58 (304): 993–1010.

    • Crossref
    • Export Citation
  • Lovell, M. C. 2008. “A Simple Proof of the FWL Theorem.” The Journal of Economic Education 39 (1): 88–91.

    • Crossref
    • Export Citation
  • Ouazad, A. 2008. “A2REG: Stata Module to Estimate Models with Two Fixed Effects,” Statistical Software Components S456942, Boston College, Department of Economics.

  • Stock, J. H., and M. W. Watson. 2008. “Heteroskedasticity-Robust Standard Errors for Fixed Effects Panel Data Regression.” Econometrica 76 (1): 155–174.

    • Crossref
    • Export Citation
  • Wansbeek, T., and A. Kapteyn. 1989. “Estimation of the Error-Components Model with Incomplete Panels.” Journal of Econometrics 41 (3): 341–361.

    • Crossref
    • Export Citation
  • Wooldridge, J. M. 2010. Econometric Analysis of Cross Section and Panel Data. 2nd ed. Cambridge, Mass: The MIT Press.

Purchase article
Get instant unlimited access to the article.
$42.00
Log in
Already have access? Please log in.


or
Log in with your institution

Journal + Issues

The Journal of Econometric Methods aims to bridge the widening gap between econometric research and empirical practice. It publishes papers from top scholars in all areas of econometrics that consider a topic of broad interest to practitioners and are written in a style that is targeted at practitioners.

Search