bonifaz
bonifaz

Reputation: 598

Adding factor variable means to esttab

I am running a regression, which produces the following table:

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

I would like to add a row with the mean of the two foreign coefficients:

. 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

How can I add such a custom row to esttab?

Upvotes: 0

Views: 115

Answers (1)

user8682794
user8682794

Reputation:

You can do this with the prefoot() option:

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

Upvotes: 1

Related Questions