Announcement

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

  • outreg2 with results from "reg", "ivreg", and "reg3" in a single table

    Full disclosure: My question is motivated by a homework assignment. However, this is regarding automation of my regression output to LaTeX with outreg2, which is purely optional as far as the assignment is concerned. The problems where we're actually learning something new regarding econometrics come later.

    I am working on an assignment, and one of the problems involves taking a supply/demand system [p = f(q, exogenous vars) and q = g(p, exogenous vars)] and running OLS, 2SLS, and 3SLS regressions on them for comparison. Simple enough: use regress, ivregress, and reg3; then store the estimates from each regression.My difficulty is in the follow-up using outreg2. As the estimates from the 3SLS regression have equation names associated with them, it seems that outreg2 doesn't exactly know what to do with the results if they are being put in the same table as regular OLS or 2SLS results.

    When I run outreg2 and request all of my results in one table, I get a table with the OLS and 2SLS results formatted perfectly, but with a single 3SLS containing only the results from the second equation. Even stranger, the constant row and its standard error display are doubled up.

    The output is perfect if I output the OLS and 2SLS results as one table, and then the 3SLS results as another, but I'm curious as to whether anyone knows any tricks for working with this. I've considered extracting the
    e(b) and e(V) results myself and manipulating them to get columns that can line up neatly with each other, but then I don't get automatic parentheses around my standard errors. Besides, that seems overkill and I suspect somebody already knows how to circumvent the problem I'm having.

    Any ideas? I've attached my files here in case anyone would like to take a look. Not much to them, really.
    Attached Files

  • #2
    I've fiddled around with eststo and esttab as an alternative. The unstack option in esttab gets me closer. Sadly, I can't seem to order my coefficients, as any equation that doesn't contain the first variable I order by is dropped by esttab. I'm only posting the text output, but the same thing happens with LaTeX output, of course.

    Code:
    . esttab ols1 ols2 iv1 iv2 reg3, ///
    >         unstack label
    
    --------------------------------------------------------------------------------------------------------------------
                                  (1)             (2)             (3)             (4)             (5)                   
                                Price        Quantity           Price        Quantity           Price                   
                                    _               _               _               _           Price        Quantity   
    --------------------------------------------------------------------------------------------------------------------
    Quantity                    0.818                           3.094**                         3.094**                 
                               (1.85)                          (2.83)                          (2.83)                   
    
    Income                     0.0115*                        -0.0110                         -0.0110                   
                               (2.37)                         (-0.98)                         (-0.98)                   
    
    Price                                  -0.0000956                           1.647                           1.342   
                                              (-0.00)                          (0.89)                          (0.91)   
    
    Input Cost                                  0.175                          -0.577                          -0.264   
                                               (0.97)                         (-0.60)                         (-0.43)   
    
    Land                                        0.149                          -0.251                          -0.327   
                                               (0.98)                         (-0.42)                         (-0.67)   
    
    Constant                   -86.49***        63.31***       -99.50***        19.07          -99.50***        23.35   
                              (-4.71)         (11.05)         (-3.89)          (0.37)         (-3.89)          (0.55)   
    --------------------------------------------------------------------------------------------------------------------
    Observations                   27              27              27              27              27                   
    --------------------------------------------------------------------------------------------------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001
    
    . 
    . esttab ols1 ols2 iv1 iv2 reg3, ///
    >         unstack label order(p q i w l)
    
    ------------------------------------------------------------------------------------
                                  (2)             (4)             (5)                   
                             Quantity        Quantity           Price                   
                                    _               _        Quantity               _   
    ------------------------------------------------------------------------------------
    Price                  -0.0000956           1.647           1.342                   
                              (-0.00)          (0.89)          (0.91)                   
    
    Quantity                                                                            
                                                                                        
    
    Income                                                                              
                                                                                        
    
    Input Cost                  0.175          -0.577          -0.264                   
                               (0.97)         (-0.60)         (-0.43)                   
    
    Land                        0.149          -0.251          -0.327                   
                               (0.98)         (-0.42)         (-0.67)                   
    
    Constant                    63.31***        19.07           23.35                   
                              (11.05)          (0.37)          (0.55)                   
    ------------------------------------------------------------------------------------
    Observations                   27              27              27                   
    ------------------------------------------------------------------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001

    Comment


    • #3
      As estout seems to be more flexible, I e-mailed its creator Ben Jann for advice. He said that the above behavior is indeed very strange, and offered a workaround that did a fine job of giving me the formatting results I was looking for (albeit certainly not the econometric results I'm looking for):

      Code:
      . esttab est1 est2 est3 est4 est5 est5, ///
      >     equations(1:1:1:1:1:2) keep(#1:) eqlabels(none) ///
      >     label order(p q i w l) ///
      >     mlabels("Price" "Quantity" "Price" "Quantity" "Price" "Quantity") ///
      >     mgroups("OLS" "2SLS" "3SLS", pattern(1 0 1 0 1 0)) ///
      >     cells(b(star fmt(%6.3g)) se(par fmt(%6.3g))) ///
      >     stats(N r2, fmt(0 3)) ///
      >     title(Estimation Results for OLS, 2SLS, and 3SLS)
      
      Estimation Results for OLS, 2SLS, and 3SLS
      --------------------------------------------------------------------------------------------------------------------
                                    OLS                            2SLS                            3SLS                  
                                    (1)             (2)             (3)             (4)             (5)             (6)  
                                  Price        Quantity           Price        Quantity           Price        Quantity  
                                   b/se            b/se            b/se            b/se            b/se            b/se  
      --------------------------------------------------------------------------------------------------------------------
      Price                                    -9.6e-05                            1.65                            1.34  
                                                 (.128)                          (1.86)                          (1.48)  
      Quantity                     .818                            .934                            3.09**                
                                 (.443)                          (.689)                          (1.09)                  
      Income                      .0115*                                                          -.011                  
                                (.0049)                                                         (.0112)                  
      Input Cost                                   .175                           -.577                           -.264  
                                                 (.179)                          (.957)                          (.619)  
      Land                                         .149            .357           -.251                           -.327  
                                                 (.152)          (.213)          (.598)                          (.488)  
      Constant                    -86.5***         63.3***        -25.7            19.1           -99.5***         23.3  
                                 (18.4)          (5.73)          (46.6)          (51.3)          (25.6)          (42.7)  
      --------------------------------------------------------------------------------------------------------------------
      N                              27              27              27              27              27              27  
      r2                          0.790           0.830           0.853               .           0.560           0.014  
      --------------------------------------------------------------------------------------------------------------------
      I'm still going to have to rethink my specification/instrument choices as my results are not very sensible, but that's a different topic altogether!

      I consider the original problem solved at any rate, so if there's a flag to add to the subject line I have no problem with that.
      Last edited by Robert Roper; 28 Feb 2017, 05:50.

      Comment


      • #4
        Thank you so much for posting your solutions!!!! This has been extremely helpful!!!!!!

        Comment

        Working...
        X