Exponentiated coefficients

To report exponentiated coefficients (aka odds ratio in logistic regression, harzard ratio in the Cox model, incidence rate ratio, relative risk ratio), apply the eform option. Example:

. sysuse auto, clear
(1978 Automobile Data)

. eststo: quietly logit foreign mpg
(est3 stored)

. eststo: quietly logit foreign mpg weight
(est4 stored)

. esttab, eform

----------------------------------------------------------------------------
                      (1)             (2)             (3)             (4)   
                  foreign                         foreign         foreign   
----------------------------------------------------------------------------
main                                                                        
turn                0.671*          0.961**                                 
                  (-2.44)         (-2.99)                                   

weight              0.998*          1.000*                          0.996***
                  (-2.03)         (-2.28)                         (-3.86)   

mpg                 0.836           0.982*          1.173**         0.845   
                  (-1.91)         (-2.17)          (3.04)         (-1.83)   
----------------------------------------------------------------------------
N                      74              74              74              74   
----------------------------------------------------------------------------
Exponentiated coefficients; t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

. eststo clear
Code

Note that eform also transforms the standard errors (and confidence intervals), as is illustrated bellow:

. sysuse auto, clear
(1978 Automobile Data)

. quietly logit foreign mpg weight

. eststo raw

. eststo or

. esttab raw or, se mtitles eform(0 1)

--------------------------------------------
                      (1)             (2)   
                      raw              or   
--------------------------------------------
foreign                                     
mpg                -0.169           0.845   
                 (0.0919)        (0.0777)   

weight           -0.00391***        0.996***
                (0.00101)       (0.00101)   

_cons               13.71**      898396.7** 
                  (4.519)     (4059593.7)   
--------------------------------------------
N                      74              74   
--------------------------------------------
Standard errors in parentheses
* p<0.05, ** p<0.01, *** p<0.001

. eststo clear
Code

The example also illustrates that, optionally, eform can be applied to selected models only. If you are interested in applying other transformations, see estout's transform() option.

[top]

Marginal effects

Since Stata 11, margins is the preferred command to compute marginal effects (example). However, esttab and estout also support Stata's old mfx command for calculating marginal effects and elasticities. To make mfx's results available for tabulation it is essential that the model is stored after applying mfx. In esttab or estout then use the margin option to display the marginal effects. Example:

. sysuse auto, clear
(1978 Automobile Data)

. generate reprec = (rep78 > 3) if rep78<.
(5 missing values generated)

. eststo raw: logit foreign mpg reprec

Iteration 0:   log likelihood = -42.400729  
Iteration 1:   log likelihood = -27.870189  
Iteration 2:   log likelihood = -27.085252  
Iteration 3:   log likelihood = -27.077123  
Iteration 4:   log likelihood =  -27.07712  

Logistic regression                             Number of obs     =         69
                                                LR chi2(2)        =      30.65
                                                Prob > chi2       =     0.0000
Log likelihood =  -27.07712                     Pseudo R2         =     0.3614

------------------------------------------------------------------------------
     foreign |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         mpg |   .1401865   .0653249     2.15   0.032      .012152    .2682209
      reprec |   2.649856    .738071     3.59   0.000     1.203263    4.096448
       _cons |   -5.37032   1.519281    -3.53   0.000    -8.348056   -2.392585
------------------------------------------------------------------------------

. eststo mfx: mfx

Marginal effects after logit
      y  = Pr(foreign) (predict)
         =  .21890433
------------------------------------------------------------------------------
variable |      dy/dx    Std. Err.     z    P>|z|  [    95% C.I.   ]      X
---------+--------------------------------------------------------------------
     mpg |   .0239698       .0121    1.98   0.048    .00026   .04768   21.2899
  reprec*|   .4813761      .11305    4.26   0.000   .259809  .702943    .42029
------------------------------------------------------------------------------
(*) dy/dx is for discrete change of dummy variable from 0 to 1

. esttab, se margin mtitles

--------------------------------------------
                      (1)             (2)   
                      raw             mfx   
--------------------------------------------
foreign                                     
mpg                 0.140*         0.0240*  
                 (0.0653)        (0.0121)   

reprec (d)          2.650***        0.481***
                  (0.738)         (0.113)   
--------------------------------------------
N                      69              69   
--------------------------------------------
Marginal effects; Standard errors in parentheses
 (d) for discrete change of dummy variable from 0 to 1
* p<0.05, ** p<0.01, *** p<0.001

. eststo clear
Code
[top]

Multiple-equation models

The default in esttab or estout is to arrange the different equations of multiple-equation models in vertical order, as in:

. sysuse auto, clear
(1978 Automobile Data)

. quietly heckman price weight, select(foreign = weight mpg) twostep

. esttab, wide

-----------------------------------------
                      (1)                
                    price                
