请帮忙,我想使用 Stata Journal 中的 esttab 将多个 t 检验的结果附加到一个表中。我已完成以下操作:
sysuse auto
首先,测试价格=转数
quietly{
ttest price=turn
preserve
expand 2, g(new)
gen diff= cond(new, turn, price)
eststo m1: mean diff if !new
eststo m2: mean diff if new
eststo m3: estpost ttest diff, by(new)
esttab m1 m2 m3, se mlab(actual predicted ATE) coeflab(diff "private")
}
第二,测试 trunk=turn
Code:
quietly{
ttest trunk=turn
preserve
expand 2, g(new1)
gen diff1= cond(new1, turn, trunk)
eststo m4: mean diff1 if !new1
eststo m5: mean diff1 if new1
eststo m6: estpost ttest diff1, by(new1)
esttab m4 m5 m6, se mlab(actual predicted ATE) coeflab(diff1 "public")
}
为了将两个测试放在一个表中,我这样做了:
esttab m1 m2 m3 m4 m5 m6, se mlab(actual predicted ATE) coeflab(diff "private" diff1 "public")
得出的结果是:
---------------------------------------------------------------------------------------------------------
> ---
(1) (2) (3) (4) (5) (6)
>
actual predicted ATE m4 m5 m6
>
---------------------------------------------------------------------------------------------------------
> ---
private 6165.3*** 39.65*** 6125.6***
>
(342.9) (0.511) (342.9)
>
public 13.76*** 39.65*** -25.89
> ***
(0.497) (0.511) (0.713)
>
---------------------------------------------------------------------------------------------------------
> ---
N 74 74 148 74 74 148
>
---------------------------------------------------------------------------------------------------------
> ---
Standard errors in parentheses
* p<0.05, ** p<0.01, *** p<0.001
但这并不是我想要的。我希望将第二个测试的结果直接放在与第一个测试相同的三列下,即实际、预测和 ATE 列(换句话说,m4、m5 和 m6 分别是第二个测试的“实际”、“预测”和“ATE”)。为简单起见,此示例仅涉及两个单独的测试。但我的工作涉及几个这样的测试。