Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • order of independent variables in -esttab- command

    the following code shows two "interesting" independent variables (mpg and displacement) whose impact on price I want to investigate with two control variables length and weight.

    Code:
    sysuse auto.dta, clear
    
    estimates clear
    reg price mpg weight length
    estimates store reg1
    reg price displacement weight length
    estimates store reg2
    
    esttab *
    The output of this esttab is, however:

    Code:
    --------------------------------------------
                          (1)             (2)  
                        price           price  
    --------------------------------------------
    mpg                -86.79                  
                      (-1.03)                  
    
    weight              4.365***        4.613**
                       (3.74)          (3.30)  
    
    length             -104.9*         -97.63*  
                      (-2.64)         (-2.47)  
    
    displacement                        0.727  
                                       (0.10)  
    
    _cons             14542.4*        10440.6*  
                       (2.47)          (2.39)  
    --------------------------------------------
    N                      74              74  
    --------------------------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001
    As you can see, the variables mpg and displacement are visually separated, counterintuitive to the content and interpretation (this is a valid concern, no?). What can I do to have these models
    • in the same table
    • with the variables that I identify as "interesting", but that are not in each of the models, at the top
    i.e. like this:
    Code:
    --------------------------------------------
                          (1)             (2)  
                        price           price  
    --------------------------------------------
    mpg                -86.79                  
                      (-1.03)                  
    
    displacement                        0.727  
                                       (0.10)  
    
    weight              4.365***        4.613**
                       (3.74)          (3.30)  
    
    length             -104.9*         -97.63*  
                      (-2.64)         (-2.47)  
    
    _cons             14542.4*        10440.6*  
                       (2.47)          (2.39)  
    --------------------------------------------
    N                      74              74  
    --------------------------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001
    I am aware that I can put them next to each other at the bottom of the table, by typing
    Code:
    sysuse auto.dta, clear
    
    estimates clear
    reg price weight length mpg
    estimates store reg1
    reg price weight length displacement
    estimates store reg2
    
    esttab *
    which gives
    Code:
    --------------------------------------------
                          (1)             (2)  
                        price           price  
    --------------------------------------------
    weight              4.365***        4.613**
                       (3.74)          (3.30)  
    
    length             -104.9*         -97.63*  
                      (-2.64)         (-2.47)  
    
    mpg                -86.79                  
                      (-1.03)                  
    
    displacement                        0.727  
                                       (0.10)  
    
    _cons             14542.4*        10440.6*  
                       (2.47)          (2.39)  
    --------------------------------------------
    N                      74              74  
    --------------------------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001
    However, I would find it very odd to find these interesting variables wedged between the control variables and the number of observations, r^2, etc. (no?), so what can I do?
    Last edited by Max Piper; 15 Dec 2016, 09:43. Reason: esttab, regression

  • #2
    The output of help esttab points us to the order option to achieve precisely specified ordering of the results.
    Code:
    . esttab *, order(mpg displacement)
    
    --------------------------------------------
                          (1)             (2)  
                        price           price  
    --------------------------------------------
    mpg                -86.79                  
                      (-1.03)                  
    
    displacement                        0.727  
                                       (0.10)  
    
    weight              4.365***        4.613**
                       (3.74)          (3.30)  
    
    length             -104.9*         -97.63*  
                      (-2.64)         (-2.47)  
    
    _cons             14542.4*        10440.6*  
                       (2.47)          (2.39)  
    --------------------------------------------
    N                      74              74  
    --------------------------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001

    Comment

    Working...
    X