ARCHIVED: In Stata, how do I save multiple model estimates to a single table of results?
Stata can store estimates from multiple models, save all
estimates in a single table, and export the table to an external file,
such as rtf, csv, html, tex
, and others. This is possible
with the .esttab
command from the estout
package, which you can install from the Stata packages repository.
Suppose you wish to compare two regression models, only one of which
is estimated with robust clustered errors. Immediately after
estimating each model, store the estimates in Stata memory with the
.estimates store
command:
. reg Y X1 X2 X3 . estimates store model1 . reg Y X1 X2 X3, cl(id) . estimates store model2
To save the two models in a single table in an external file, use the .esttab
command:
. esttab model1 model2 using C:\temp\results.rtf, b(2) se(2) r2
Specify the names of the stored estimates, model1
and model2
, and the directory where the table of results should be saved. The extension of the file determines the file format, in this case rtf
. The b()
and se()
options indicate that the point estimates and standard errors, respectively, should be rounded to the second decimal place. The option r2
will display the R-squared statistic for each model. For additional options on displaying summary statistics and customizing table layout, type:
. help esttab
If you have questions about using statistical and mathematical software at Indiana University, contact the UITS Research Applications and Deep Learning team.
This is document azuu in the Knowledge Base.
Last modified on 2023-05-09 14:38:26.