*! version 1.0.0 18jul2026

Title

xtvsom postestimation -- Using xtvsom after an estimation command

Description

xtvsom may be run immediately after a supported estimation command with an
empty variable list. It then reads the model from e() and applies the
Variance Shift Outlier Model to the observations that were in the estimation
sample.

Supported estimators

xtreg fe -> within (fixed-effects) VSOM design

regress pooled OLS VSOM design

areg, reghdfe treated as fixed-effects

ivregress 2sls, xtivreg simultaneous / 2SLS VSOM design

Any other e(cmd) produces an informative error. If there are no estimation
results, run one of the above first, or call xtvsom standalone with an
explicit depvar indepvars and fe or ols.

What is reused from e()

o Estimation sample - e(sample) defines the observations
VSOM operates on.

o Dependent variable - e(depvar).

o Regressors - the column names of e(b) minus _cons.

o Model - e(model) distinguishes fixed effects; for
ivregress/xtivreg, e(instd) and e(insts) give the
endogenous regressors and instruments used to rebuild the second-stage design.

xtvsom protects the caller's results: it holds e() on entry and
restores it on exit (even on error), so your original xtreg results are
intact afterwards.

Examples

. webuse nlswork

. xtreg ln_wage age tenure hours, fe

. xtvsom, graph

. estat summarize (original xtreg results restored)

. ivregress 2sls y (w = z1 z2) x1 x2, fe

. xtvsom, iv

Author

Dr Merwan Roudane

merwanroudane920@gmail.com

github.com/merwanroudane