Announcement

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

  • Summarize/aggregate variables for Regression Output/Table (Visualization)

    Hello, on the left side is the output of Stata, I want to summarize/aggregate (I hope that's the right word for it) the marked ones. So that it looks like on the right side.
    Is there any code for this or do I have to do this manually?
    Attached Files

  • #2
    You should use factor variables instead of generating the country dummies yourself. estout (the Stata Journal) can do this for you. Here is an example where I estimate two models using LSDV and use factor variables.

    Code:
    webuse grunfeld, clear
    *ssc install estout
    eststo m1: regress invest mvalue time i.company
    eststo m2: regress kstock mvalue time i.company
    esttab m1 m2,drop(_cons) indicate(Firm effects= *.company) s(r2 N, lab("R-squared" "Observations"))
    Res.:

    Code:
    . esttab m1 m2,drop(_cons) indicate(Firm effects= *.company) s(r2 N, lab("R-squared" "Observations"
    > ))
    
    --------------------------------------------
                          (1)             (2)   
                       invest          kstock   
    --------------------------------------------
    mvalue              0.164***        0.149***
                       (9.52)          (4.03)   
    
    time                5.949***        24.36***
                       (5.88)         (11.15)   
    
    Firm effects          Yes             Yes   
    --------------------------------------------
    R-squared           0.873           0.691   
    Observations          200             200   
    --------------------------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001

    Comment


    • #3
      Thank you!

      Comment


      • #4
        Andrew Musau I have another question. How can I save this output/table as a Word file now?
        I tried with putdocx. can you tell me the code?

        Comment


        • #5
          For the code in #2

          Code:
          esttab m1 m2 using myfile.rtf, replace drop(_cons) indicate(Firm effects= *.company) s(r2 N, lab("R-squared" "Observations"))
          or

          Code:
          esttab m1 m2 using myfile.doc, replace drop(_cons) indicate(Firm effects= *.company) s(r2 N, lab("R-squared" "Observations"))

          The difference is the first creates a rich text format (rtf) file while the second a word document. You can open the rtf file with MS Word, and sometimes the formatting is better for the rtf than the doc file in terms of how the columns are rendered.

          Comment

          Working...
          X