esttab将回归结果导入Latex
【问题】corrtex将相关系数矩阵导入Latex
可是,我们更为常用的是将回归结果导入Latex
【方法】
比较方法的是利用esttab
【例子】
*安装相关命令
ssc install esttab,replace
use auto,clear
regprice mpg rep78 trunk
est store m1
esttab m1 using esttab1.tex, replace
*tex文件
{
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{1}{c}}
\hline\hline
&\multicolumn{1}{c}{(1)}\\
&\multicolumn{1}{c}{price}\\
\hline
mpg & -252.3\sym{***}\\
& (-3.56) \\
rep78 & 650.1 \\
& (1.88) \\
trunk & 42.47 \\
& (0.48) \\
\_cons & 8711.3\sym{***}\\
& (3.64) \\
\hline
\(N\) & 69 \\
\hline\hline
\multicolumn{2}{l}{\footnotesize \textit{t} statistics in parentheses}\\
\multicolumn{2}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \(p<0.001\)}\\
\end{tabular}
}
*运行后结果
*再加一列
regprice mpg length trunk
est store m2
esttab m1 m2 using esttab1.tex, replace
*tex代码
{
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{2}{c}}
\hline\hline
&\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}\\
&\multicolumn{1}{c}{price}&\multicolumn{1}{c}{price}\\
\hline
mpg & -252.3\sym{***}& -173.7 \\
& (-3.56) & (-1.97) \\
rep78 & 650.1 & \\
& (1.88) & \\
trunk & 42.47 & -0.855 \\
& (0.48) & (-0.01) \\
length & & 21.40 \\
& & (0.79) \\
\_cons & 8711.3\sym{***}& 5854.0 \\
& (3.64) & (0.97) \\
\hline
\(N\) & 69 & 74 \\
\hline\hline
\multicolumn{3}{l}{\footnotesize \textit{t} statistics in parentheses}\\
\multicolumn{3}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \(p<0.001\)}\\
\end{tabular}
}
*运行后效果
页:
[1]