-----------------------------------------
price                                    
weight              5.284***       (5.89)
_cons             -5925.0***      (-3.50)
-----------------------------------------
foreign                                  
weight           -0.00234***      (-4.13)
mpg                -0.104*        (-2.02)
_cons               8.275**        (3.24)
-----------------------------------------
mills                                    
lambda              104.9          (0.12)
-----------------------------------------
N                      74                
-----------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
Code

However, for models such as mlogit or sureg it is sometimes sensible to arrange the equations horizontally, which can be achieved through the use of the unstack option. Example:

. sysuse auto, clear
(1978 Automobile Data)

. sureg (price foreign weight length) (mpg displ = foreign weight)

Seemingly unrelated regression
--------------------------------------------------------------------------
Equation             Obs   Parms        RMSE    "R-sq"       chi2        P
--------------------------------------------------------------------------
price                 74       3    1967.769    0.5488      89.74   0.0000
mpg                   74       2    3.337283    0.6627     145.39   0.0000
displacement          74       2    39.60002    0.8115     318.62   0.0000
--------------------------------------------------------------------------

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
price        |
     foreign |    3575.26   621.7961     5.75   0.000     2356.562    4793.958
      weight |   5.691462   .9205043     6.18   0.000     3.887307    7.495618
      length |  -88.27114    31.4167    -2.81   0.005    -149.8467   -26.69554
       _cons |   4506.212   3588.044     1.26   0.209    -2526.225    11538.65
-------------+----------------------------------------------------------------
mpg          |
     foreign |  -1.650029   1.053958    -1.57   0.117    -3.715748    .4156902
      weight |  -.0065879   .0006241   -10.56   0.000     -.007811   -.0053647
       _cons |    41.6797   2.121197    19.65   0.000     37.52223    45.83717
-------------+----------------------------------------------------------------
displacement |
     foreign |   -25.6127   12.50621    -2.05   0.041    -50.12441   -1.100984
      weight |   .0967549   .0074051    13.07   0.000     .0822411    .1112686
       _cons |  -87.23548   25.17001    -3.47   0.001    -136.5678   -37.90317
------------------------------------------------------------------------------

. esttab, unstack scalars(r2 chi2 p) noobs nomtitle

------------------------------------------------------------
                      (1)                                   
                    price             mpg    displacement   
------------------------------------------------------------
foreign            3575.3***       -1.650          -25.61*  
                   (5.75)         (-1.57)         (-2.05)   

weight              5.691***     -0.00659***       0.0968***
                   (6.18)        (-10.56)         (13.07)   

length             -88.27**                                 
                  (-2.81)                                   

_cons              4506.2           41.68***       -87.24***
                   (1.26)         (19.65)         (-3.47)   
------------------------------------------------------------
r2                  0.549           0.663           0.812   
chi2                89.74           145.4           318.6   
p                2.50e-19        2.68e-32        6.50e-70   
------------------------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
Code
[top]

Table of effects signs

Tables containing the signs of the coefficients, "significance stars", or "significant signs" (i.e. the signs of the coefficient where each sing is repeated according to significance level) can be produced as follows:

. sysuse auto, clear
(1978 Automobile Data)

. eststo: regress price mpg foreign

      Source |       SS           df       MS      Number of obs   =        74
-------------+----------------------------------   F(2, 71)        =     14.07
       Model |   180261702         2  90130850.8   Prob > F        =    0.0000
    Residual |   454803695        71  6405685.84   R-squared       =    0.2838
-------------+----------------------------------   Adj R-squared   =    0.2637
       Total |   635065396        73  8699525.97   Root MSE        =    2530.9

------------------------------------------------------------------------------
       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         mpg |  -294.1955   55.69172    -5.28   0.000    -405.2417   -183.1494
     foreign |   1767.292    700.158     2.52   0.014     371.2169    3163.368
       _cons |   11905.42   1158.634    10.28   0.000     9595.164    14215.67
------------------------------------------------------------------------------
(est1 stored)

. eststo: regress price mpg foreign weight

      Source |       SS           df       MS      Number of obs   =        74
-------------+----------------------------------   F(3, 70)        =     23.29
       Model |   317252881         3   105750960   Prob > F        =    0.0000
    Residual |   317812515        70  4540178.78   R-squared       =    0.4996
-------------+----------------------------------   Adj R-squared   =    0.4781
       Total |   635065396        73  8699525.97   Root MSE        =    2130.8

------------------------------------------------------------------------------
       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         mpg |    21.8536   74.22114     0.29   0.769    -126.1758     169.883
     foreign |    3673.06   683.9783     5.37   0.000     2308.909    5037.212
      weight |   3.464706    .630749     5.49   0.000     2.206717    4.722695
       _cons |  -5853.696   3376.987    -1.73   0.087    -12588.88    881.4934
