Announcement

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

  • Adding group name to categorical variables in esttab command

    Hi,
    I am trying to add a heading for each categorical variable in my regression.
    This is the code I am now using:

    oprobit life_satisfaction population ${x}
    est store est1

    //LS for jews:
    oprobit life_satisfaction ${x} i.migration i.migrate_year if population==1
    est store est2

    //LS for arabs:
    oprobit life_satisfaction ${x} i.religion_arab
    est store est3

    esttab est1 est2 est3 using ls.doc, replace noomitted nobaselevels se pr2 label mlabels("Pooled" "Jews" "Arabs")



    To generate the outcome:


    --------------------------------------------------------------------
    (1) (2) (3)
    Pooled Jews Arabs
    --------------------------------------------------------------------


    married 0.251*** 0.243*** 0.245
    (0.0558) (0.0645) (0.127)

    divorced/separated -0.0670 -0.0194 -0.236
    (0.0755) (0.0816) (0.254)

    widow(er) 0.0453 0.0218 0.236
    (0.0966) (0.106) (0.261)


    1-<2 -0.0692 -0.0755 -0.0791
    (0.0434) (0.0475) (0.120)

    2+ -0.255** -0.127 -0.301
    (0.0839) (0.115) (0.174)




    I would like the outcome to be similar to the one below: (now added it by hand, but am searching for a code....)

    --------------------------------------------------------------------
    (1) (2) (3)
    Pooled Jews Arabs
    --------------------------------------------------------------------

    Marital_status

    married 0.251*** 0.243*** 0.245
    (0.0558) (0.0645) (0.127)

    divorced/separated -0.0670 -0.0194 -0.236
    (0.0755) (0.0816) (0.254)

    widow(er) 0.0453 0.0218 0.236
    (0.0966) (0.106) (0.261)
    Room_pp

    1-<2 -0.0692 -0.0755 -0.0791
    (0.0434) (0.0475) (0.120)

    2+ -0.255** -0.127 -0.301



    For the example above, I would like to add "marital_status" above the categorical variable and "room_pp" above another categorical variable. These are the names of the variables in my dataset
    I have been looking up statalist but didn't find a simple solution for this.
    Hope my answer is clear enough.

    Thank you,
    Shir.

  • #2
    estout/ esttab is from Stata Journal (FAQ Advice #12). See the -refcat- option of estout.

    Code:
    webuse lbw
    probit low age i.race smoke
    esttab, refcat(2.race "Mother's race", nolab) lab nobaselevels
    Res.:

    Code:
    . esttab, refcat(2.race "Mother's race", nolab) lab nobaselevels
    
    ------------------------------------
                                  (1)   
                         birthw~2500g   
    ------------------------------------
    birthweight<2500g                   
    age of mother             -0.0219   
                              (-1.09)   
    
    Mother's race                       
    
    black                       0.618*  
                               (2.06)   
    
    other                       0.646** 
                               (2.69)   
    
    smoked during preg~y        0.676** 
                               (3.06)   
    
    Constant                   -0.606   
                              (-1.17)   
    ------------------------------------
    Observations                  189   
    ------------------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001

    Comment


    • #3
      Hello! I am also facing the same need of the title for categorical variables in the regression output created in estout (or other package). However, I often have many and different factor variables, so I wonder whether there is an automated way to do this? E.g. if there is a variable label defined for the categorical variable, can it be used by the estout (or other package) to create a heading?

      Comment


      • #4
        I do not believe that such an option exists. You will probably need to write a program that does that if it is something that you often require.

        Comment

        Working...
        X