Announcement

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

  • Combining different variables in one line in estout output

    I have two different models stored into model1 and model2 (saved them using "estimates store model*"), now I want to make Tex output table where coefficients from models will be displayed in one line under same name. The problem is it is different coefficients - 1.dum_treatment#1.cj_march and dummy_treatment. When I use following syntax, I got output in two different lines even under one naming:

    Code:
    esttab model*  using "Table3.tex",  replace b(3) se(3)  label star(* 0.10 ** 0.05 *** 0.01) varlabels(1.dum_treatment#1.cj_march "CJ Visits X Post-Movement" dummy_treatment "CJ Visits X Post-Movement",)  keep(1.dum_treatment#1.cj_march dummy_treatment) .
    Is there any way to fix it?

  • #2
    If I understand you correctly, something like this will do what you want:

    Code:
    clear
    webuse auto
    gen repdum=0
    replace repdum=1 if rep78>3
    
    rename foreign dummy
    reg mpg weight dummy
    estimates store m1
    
    drop dummy
    rename repdum dummy
    reg mpg weight dummy
    estimates store m2
    
    esttab m*
    The output it produces looks like this:

    Code:
    --------------------------------------------
                          (1)             (2)   
                          mpg             mpg   
    --------------------------------------------
    weight           -0.00659***     -0.00590***
                     (-10.34)        (-10.42)   
    
    dummy              -1.650           0.416   
                      (-1.53)          (0.47)   
    
    _cons               41.68***        38.93***
                      (19.25)         (19.98)   
    --------------------------------------------
    N                      74              74   
    --------------------------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001
    That said, here's my question: How is the reader to understand what to infer from the coefficients, since the dummy is not the same in the two models?
    Devra Golbe
    Professor Emerita, Dept. of Economics
    Hunter College, CUNY

    Comment


    • #3
      That said, here's my question: How is the reader to understand what to infer from the coefficients, since the dummy is not the same in the two models?
      Actually, it is the same independent variable, but in one model it is being constructed as interaction variable - 1.dum_treatment#1.cj_march ; in second model it is being constructed manually and called dummy_treatment. So the issue is the results are already stored and include one interaction variable and one non-interaction.

      Comment


      • #4
        Sorry- the fact that the first "variable" is an interaction did not register. As you no doubt realized, my renaming strategy won't work for that.
        Devra Golbe
        Professor Emerita, Dept. of Economics
        Hunter College, CUNY

        Comment


        • #5
          estout is from SSC (FAQ Advice #12). Providing a reproducible example, as Devra Golbe did, would elicit faster replies. What you need is to rename the relevant coefficient in e(b) for one of the regressions to match the other. For this, consider erepost from SSC.

          Code:
          sysuse auto, clear
          
          gen turndisp= c.turn#c.disp
          eststo m1: reg mpg weight turndisp
          local colnames "`:colnames e(b)'"
          
          reg price weight c.turn#c.disp
          mat b= e(b)
          mat colnames b= `colnames'
          erepost b=b, rename
          estimates store m2
          
          esttab m1 m2, coeflabel(turndisp "turn × displacement") label
          Res.:

          Code:
          . esttab m1 m2, coeflabel(turndisp "turn × displacement") label
          
          ----------------------------------------------------
                                        (1)             (2)   
                               Mileage (m~)           Price   
          ----------------------------------------------------
          Weight (lbs.)            -0.00677***        1.943*  
                                    (-5.23)          (2.06)   
          
          turn × displacement      0.000144          0.0191   
                                     (0.64)          (0.12)   
          
          Constant                    40.58***        143.1   
                                    (16.96)          (0.08)   
          ----------------------------------------------------
          Observations                   74              74   
          ----------------------------------------------------
          t statistics in parentheses
          * p<0.05, ** p<0.01, *** p<0.001

          Comment


          • #6
            Originally posted by Devra Golbe View Post
            Sorry- the fact that the first "variable" is an interaction did not register. As you no doubt realized, my renaming strategy won't work for that.
            The renaming would work if the variable to be renamed is the interaction term. Whatever you do with factor variables can be replicated manually.

            Comment

            Working...
            X