------------------------------------------------------------------------------
(est2 stored)

. esttab, cells(_sign) nogap

--------------------------------------
                      (1)          (2)
                    price        price
                    _sign        _sign
--------------------------------------
mpg                     -            +
foreign                 +            +
weight                               +
_cons                   +            -
--------------------------------------
N                      74           74
--------------------------------------

. esttab, cells(_star) nogap ///
>     starlevels(n.s. 1 * 0.05 ** 0.01)

--------------------------------------
                      (1)          (2)
                    price        price
                    _star        _star
--------------------------------------
mpg                    **         n.s.
foreign                 *           **
weight                              **
_cons                  **         n.s.
--------------------------------------
N                      74           74
--------------------------------------

. esttab, cells(_sigsign) nogap ///
>     starlevels("+/-" 1 "++/--" 0.05 "+++/---" 0.01)

--------------------------------------
                      (1)          (2)
                    price        price
                 _sigsign     _sigsign
--------------------------------------
mpg                   ---            +
foreign                ++          +++
weight                             +++
_cons                 +++            -
--------------------------------------
N                      74           74
--------------------------------------

. eststo clear
Code
[top]

Add a hypotheses column

Use the labcol2() option to add a column indicating the expected directions of effects according to theory:

. sysuse auto, clear
(1978 Automobile Data)

. quietly regress price mpg foreign weight displ

. esttab, labcol2(+ ? + -, title("" Hypothesis))

-----------------------------------------
                                   (1)   
              Hypothesis         price   
-----------------------------------------
mpg               +              19.08   
                                (0.26)   

foreign           ?             3930.2***
                                (5.67)   

weight            +              2.458** 
                                (2.82)   

displacement      -              10.22   
                                (1.65)   

_cons                          -4846.8   
                               (-1.43)   
-----------------------------------------
N                                   74   
-----------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
Code
[top]

Control variables indicator

To save space full output is sometimes suppressed for certain control variables and it is only indicated whether the model contains the variables or not. The indicate() in estout supports the construction of such tables:

. sysuse auto, clear
(1978 Automobile Data)

. eststo: quietly regress price mpg foreign
(est1 stored)

. eststo: xi: quietly regress price mpg foreign i.rep78
i.rep78           _Irep78_1-5         (naturally coded; _Irep78_1 omitted)
(est2 stored)

. esttab, indicate(rep dummies = _Irep78*)

--------------------------------------------
                      (1)             (2)   
                    price           price   
--------------------------------------------
mpg                -294.2***       -299.6***
                  (-5.28)         (-4.73)   

foreign            1767.3*         1102.3   
                   (2.52)          (1.22)   

_cons             11905.4***      10856.2***
                  (10.28)          (4.79)   

rep dummies            No             Yes   
--------------------------------------------
N                      74              69   
--------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

. eststo clear
Code

indicate() prints its information at the bottom of the main body of the table containing the coefficients. If you want to include the information in the table footer, then use the following approach:

. sysuse auto, clear
(1978 Automobile Data)

. eststo: quietly regress price mpg foreign
(est1 stored)

. estadd local hasrep "No"

added macro:
             e(hasrep) : "No"

. eststo: xi: quietly regress price mpg foreign i.rep78
i.rep78           _Irep78_1-5         (naturally coded; _Irep78_1 omitted)
(est2 stored)

. estadd local hasrep "Yes"

added macro:
             e(hasrep) : "Yes"

. esttab, drop(_Irep78*) scalars("hasrep rep dummies")

--------------------------------------------
                      (1)             (2)   
                    price           price   
--------------------------------------------
mpg                -294.2***       -299.6***
                  (-5.28)         (-4.73)   

foreign            1767.3*         1102.3   
                   (2.52)          (1.22)   

_cons             11905.4***      10856.2***
                  (10.28)          (4.79)   
--------------------------------------------
N                      74              69   
rep dummies            No             Yes   
--------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

. eststo clear
Code
[top]

Reference category information

Use the refcat() option to add a table row containing the (omitted) reference category of a categorical variable. Example:

. sysuse cancer
(Patient Survival in Drug Trial)

. stset studytime, failure(died)

     failure event:  died != 0 & died < .
obs. time interval:  (0, studytime]
 exit on or before:  failure

------------------------------------------------------------------------------
         48  total observations
          0  exclusions
------------------------------------------------------------------------------
         48  observations remaining, representing
         31  failures in single-record/single-failure data
        744  total analysis time at risk and under observation
                                                at risk from t =         0
                                     earliest observed entry t =         0
                                          last observed exit t =        39

. xi: stcox age i.drug, nolog
i.drug            _Idrug_1-3          (naturally coded; _Idrug_1 omitted)

         failure _d:  died
   analysis time _t:  studytime

