xtheckmanfe -- CRE Panel data models in the presence of endogeneity and selection

Syntax

Panel data models in the presence of endogeneity and selection

xtheckmanfe depvar indepvars [if] [in]
[,
selection(selection Equation)
[endogenous(endogenous equation/s) id(id variable) time(time variable) reps(#repetitions) seed()]

where selection equation is specified as

( [selection variable] = [instruments1] )

and the endogenous equations are specified as

( [endogenous variables] = [instruments2] )

Model
selection(sel Eq) specifies the selection equation. The selection variable svar should be =1 if observation
i is observed at time t, and =0 otherwise. If no selection variable is specified (no "=" included), selection is defined of wheter the
main dependent variable is observed or not.

endogenous(endog Eq(s)) specifies the endogenous variables in the model. The model can have one or more
endogenous variables, which are defined as all variables to the left of the equal sign. All variables on the right of the equal sign
are used as instruments.

id(varname) specifies the panel identifier variable. if both id and time are not specified, and panel data has been set,
the command will use information from svyset as default. Othewise Both must be specified.

time(varname) specifies the time identifier variable. if both id and time are not specified, and panel data has been set,
the command will use information from svyset as default. Othewise Both must be specified.

reps(#) specifies the number of bootstrap samples that will be used for the estimation of standard errors. Default is 50

seed(#) specifies the seed for the generation of bootstrap random samples. Used for replication.

ml Request the estimation using a -pseudo- two-step by mle. See Rios-Avila & Canavire-Bacarreza (2018). This option is not available for cases with
endogenous variables.

Weights are not allowed

Description

xtheckmanfe implements the estimation of panel data with selection and endogenous variables, as proposed by Wooldridge(1995)
and Semykina and Wooldridge (2010), based on the parametric correction, and applying Mundlak's (1978) modeling device to model.
This is in fact, a correlated random effects model.

This estimator assumes that you have at least an instrument for the selection equation, as well as one instrument for each endogenous variable in the model.

As such, the selection equation will use as explanatory variables ALL exogenous variables of the outcome model, the instruments for the endogenous variables,
and the instruments for the selection process.

If endogeneity exists, this equation will use as explanatory variables ALL exogenous variables of the outcome model, the inverse mills ratio from the selection equation,
and the instruments to address endogeneity.

To account for sample selection, the command uses the interaction of the Inverse mills ratios with the time variable in the model specification.

Standard errors of the model are obtained using a panel bootstrap procedure, using the panel id as cluster.

If the model assumes selection problem only, one can requests the pseudo two-step approach, which is estimated via -ml-. This standard errors,
which are cluster by the panel id, would already be corrected for the two-step approach. However, because selection and outcome are
estimated jointly, point estimates will differ from the bootstrap approach.

Internally, the command creates auxiliary variables with the prefix "_mn_",
that store the individual specific averages for all exogenous variables.
The command also creates the variable "_sel_imr", which contains the inverse mills ratio.
This variables are dropped everytime the command is run.

Examples

Setup: Requires you to install ftools

ssc install ftools

For the example, we use the "wagework" data for xtheckman

use http://www.stata-press.com/data/r16/wagework.dta, clear

I first estimate the model using the syntax for the official xtheckman command. The next line is only available for users of Stata 16 or above

xtheckman wage age tenure, select(working = age market)

The results above can be compared to the results of xtheckmanfe

xtheckmanfe wage age tenure, select(working = age market)

Using the pseudo two step approach for xtheckmanfe

xtheckmanfe wage age tenure, select(working = age market) ml

The command above, however, uses the information from xtset. If data is not xtset, it would give you an error

xtset, clear

xtheckmanfe wage age tenure, select(working = age market)

In which case you need to xtset the data, or provide the id and time variables:

xtheckmanfe wage age tenure, select(working = age market) id(personid) time(year)

Finally, because "age" is already defined in the outcome variable, it is unnecessary to include it in the selection model as well:

xtheckmanfe wage age tenure, select(working = market) id(personid) time(year)

Acknowledgments

This command was written with the intention of presenting this methodology for an econometrics class.

The basic structure is based on the dofile written by Anastasia Semykina for the two-step parametric approach
that is posted on her website http://myweb.fsu.edu/asemykina/.

The new approach based on pseudo two-step, is based on the strategies suggested in Rios-Avila and Canavire-Bacarreza (2018).

Program has been tested to work under Stata 13.

Author

Fernando Rios-Avila

Levy Economics Institute of Bard College

Annandale-on-Hudson, NY

friosavi@levy.org

References

Mundlak, Yair. 1978. "On the Pooling of Time Series and Cross Section Data." Econometrica 46 (1):69-85. doi: 10.2307/1913646.

Rios-Avila, Fernando and Canavire-Bacarreza, Gustavo. 2018.
"Standard-error correction in two-stage optimization models: A quasi–maximum likelihood estimation approach"
Stata Journal 18 (1):206-222. doi: 10.1177/1536867X1801800113.

Semykina, Anastasia, and Jeffrey M. Wooldridge. 2010. "Estimating panel data models in the presence of endogeneity and selection."
Journal of Econometrics 157 (2):375-380. doi: https://doi.org/10.1016/j.jeconom.2010.03.039.

Wooldridge, Jeffrey M. 1995. "Selection corrections for panel data models under conditional mean independence assumptions."
Journal of Econometrics 68 (1):115-132. doi: https://doi.org/10.1016/0304-4076(94)01645-G.