【问题标题】:How to add text to bottom of esttab table without using estadd如何在不使用 estadd 的情况下将文本添加到 esttab 表的底部
【发布时间】:2019-04-16 19:52:49
【问题描述】:

下面的代码使用本地向每个方程添加自定义文本并产生我想要的:

estimates clear
eststo clear
sysuse auto, clear

eststo w1: regress price mpg trunk length
estadd local number one
eststo w2: regress turn mpg trunk length
estadd local number two
eststo w3: regress displacement mpg trunk length
estadd local number three

esttab w1 w2 w3, stats(number)

但是,我希望能够在 esttab 命令语法中编写自定义文本,而不是在使用本地之前。

这是不正确的,但该选项可能类似于以下内容:

estimates clear
eststo clear
sysuse auto, clear

eststo w1: regress price mpg trunk length
eststo w2: regress turn mpg trunk length
eststo w3: regress displacement mpg trunk length

esttab w1 w2 w3, stats("number", "one" "two" "three")

我能否以某种方式在esttab 命令中插入一个选项,以便拼出我想要的内容?我知道有一个indicate() 选项,但我不知道它是否可以满足我的需要。

【问题讨论】:

    标签: formatting format string-formatting stata


    【解决方案1】:

    很遗憾,您无法即时定义 stats() 元素的内容。

    但是,解决方法如下:

    sysuse auto, clear
    eststo clear
    estimates clear
    
    eststo w1: regress price mpg trunk length
    eststo w2: regress turn mpg trunk length
    eststo w3: regress displacement mpg trunk length
    
    esttab, prefoot(`"{hline 60}"' ///
                    `"numbers{dup 15: }one{dup 13: }two{dup 11: }three"' ///
                    `"more numbers{dup 9: }four{dup 12: }five{dup 13: }six"') 
    
    ------------------------------------------------------------
                          (1)             (2)             (3)   
                        price            turn    displacement   
    ------------------------------------------------------------
    mpg                -173.7         -0.0656          -1.777   
                      (-1.97)         (-0.88)         (-1.04)   
    
    trunk              -0.855         -0.0593          0.0659   
                      (-0.01)         (-0.66)          (0.03)   
    
    length              21.40           0.165***        3.068***
                       (0.79)          (7.19)          (5.83)   
    
    _cons              5854.0           10.76*         -342.3** 
                       (0.97)          (2.09)         (-2.92)   
    ------------------------------------------------------------
    numbers               one             two           three
    more numbers         four            five             six
    N                      74              74              74   
    ------------------------------------------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001
    

    显然,您每次都必须根据您的用例指定空格。您可以手动执行此操作,也可以编写一个计算这些值的小程序。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-11-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-25
      • 2020-09-05
      • 2016-02-29
      相关资源
      最近更新 更多