Cox regression -- Breslow method for ties

No. of subjects =           48                  Number of obs    =          48
No. of failures =           31
Time at risk    =          744
                                                LR chi2(3)       =       36.52
Log likelihood  =   -81.652567                  Prob > chi2      =      0.0000

------------------------------------------------------------------------------
          _t | Haz. Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         age |   1.118334   .0409074     3.06   0.002     1.040963    1.201455
    _Idrug_2 |   .1805839   .0892742    -3.46   0.001     .0685292    .4758636
    _Idrug_3 |   .0520066    .034103    -4.51   0.000     .0143843    .1880305
------------------------------------------------------------------------------

. lab var _Idrug_2 "Tadalafil"

. lab var _Idrug_3 "Sildenafil"

. esttab, eform wide label nostar refcat(_Idrug_2 "Placebo")

----------------------------------------------
                              (1)             
                     analysis t~s             
----------------------------------------------
Patient's age at s..        1.118       (3.06)
Placebo                      ref.             
Tadalafil                   0.181      (-3.46)
Sildenafil                 0.0520      (-4.51)
----------------------------------------------
Observations                   48             
----------------------------------------------
Exponentiated coefficients; t statistics in parentheses

. esttab, eform wide label nostar refcat(_Idrug_2 "Placebo", label(1))

----------------------------------------------
                              (1)             
                     analysis t~s             
----------------------------------------------
Patient's age at s..        1.118       (3.06)
Placebo                         1             
Tadalafil                   0.181      (-3.46)
Sildenafil                 0.0520      (-4.51)
----------------------------------------------
Observations                   48             
----------------------------------------------
Exponentiated coefficients; t statistics in parentheses
Code
[top]

Adding extra rows using refcat

The refcat() option is designed to include information on the (omitted) reference category of a categorical variable (see above), but it can also be used to include extra rows in the table containing subtitles or other information. Example:

. sysuse auto, clear
(1978 Automobile Data)

. regress price weight mpg turn foreign

      Source |       SS           df       MS      Number of obs   =        74
-------------+----------------------------------   F(4, 69)        =     19.23
       Model |   334771309         4  83692827.3   Prob > F        =    0.0000
    Residual |   300294087        69  4352088.22   R-squared       =    0.5271
-------------+----------------------------------   Adj R-squared   =    0.4997
       Total |   635065396        73  8699525.97   Root MSE        =    2086.2

------------------------------------------------------------------------------
       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      weight |   4.284532   .7404967     5.79   0.000     2.807282    5.761783
         mpg |  -.4660076   73.51407    -0.01   0.995    -147.1226    146.1905
        turn |  -229.2059   114.2423    -2.01   0.049    -457.1131   -1.298676
     foreign |   3221.415   706.4847     4.56   0.000     1812.017    4630.813
       _cons |   1368.197   4887.597     0.28   0.780    -8382.292    11118.69
------------------------------------------------------------------------------

. foreach v of varlist weight mpg turn foreign {
  2.     label variable `v' `"- `: variable label `v''"'
  3. }

. esttab, refcat(weight "Main effects:" turn "Controls:", nolabel) wide label

-------------------------------------------------
                              (1)                
                            Price                
-------------------------------------------------
Main effects:                                    
- Weight (lbs.)             4.285***       (5.79)
- Mileage (mpg)            -0.466         (-0.01)
Controls:                                        
- Turn Circle (ft.)        -229.2*        (-2.01)
- Car type                 3221.4***       (4.56)
Constant                   1368.2          (0.28)
-------------------------------------------------
Observations                   74                
-------------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
Code
[top]

Match coefficients across models

Rename coefficients using the rename() option before matching the models and equations to merge different coefficients into the same table row. Example:

. sysuse auto, clear
(1978 Automobile Data)

. set seed 123

. generate altmpg = invnorm(uniform())

. eststo: quietly regress price weight mpg
(est1 stored)

. eststo: quietly regress price weight altmpg
(est2 stored)

. esttab

--------------------------------------------
                      (1)             (2)   
                    price           price   
--------------------------------------------
weight              1.747**         2.025***
                   (2.72)          (5.35)   

mpg                -49.51                   
                  (-0.57)                   

altmpg                             -242.2   
                                  (-0.86)   

_cons              1946.1           40.87   
                   (0.54)          (0.03)   
--------------------------------------------
N                      74              74   
--------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

. esttab, rename(altmpg mpg)

--------------------------------------------
                      (1)             (2)   
                    price           price   
--------------------------------------------
weight              1.747**         2.025***
                   (2.72)          (5.35)   

mpg                -49.51          -242.2   
                  (-0.57)         (-0.86)   

_cons              1946.1           40.87   
                   (0.54)          (0.03)   
--------------------------------------------
N                      74              74   
--------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

. eststo clear
Code