Please, I would like to append the results from several t-tests in one table using esttab which is from the Stata Journal. I have done the following:
sysuse auto
first, test that price=turn
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")
}
second, test that 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")
}
To put the two tests in one table, I have done this:
esttab m1 m2 m3 m4 m5 m6, se mlab(actual predicted ATE) coeflab(diff "private" diff1 "public")
which yields:
---------------------------------------------------------------------------------------------------------
> ---
(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
But this is not quite what I want. I want the result of the second test placed directly under the same three columns as the first i.e the actual, predicted and ATE columns (in other words m4, m5 and m6 respectively are the 'actual', 'predicted' and 'ATE' from the second test). For simplicity this example invloves just two separate tests. But my work involves several of such tests.
esttabcan export to LaTeX, it seems that this question is about the table itself and not about the appearance after exporting. Therefore the question is off topic on our site, I will vote to close. I think it will be on topic on Stack Overflow. ā Marijn Mar 19 '21 at 09:33