0
votes

I am trying to use the community-contributed command estout to produce regression tables in the wide format (i.e. a separate column for coefficients and a separate column for standard errors), where there is a heading (eg "coefficient" and "s.e.") above each column.

A reproducible example using the auto dataset:

sysuse auto, clear 

regress mpg weight i.foreign
estimates store m1

regress mpg weight length i.foreign 
estimates store m2

esttab m1 m2, wide b(3) se(3)
esttab m1 m2, wide plain b(3) se(3)

This results in output almost exactly what I am after, but does not have the headings (eg "coefficient" and "s.e.") above each column:

esttab m1 m2, wide b(3) se(3)

----------------------------------------------------------------------
                      (1)                          (2)                
                      mpg                          mpg                
----------------------------------------------------------------------
weight             -0.007***      (0.001)       -0.004**       (0.002)
0.foreign           0.000             (.)        0.000             (.)
1.foreign          -1.650         (1.076)       -1.708         (1.067)
length                                          -0.083         (0.055)
_cons              41.680***      (2.166)       50.537***      (6.246)
----------------------------------------------------------------------
N                      74                           74                
----------------------------------------------------------------------
Standard errors in parentheses
* p<0.05, ** p<0.01, *** p<0.001

I suspect my preferred output is possible, because if I use the plain option, I get the headers ("b" and "se", although I would like to be able to rename both if possible):

esttab m1 m2, wide plain b(3) se(3)

                       m1                        m2             
                        b           se            b           se
weight             -0.007        0.001       -0.004        0.002
0.foreign           0.000            .        0.000            .
1.foreign          -1.650        1.076       -1.708        1.067
length                                       -0.083        0.055
_cons              41.680        2.166       50.537        6.246
N                      74                        74             

My desired output would look like this:

----------------------------------------------------------------------
                      (1)                          (2)                
                      mpg                          mpg                
                   coefficient    s.e.           coefficient   s.e.
----------------------------------------------------------------------
weight             -0.007***      (0.001)       -0.004**       (0.002)
0.foreign           0.000             (.)        0.000             (.)
1.foreign          -1.650         (1.076)       -1.708         (1.067)
length                                          -0.083         (0.055)
_cons              41.680***      (2.166)       50.537***      (6.246)
----------------------------------------------------------------------
N                      74                           74                
----------------------------------------------------------------------
Standard errors in parentheses
* p<0.05, ** p<0.01, *** p<0.001

Also, while the output above is in text format for reproducibility, in my real output, I'm trying to produce tables in rich text format.

1

1 Answers

1
votes

The following works for me:

sysuse auto, clear 

regress mpg weight i.foreign
estimates store m1

regress mpg weight length i.foreign 
estimates store m2

esttab m1 m2, cells("b(fmt(3) star) se(fmt(3) par)") collabels("coefficient" "s.e.")

----------------------------------------------------------------------
                      (1)                          (2)                
                      mpg                          mpg                
              coefficient            s.e.  coefficient            s.e.
----------------------------------------------------------------------
weight             -0.007***      (0.001)       -0.004**       (0.002)
0.foreign           0.000             (.)        0.000             (.)
1.foreign          -1.650         (1.076)       -1.708         (1.067)
length                                          -0.083         (0.055)
_cons              41.680***      (2.166)       50.537***      (6.246)
----------------------------------------------------------------------
N                      74                           74                
----------------------------------------------------------------------