首页 文章

esttab的表格式(Stata)

提问于
浏览
1

我正在运行12种不同的回归模型 - 针对4种不同结果变量的3种不同规格 .

我对每个模型中只有一个系数感兴趣 . 我希望 esttab 吐出一个包含来自不同模型的12个估计系数的表格 . 任何想法如何实现这样的结果?

这应该是这样的:
table

从这paper .

编辑:

代码被要求了,所以这就是我尝试过的 .

global top "drop(*.year 0b* 1o* 1.post _cons) star(+ 0.15 * 0.10 ** 0.05 *** 0.01) se ar2 nonotes coeflabels(1.treat#1.post "TREAT X POST") booktabs order(1.treat#1.post) stats(, labels()) nomtitles nocons replace width(\hsize) postfoot(\end{tabular*} }) prefoot("") varwidth(25) eqlabels("")"

global middle "drop(*.year 0b* 1o* 1.post _cons) star(+ 0.15 * 0.10 ** 0.05 *** 0.01) se ar2 nonotes coeflabels(1.treat#1.post "TREAT X POST") booktabs order(1.treat#1.post) stats(, labels()) nomtitles nocons width(\hsize) postfoot(\end{tabular*} }) prefoot("") append collabels(none) prehead(`"{"' `"\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}"' \begin{tabular*}{\hsize}{@{\hskip\tabcolsep\extracolsep\fill}l*{@E}{c}}) nonumbers eqlabels("")"

global end "drop(*.year 0b* 1o* _cons 1.post) star(+ 0.15 * 0.10 ** 0.05 *** 0.01) se ar2 nonotes coeflabels(1.treat#1.post "TREAT X POST") booktabs order(1.treat#1.post) s(countyfe yearfe N N_g, label("County FE" "Year FE" N "Clusters")) nomtitles nocons append width(\hsize) nonumbers prehead(`"{"' `"\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}"' \begin{tabular*}{\hsize}{@{\hskip\tabcolsep\extracolsep\fill}l*{@E}{c}}) eqlabels("")"


load_reg parta
// this is a function that loads three regressions into eststo

esttab using "${tables}reg.tex", ${top} posthead("\midrule \textbf{Panel A}\\")

load_reg partb
esttab using "${tables}reg.tex", ${middle} posthead("\midrule \textbf{Panel B}\\")

load_reg partc
esttab using "${tables}reg.tex", ${end} posthead("\midrule \textbf{Panel C : Class3 Attrib}\\")

reg.tex现在看起来像这样:

my attempt at recreating

问题是:这看起来太尴尬了,并且不能很好地扩展 . 有更好的方法吗?

1 回答

  • 0

    您可以使用“outreg2”来实现此目的 . 在命令窗口中键入“findit outreg2”以下载用户编写的函数 . 使用outreg2导出回归结果后,打开outreg2生成的输出文件,突出显示整个内容,将其复制并粘贴到Word中 . 突出显示Word中的文本并将其转换为表格 . 然后它应该给你一个看起来几乎像你发布的回归表 . 要使其打印系数的子集,您只需删除不需要的行 . 这是一个示例Stata do-file:

    local path2 "C:\efsdata\desktop\"
    
    xthtaylor avg_actual_delay precip  max_temp_90 distance  Maxcongestion recovery_time slow_order_track  mechanical_delay_track avg_slot_two GDP_current turn UP_07 NS_07 UP BNSF CSXT NS CN multi_host if long_distance==1,endog(Maxcongestion) vce(bootstrap, seed(1) reps(100))
    
    outreg2 using `path2'mei1, ctitle(track delay relative to schedules, long)
    
    xthtaylor avg_actual_delay precip  max_temp_90 distance  Maxcongestion recovery_time slow_order_track  mechanical_delay_track avg_slot_two GDP_current turn             UP BNSF CSXT NS CN multi_host if long_distance==0,endog(Maxcongestion recovery_time) vce(bootstrap, seed(1) reps(100))
    
    outreg2 using `path2'mei1, ctitle(track delay relative to schedules, short)
    

相关问题