Customizing tables in Stata

青春壹個敷衍的年華 提交于 2019-12-25 14:49:57

问题


Using Stata14 on windows, I am wondering how to build customized tables from several regression results. Here is an example. We have

reg y, x1
predict resid1, residuals
summarize resid1

Which gives:

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      resid1 |  5,708,529    4.83e-11    .7039736  -3.057633   3.256382

And run another regrerssion and similarly obtain the residuals:

reg y, x2
predict resid2, residuals

I would like to create a table which has the two standard deviations of the two residuals, and optimally output it to latex. I am familiar with the esttab and estout commands for outputting regression results to latex, but these do not work for customized tables as in the above example.


回答1:


You need to use estpost. This should get you started.

sysuse auto, clear
regress price weight
predict error1, residuals
regress price trunk
predict error2, residuals

eststo clear
estpost summarize error1 error2
eststo
esttab, cells("count mean sd min max") noobs nonum
esttab using so.tex, cells("count mean sd min max") noobs nonum replace

More here.



来源:https://stackoverflow.com/questions/43166930/customizing-tables-in-stata

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!