------------------------------------------------------------------------------- help forreg2hdfe() -------------------------------------------------------------------------------Titlereg2hdfe - Estimates a Linear Regression Model with two High Dimensional Fixed > Effects.

Syntax

reg2hdfedepvar[indepvar] [if] [in] ,id1(varname)id2(varname)[options]

DescriptionThis command implements the algorithm of Guimaraes & Portugal for estimation of a linear regression model with two high dimensional fixed effects. The command is particularly suited for use with large data sets because in a first step you can remove the high dimensional fixed effects from the data and then use the transformed regression variables to try alternative specifications of the model.

Options

fe1(new varname)fe2(new varname): Stores the estimates of the two fixed effects.

cluster(varname)Computes clustered standard errors.

groupid (new varname)Creates a new variable containing a unique identifier for the mobility groups.

outdata(string)Saves the transformed regression variables.

indata(string)To be used afteroutdata(string). Performs the regression with previously transformed variables. This is the fastest way to implement regressions.

improve(string)To be used afteroutdata(string). Improves convergence for a single variable.

tol(float)Specify the convergence criterion for the iteration method. Default is 1.000e-06.

simpleDisables acceleration of convergence for the algorithm.

op1(integer)Iteration number after which convergence is accelerated. Default is 3.

op2(integer)Parameter that defines the rate of acceleration at every iteration of the algorithm. Default is 1. The parameter is adjusted as the algorithm evolves. If convergence is monotonous the parameter is increased and if the algorithm starts diverging the parameter goes back to its default value.

op3(integer)Parameter that defines a periodic attempt to accelerate convergence. Default is 10. This means that every 10 iterations the algorithm tries an additional correction to improve convergence.

op4(integer)Parameter that defines the rate of acceleration for the periodic correction. Default is 1000.

op5(integer)Periodic corrections are only applied if estimated values in two consecutived periodic corrections differ by less than this parameter. The default is 0.001.

autoff(integer)Parameter OP2 remains at its base level.

checkChecks for convergence by computing additional regressions that use the fixed effects estimates as regressors. With successful convergence the coefficients for the fixed effects should equal one. To check convergence of the final regression you must store the two fixed effects (use optionsfe1()andfe2()).

maxiter(integer)Specify a maximum number of iterations.

nodotsSuppress dots indicating the progress of the iteration algorithm.

noregressTransforms the variables but does not estimate the regression.

param1The estimates of the fixed effects for id1() sum to zero within each group.

param2The estimates of the fixed effects for id2() sum to zero within each group.

verboseGives more information during estimation.

ExamplesExample 1: Estimates a model with two high dimensional fixed effects

. reg2hdfe y x1 x2 x3, id1(i) id2(j)

Example2:

Estimate a model saving the transformed variables

. reg2hdfe y x1 x2 x3, id1(i) id2(j) outdata(data1)

and then run a (much faster) alternative specification.

. reg2hdfe y x1 x2, id1(i) id2(j) indata(data1) Example 3:

For faster results estimate a model with a low tolerance level.

. reg2hdfe y x1 x2 x3, id1(i) id2(j) outdata(data1) check tol(0.001)

The "check" option gives an idea how well the model converged. Next we improve convergence for a single variable, say x1,

. reg2hdfe x1, id1(i) id2(j) improve(data1) check tol(0.000001)

and then reestimate the model.

. reg2hdfe y x1 x2, id1(i) id2(j) indata(data1) check

AuthorPaulo Guimaraes, Universidade do Porto, Portugal

Email: pguimaraes@fep.up.pt

Comments welcome!

This program makes use of Amine Quazad's a2group Stata algorithm to compute the > connected groups.Acknowledgements

ReferenceIf you use this program in your research cite:

Paulo Guimaraes and Pedro Portugal. "A Simple Feasible Alternative Procedure to > Estimate Models with High-Dimensional Fixed Effects", Stata Journal, 10(4), 628-649, 2010.

Also seegpreg (if installed), a2reg (if installed), a2group (if installed), felsdvreg (if installed).