*! version 1.0 Aug2014
help regxfe (SJ15-3: st0409)

Title

regxfe -- Fit a linear high-order fixed-effects model

Syntax

regxfe
depvar [indepvars]
[if] [in]
[weight], fe(fe_varlist)
[options]

* fe(fe_varlist) specify the list of fixed effects to use in model; must include between one to seven variables

xfe(str) save estimated fixed effects as a new set of variables

cluster(varname) specify the use of cluster standard errors

robust specify the use of robust standard errors

file(filename) save the transformed dataset to file

replace overwrite and replace the existing dataset if the filename already exists

mg(#) specify the number of degrees of freedom; used for modular implementation

tolerance(#) specify the convergence criteria; default is epsfloat()

maxiter(#) specify the maximum number of iterations allowed; default is maxiter(10000)

* fe() is required.

aweights, fweights, and iweights are allowed; see weight.

Description

regxfe fits a linear high-order fixed-effects model, allowing for up to
seven fixed effects. It allows for the use of weights and robust and one-way
clustered standard errors. Robust and cluster errors are estimated using the
same assumptions as in the regress and areg commands. The
command is based on a pretransformation of the variables to absorb the effect
of the fe_varlist variables of all dependent and independent variables
before fitting the model. The transformed dataset can be saved as a separate
file. The degrees of freedom to estimate the standard errors is corrected
using an approximation of the number of nonidentifiable parameters following
the modified algorithm of Abowd, Creecy, and Kramarz (2002).

Options

fe(varlist:fe_varlist) specifies the fixed effects to use in the model. The user must specify between one to seven variables. The fixed-effects variables should be in
integer, long, or double format to ensure accuracy. fe() is required.

xfe(str) creates new variables using the fixed-effects names and the specified prefix.

cluster(varname) specifies to use one-way clustered standard errors.

robust specifies to use robust standard errors.

file(filename) specifies to save the transformed dataset in
the current folder in a new file.

replace overwrites and replaces existing dataset.

mg(#) specifies the number of degrees of freedom. If mg(#) is specified, the
program uses this number instead of attempting to estimate the degrees of
freedom. This option is recommended if the number of unidentifiable
parameters is estimated externally. (See nredound.)

tolerance(#) specifies the convergence criteria to be used for the
variable transformations. Smaller tolerance levels can achieve
estimates closer to those using the full dummy specification but will also
take a longer time to achieve convergence. The default is epsfloat().

maxiter(#) specifies the maximum number of iterations allowed. A small
number of iterations might reduce the accuracy of the results. The default is
maxiter(10000).

Remarks

The program uses the commands a2group, center,
distinct, and tuples. If not installed, they are installed in
the system the first time that the program is used. See also nredound and
itercenter.

Examples

. webuse nlswork

. regxfe ln_wage age tenure hours union, fe(ind_code occ_code idcode year)

. regxfe ln_wage age tenure hours union, fe(ind_code occ_code idcode year) cluster(idcode)

. regxfe ln_wage age tenure hours union, fe(ind_code occ_code idcode year) xfe(i) file(Tdata)

Modular implementation

For modular implementation, be careful to use exactly the same sample for all commands.

. mark markvar

. markout markvar ln_wage age tenure union year idcode ind_code occ_code year

. itercenter ln_wage age hours if markvar, fe(ind_code occ_code idcode year) mean replace

. itercenter tenure union if markvar, fe(ind_code occ_code idcode year) mean replace

. nredound ind_code occ_code idcode year if markvar

. local x=e(M)

. regxfe ln_wage age tenure hours union if markvar, fe(ind_code occ_code idcode year) maxiter(0) mg(`x')

References

Abowd, J. M., R. H. Creecy, and F. Kramarz. 2002. Computing person and
firm effects using linked longitudinal employer-employee data.
Technical Paper No. TP-2002-06, Center for Economic Studies, U.S. Census
Bureau. http://www2.census.gov/ces/tp/tp-2002-06.pdf.

Rios-Avila, F. 2015. Fit a linear high-order fixed-effects model. Stata Journal 15(3).

Author

Fernando Rios-Avila

Levy Economics Institute of Bard College

Blithewood-Bard College

Annandale-on-Hudson, NY

friosavi@levy.org

Also see

Article: Stata Journal, volume 15, number 3: st0409