下面的代码使用本地将自定义文本添加到每个方程并生成我想要的内容:
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()
选项,但我不知道它是否可以满足我的需求。
不幸的是,您无法动态定义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
显然,您每次都必须根据您的用例指定空格。您可以手动执行此操作,也可以编写一个计算这些值的小程序。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句