EconPapers    
Economics at your fingertips  
 

ESREG: Stata module to estimate the endogenous switching regression with heterogeneous selection on gains

Abdelkrim Araar

Statistical Software Components from Boston College Department of Economics

Abstract: esreg estimates the endogenous switching regression (the Roy model with two regimes): a probit selection equation and an outcome equation for each regime, by full-information maximum likelihood or by a two-step estimator whose variance is that of the whole procedure (stacked moments). It reports the treatment effects ATT, ATU and ATE and the selection on gains, kappa = rho1 sigma1 - rho0 sigma0, constant or heterogeneous in the covariates (kappa(x)), with standard errors from the influence functions of the whole procedure (the estimation of the parameters, the averaging over the units and their covariance), by observation, by cluster or through the survey design (svyset: the svy prefix for the likelihood, vce(svy) for the two-step). An augmented two-step adds Hermite terms, in both regimes or in one, when the conditional mean of the regime errors is not linear. A family of post-estimation commands checks the assumptions one by one: esrdiag (strength, variation and support of the selection equation), esrtest (specification of the index, sufficiency of the instruments, constant kappa, normality by regime, and a pseudo-difference-in-differences on the index), esrcurve (the effect by quantile group of the score), esrmte (the marginal treatment effect, parametric and semiparametric) and esrreport (a reading of the results and the route to report). A dialog box and help examples run from clickable links are included. The commands are validated against etregress, movestay, msat and a Python reference implementation, and their standard errors against brute-force influence functions. A technical note documents the model, the tests and the estimators; it is included as an ancillary file (esreg_technical_note.pdf).

Language: Stata
Requires: Stata version 16
Keywords: endogenous switching regression; Roy model; treatment effects; selection on gains; marginal treatment effect; control function; survey design (search for similar items in EconPapers)
Date: 2026-10-05
Note: This module should be installed from within Stata by typing "ssc install esreg". The module is made available under terms of the MIT license (https://opensource.org/licenses/MIT).
References: Add references at CitEc
Citations:

Downloads: (external link)
http://fmwww.bc.edu/repec/bocode/e/esreg.ado
http://fmwww.bc.edu/repec/bocode/e/esreg.dlg
http://fmwww.bc.edu/repec/bocode/e/esreg.sthlp
http://fmwww.bc.edu/repec/bocode/e/esr_kx.dta
http://fmwww.bc.edu/repec/bocode/e/esr_nonlin.dta
http://fmwww.bc.edu/repec/bocode/e/esr_wt.dta
http://fmwww.bc.edu/repec/bocode/e/esrcurve.ado
http://fmwww.bc.edu/repec/bocode/e/esrcurve.sthlp
http://fmwww.bc.edu/repec/bocode/e/esrdiag.ado
http://fmwww.bc.edu/repec/bocode/e/esrdiag.sthlp
http://fmwww.bc.edu/repec/bocode/e/esreg_engine.ado
http://fmwww.bc.edu/repec/bocode/e/esreg_examples.ado
http://fmwww.bc.edu/repec/bocode/e/esreg_lf1.ado
http://fmwww.bc.edu/repec/bocode/e/esreg_mata.ado
http://fmwww.bc.edu/repec/bocode/e/esreg_p.ado
http://fmwww.bc.edu/repec/bocode/e/esreg_postestimation.sthlp
http://fmwww.bc.edu/repec/bocode/e/esrmte.ado
http://fmwww.bc.edu/repec/bocode/e/esrmte.sthlp
http://fmwww.bc.edu/repec/bocode/e/esrreport.ado
http://fmwww.bc.edu/repec/bocode/e/esrreport.sthlp
http://fmwww.bc.edu/repec/bocode/e/esrtest.ado
http://fmwww.bc.edu/repec/bocode/e/esrtest.sthlp
http://fmwww.bc.edu/repec/bocode/_/_esreg_data.ado
http://fmwww.bc.edu/repec/bocode/_/_esreg_effects_post.ado
http://fmwww.bc.edu/repec/bocode/_/_esreg_esample.ado
http://fmwww.bc.edu/repec/bocode/_/_esreg_getest.ado
http://fmwww.bc.edu/repec/bocode/_/_esreg_ifcov.ado
http://fmwww.bc.edu/repec/bocode/_/_esreg_pwr.ado
http://fmwww.bc.edu/repec/bocode/e/esreg_returns.txt
http://fmwww.bc.edu/repec/bocode/e/esreg_technical_note.pdf

Related works:
This item may be available elsewhere in EconPapers: Search for items with the same title.

Export reference: BibTeX RIS (EndNote, ProCite, RefMan) HTML/Text

Persistent link: https://EconPapers.repec.org/RePEc:boc:bocode:s459922

Ordering information: This software item can be ordered from
http://repec.org/docs/ssc.php

Access Statistics for this software item

More software in Statistical Software Components from Boston College Department of Economics Boston College, 140 Commonwealth Avenue, Chestnut Hill MA 02467 USA. Contact information at EDIRC.
Bibliographic data for series maintained by Christopher F Baum ().

 
Page updated 2026-10-16
Handle: RePEc:boc:bocode:s459922