eststo stores a copy of the active estimation results for later tabulation.
It is an alternative to official Stata's
estimates store. The basic syntax
of eststo is:
eststo [name] [, options ] [: estimation_command ]
eststo may be applied analogous to official Stata's
estimates store. Example:
. sysuse auto, clear (1978 Automobile Data) . regress price weight mpg (output omitted) . eststo model1 . regress price weight mpg foreign (output omitted) . eststo model2 . estimates table model1 model2 ---------------------------------------- Variable | model1 model2 -------------+-------------------------- weight | 1.7465592 3.4647058 mpg | -49.512221 21.853604 foreign | 3673.0604 _cons | 1946.0687 -5853.6957 ---------------------------------------- . eststo clearCode
eststo clear on the last line of the example erases the estimation sets
that have been stored by eststo.
A main advantage of eststo over
estimates store is that it
does not require the user to specify a name for the stored estimates. Example:
. sysuse auto, clear (1978 Automobile Data) . regress price weight mpg (output omitted) . eststo (est1 stored) . regress price weight mpg foreign (output omitted) . eststo (est2 stored) . esttab -------------------------------------------- (1) (2) price price -------------------------------------------- weight 1.747** 3.465*** (2.72) (5.49) mpg -49.51 21.85 (-0.57) (0.29) foreign 3673.1*** (5.37) _cons 1946.1 -5853.7 (0.54) (-1.73) -------------------------------------------- N 74 74 -------------------------------------------- t statistics in parentheses * p<0.05, ** p<0.01, *** p<0.001 . eststo clearCode
eststo keeps a list of the names of the stored estimation sets. If, as above, esttab (or estout) is applied without specifying the names of the sets to be tabulated, all sets stored by eststo are tabulated.
eststo may be used as a prefix command:
. sysuse auto, clear (1978 Automobile Data) . eststo: quietly regress price weight mpg (est1 stored) . eststo: quietly regress price weight mpg foreign (est2 stored) . esttab -------------------------------------------- (1) (2) price price -------------------------------------------- weight 1.747** 3.465*** (2.72) (5.49) mpg -49.51 21.85 (-0.57) (0.29) foreign 3673.1*** (5.37) _cons 1946.1 -5853.7 (0.54) (-1.73) -------------------------------------------- N 74 74 -------------------------------------------- t statistics in parentheses * p<0.05, ** p<0.01, *** p<0.001 . eststo clearCode
If eststo is used as a prefix command, the by command
is allowed to obtain results for different groups of observations:
. sysuse auto, clear (1978 Automobile Data) . by foreign: eststo: quietly reg price weight mpg --------------------------------------------------------------------------------------- -> Domestic (est1 stored) --------------------------------------------------------------------------------------- -> Foreign (est2 stored) . esttab, label nodepvar nonumber ---------------------------------------------------- Domestic Foreign ---------------------------------------------------- Weight (lbs.) 4.415*** 5.156*** (4.66) (5.85) Mileage (mpg) 237.7 -19.78 (1.71) (-0.34) Constant -13285.4* -5065.8 (-2.32) (-1.58) ---------------------------------------------------- Observations 52 22 ---------------------------------------------------- t statistics in parentheses * p<0.05, ** p<0.01, *** p<0.001 . eststo clearCode
eststo can add extra results to the e()-scalars
while storing the estimates and thus make them available for
tabulation. Example:
. sysuse auto, clear (1978 Automobile Data) . regress price weight mpg (output omitted) . test weight = mpg ( 1) weight - mpg = 0 F( 1, 71) = 0.36 Prob > F = 0.5514 . eststo, addscalars(p_diff r(p)) (e(p_diff) = .55138216 added) (est1 stored) . esttab, scalars(p_diff) obslast ---------------------------- (1) price ---------------------------- weight 1.747** (2.72) mpg -49.51 (-0.57) _cons 1946.1 (0.54) ---------------------------- p_diff 0.551 N 74 ---------------------------- t statistics in parentheses * p<0.05, ** p<0.01, *** p<0.001 . eststo clearCode
Functionality of the addscalars()
option is limited to adding scalars. See the estadd
command for a more powerful tool to add results to stored estimates.
eststo can store the estimates without the e(sample)
function. Excluding e(sample) saves memory and speeds up
tabulation programs. Example:
. sysuse auto, clear (1978 Automobile Data) . eststo: quietly regress price weight mpg (est1 stored) . eststo, noesample: quietly regress price weight mpg (est2 stored) . _eststo: quietly regress price weight mpg (est3 stored) . estimates dir ------------------------------------------------------- name | command depvar npar title -------------+----------------------------------------- est1 | regress price 3 est2 | regress price 3 est3 | regress price 3 ------------------------------------------------------- . describe _est* storage display value variable name type format label variable label --------------------------------------------------------------------------------------- _est_est1 byte %8.0g esample() from estimates store . eststo clearCode
_eststo is a synonym for eststo with the
noesample option specified
Be aware that some post-estimation commands may not work correctly
with estimates that do not contain the e(sample).