添加因子变量意味着 esttab



我正在运行一个回归,它产生下表:

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

您可以使用

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

最新更新