Announcement

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

  • esttab, eststo and appendmodels

    Dear all, I am tabulating different dependent variables in consecutive rows (not consecutive columns as it is the default for esttab) and I'm keeping only one explanatory variable. I want two columns per model, one with few controls, the other one with more controls. I'm using the option "appendmodels" so every dependent variable is showed in a row. I would like the explanatory variable I'm keeping to have the label/name of the dependent variable. I have tried to use rename and change the label of the explanatory variable every time I run the regression but it keeps only the last change and not a different label for each regression. See an example of what I'm doing below. I have three different rows with the variable foreign, but I want instead the name of the dependent variable used in each specification. In the example I would like to change "foreign" for the name of the dependent variables (price and weight). Any help would be appreciated. Thanks, Lina.

    sysuse auto, clear
    eststo r1: reg price foreign
    eststo r2: reg price foreign head

    eststo r3: reg weight foreign
    eststo r4: reg weight foreign head

    eststo nocontrols: appendmodels r1 r3
    eststo controls: appendmodels r2 r4

    esttab controls nocontrols, replace keep(foreign)






  • #2
    esttab is from Stata Journal, authored by Ben Jann (you are asked to explain). Secondly, appendmodels is not an option of esttab/ estout, but an independent program written by Ben. This can be copied from here. There are a number of ways of achieving what you want, but the simplest that I can think of is to rename the desired coefficients differently across the regressions and use the coeflabel() option at the end to again rename the coefficients. From your example:

    Code:
    sysuse auto, clear
    eststo r1: reg price foreign
    eststo r2: reg price foreign head
    
    rename foreign foreign1
    eststo r3: reg weight foreign1
    eststo r4: reg weight foreign1 head
    
    eststo nocontrols: appendmodels r1 r3
    eststo controls: appendmodels r2 r4
    esttab controls nocontrols, replace keep(foreig*) coeflabel(foreign price foreign1 weight) mtitles

    Comment


    • #3
      Dear Andrew, this works. Thanks a lot, Regards.

      Comment

      Working...
      X