使用esttab时调整表格的大小

TEX*_*TEX 0 latex stata

我正在tex使用社区贡献的命令在文件中导出回归结果esttab

esttab using reg.tex, nonumbers mtitles("1" "2" "3" "4" "5" "6" "7" "8" "9")
Run Code Online (Sandbox Code Playgroud)

该表包含九列。

我想让字体大小和列宽更小,以便在编译LaTeX.

当我使用时,有没有办法直接在 Stata 中执行此操作esttab

小智 5

考虑以下使用 Stataauto玩具数据集的示例:

sysuse auto, clear
eststo clear

eststo: quietly regress price weight
eststo: quietly regress price weight mpg

esttab

--------------------------------------------
                      (1)             (2)   
                    price           price   
--------------------------------------------
weight              2.044***        1.747** 
                   (5.42)          (2.72)   

mpg                                -49.51   
                                  (-0.57)   

_cons              -6.707          1946.1   
                  (-0.01)          (0.54)   
--------------------------------------------
N                      74              74   
--------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
Run Code Online (Sandbox Code Playgroud)

通常,可以使用varwidth()和/或控制列的宽度 modelwidth()

esttab, mlabels(none) varwidth(25)

---------------------------------------------------------
                                   (1)             (2)   
---------------------------------------------------------
weight                           2.044***        1.747** 
                                (5.42)          (2.72)   

mpg                                             -49.51   
                                               (-0.57)   

_cons                           -6.707          1946.1   
                               (-0.01)          (0.54)   
---------------------------------------------------------
N                                   74              74   
---------------------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

esttab, mlabels(none) modelwidth(25)

----------------------------------------------------------------------
                                   (1)                          (2)   
----------------------------------------------------------------------
weight                           2.044***                     1.747** 
                                (5.42)                       (2.72)   
mpg                                                          -49.51   
                                                            (-0.57)   
_cons                           -6.707                       1946.1   
                               (-0.01)                       (0.54)   
----------------------------------------------------------------------
N                                   74                           74   
----------------------------------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
Run Code Online (Sandbox Code Playgroud)

上述两个选项也可以组合使用:

-----------------------------------------------------------------------------------
                                                (1)                          (2)   
-----------------------------------------------------------------------------------
weight                                        2.044***                     1.747** 
                                             (5.42)                       (2.72)   

mpg                                                                       -49.51   
                                                                         (-0.57)   

_cons                                        -6.707                       1946.1   
                                            (-0.01)                       (0.54)   
-----------------------------------------------------------------------------------
N                                                74                           74   
-----------------------------------------------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
Run Code Online (Sandbox Code Playgroud)

对于LaTeX输出,您需要根据需要在prehead()postfoot()选项中包含必要的标记。

在本例中,您可以按如下方式更改表格的字体大小:

esttab, mlabels(none) tex ///
        prehead(`"\begin{table}"' `"\tiny"' ///
                `"\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}"' ///
                `"\begin{tabular}{l*{2}{c}}"') ///
        postfoot(`"\end{tabular}"' `"\end{table}"')
Run Code Online (Sandbox Code Playgroud)

同样,您可以通过更改以下值来控制列间距{5pt}

esttab, mlabels(none) tex ///
        prehead(`"\setlength{\tabcolsep}{5pt}"' `"\begin{tabular}"')
Run Code Online (Sandbox Code Playgroud)