在esttab中添加因子变量均值

时间:2019-06-17 08:15:18

标签: stata

我正在运行回归,该回归产生下表:

sysuse auto
quietly reg price length foreign#c.gear_ratio
est store test
esttab *, drop(*foreign*)

----------------------------
                      (1)   
                    price   
----------------------------
length              66.43***
                   (3.80)   

_cons              1299.3   
                   (0.24)   
----------------------------
N                      74   
----------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

我想添加两个foreign系数的平均值的行:

. esttab *, drop(*foreign*)

----------------------------
                      (1)   
                    price   
----------------------------
length              66.43***
                   (3.80)   
mean(foreign#c.gear_ratio) WHATEVER

_cons              1299.3   
                   (0.24)   
----------------------------
N                      74   
----------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

如何将这样的自定义行添加到esttab

1 个答案:

答案 0 :(得分:1)

您可以使用prefoot()选项进行操作:

sysuse auto, clear
estimate clear

quietly reg price length foreign#c.gear_ratio
estimate store test

local mean1 mean(foreign#c.gear_ratio) {dup 4: }WHATEVER 

esttab, drop(*foreign*) modelwidth(25) prefoot(`" "' `"`mean1'"' `" "' `"{hline 41}"')


-----------------------------------------
                                   (1) 
                                 price  
-----------------------------------------
length                           66.43***
                                (3.80)   

_cons                           1299.3   
                                (0.24)   

mean(foreign#c.gear_ratio)     WHATEVER

-----------------------------------------
N                                   74   
-----------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001