help for a2reg

Estimates linear models with two fixed effects

a2reg depvar indepvars, individual(varname) unit(varname) [ indeffect(name) uniteffect(name) xb(name) resid(name) ]


a2reg estimates two-way fixed effects. individual indexes the first fixed effect, and unit indexes the second fixed effect. The dependent variable is depvar and the covariates are in indepvars. At least one covariate is mandatory.

Identification constraints

The identification constraints for the fixed effects are set by convention such that the sum of individual effects is equal to zero and such that the last unit fixed effect is zero.


The program displays conventional output regression, along with Fisher tests for the significance of fixed effects. However the computation of confidence intervals is not computationally feasible, since it would require the inversion of the variance-covariance matrix. Therefore confidence intervals are not printed.


depvar is the dependent variable. No missing observation is allowed.

indepvars lists explanatory variables. No missing observation is allowed.

individual(varname) is the identifier for the first fixed effect.

unit(varname) is the identifier for the second fixed effect.

indeffect(name) is the name of the output variable for the first fixed effect.

uniteffect(name) is the name of the output variable for the second fixed effect > .

xb(name) is the name of the output variable for the part predicted by the covar > iates.

resid(varname) is the name of the output variable for the resid.


a2reg y x1 x2 , individual(personid) unit(firmid) indeffect(personeffect)


Amine Ouazad, PhD Candidate of the Paris School of Economics, and Research Associate, London School of Economics.

Webpage http://personal.lse.ac.uk/ouazad/

Email a.ouazad@lse.ac.uk


This command started as a port of the FORTRAN cg program that was written by Robert Creecy for Unix platforms. It has now improved it in many ways, providing Fisher tests, interfacing with STATA and commands such as bootstrap.

Please put the following reference in your paper.

Amine Ouazad, Program for the Estimation of Two-Way Fixed Effects, available at > http://personal.lse.ac.uk/ouazad/, 2007.

Also see

a2group (if installed)