Announcement

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

  • A help with the user written command (community contributed command) "outreg2"

    Dear Beloved Stata Community
    Again, I am here to get some help, this time with outreg2 from ssc (I guess) in Stata/SE 17.0. I ran the following regressions and the output is as follows

    Code:
    . reghdfe delcash_ta_w ncfo_ta_w tobq_w salesgro size_w lev_w oppro_tass_w age tangi_w ,absorb (id year nic2_flo#year) cluster (id)
    (dropped 306 singleton observations)
    (MWFE estimator converged in 16 iterations)
    
    HDFE Linear regression                            Number of obs   =      9,800
    Absorbing 3 HDFE groups                           F(   8,   1263) =      22.39
    Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                      R-squared       =     0.2311
                                                      Adj R-squared   =     0.0432
                                                      Within R-sq.    =     0.0524
    Number of clusters (id)      =      1,264         Root MSE        =     0.0425
    
                                     (Std. err. adjusted for 1,264 clusters in id)
    ------------------------------------------------------------------------------
                 |               Robust
    delcash_ta_w | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
       ncfo_ta_w |   .1107827    .010324    10.73   0.000     .0905286    .1310367
          tobq_w |   .0023174   .0018335     1.26   0.206    -.0012795    .0059144
        salesgro |  -2.77e-06   .0000232    -0.12   0.905    -.0000483    .0000428
          size_w |  -.0034963   .0016179    -2.16   0.031    -.0066704   -.0003223
           lev_w |   .0205474   .0059138     3.47   0.001     .0089454    .0321494
    oppro_tass_w |    .032717   .0145352     2.25   0.025     .0042013    .0612328
             age |  -.0123589   .0075889    -1.63   0.104    -.0272471    .0025294
         tangi_w |  -.0465638   .0066922    -6.96   0.000    -.0596927   -.0334348
           _cons |   .0738283   .0284194     2.60   0.009     .0180738    .1295827
    ------------------------------------------------------------------------------
    
    Absorbed degrees of freedom:
    ---------------------------------------------------------+
         Absorbed FE | Categories  - Redundant  = Num. Coefs |
    -----------------+---------------------------------------|
                  id |      1264        1264           0    *|
                year |        17           0          17     |
       nic2_flo#year |       653          17         636     |
    ---------------------------------------------------------+
    * = FE nested within cluster; treated as redundant for DoF computation
    
    . outreg2 using myresults.doc,replace ctitle(delcash)
    myresults.doc
    dir : seeout
    
    . 
    . reghdfe capex_ta_w ncfo_ta_w tobq_w salesgro size_w lev_w oppro_tass_w age tangi_w ,absorb (id year nic2_flo#year) cluster (id)
    (dropped 310 singleton observations)
    (MWFE estimator converged in 16 iterations)
    
    HDFE Linear regression                            Number of obs   =      9,721
    Absorbing 3 HDFE groups                           F(   8,   1246) =      24.27
    Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                      R-squared       =     0.5143
                                                      Adj R-squared   =     0.3959
                                                      Within R-sq.    =     0.0545
    Number of clusters (id)      =      1,247         Root MSE        =     0.0643
    
                                     (Std. err. adjusted for 1,247 clusters in id)
    ------------------------------------------------------------------------------
                 |               Robust
      capex_ta_w | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
       ncfo_ta_w |   .1578278   .0144054    10.96   0.000     .1295664    .1860893
          tobq_w |   .0191125    .003027     6.31   0.000     .0131739     .025051
        salesgro |   .0000143   .0000167     0.86   0.391    -.0000184     .000047
          size_w |   .0074396   .0032854     2.26   0.024     .0009941    .0138851
           lev_w |   .0275386   .0125013     2.20   0.028     .0030127    .0520646
    oppro_tass_w |  -.0337393   .0201297    -1.68   0.094     -.073231    .0057525
             age |    -.06303   .0171723    -3.67   0.000    -.0967198   -.0293403
         tangi_w |  -.0717362   .0163641    -4.38   0.000    -.1038404   -.0396319
           _cons |   .2170665    .067523     3.21   0.001     .0845951    .3495378
    ------------------------------------------------------------------------------
    
    Absorbed degrees of freedom:
    ---------------------------------------------------------+
         Absorbed FE | Categories  - Redundant  = Num. Coefs |
    -----------------+---------------------------------------|
                  id |      1247        1247           0    *|
                year |        17           0          17     |
       nic2_flo#year |       651          17         634     |
    ---------------------------------------------------------+
    * = FE nested within cluster; treated as redundant for DoF computation
    
    . outreg2 using myresults.doc,append ctitle(capex) 
    myresults.doc
    dir : seeout
    Code:
     
    (1) (2)
    VARIABLES delcash capex
    ncfo_ta_w 0.111*** 0.158***
    (0.0103) (0.0144)
    tobq_w 0.00232 0.0191***
    (0.00183) (0.00303)
    salesgro -2.77e-06 1.43e-05
    (2.32e-05) (1.67e-05)
    size_w -0.00350** 0.00744**
    (0.00162) (0.00329)
    lev_w 0.0205*** 0.0275**
    (0.00591) (0.0125)
    oppro_tass_w 0.0327** -0.0337*
    (0.0145) (0.0201)
    age -0.0124 -0.0630***
    (0.00759) (0.0172)
    tangi_w -0.0466*** -0.0717***
    (0.00669) (0.0164)
    Constant 0.0738*** 0.217***
    (0.0284) (0.0675)
    Observations 9,800 9,721
    R-squared 0.231 0.514
    Robust standard errors in parentheses *** p<0.01, ** p<0.05, * p<0.1
    I want the following to be added in the output (myresults)
    1. Adjusted R^2
    2.Within R^2
    3.No: of ids/Clusters (individual entities)
    4. Prob > F
    I tried myself, but always got that red lined error regarding syntax. If I cant get this, I will have to input this manually. Can someone help me with this?

  • #2
    There is no need to guess where outreg2 comes from, as (1) if you can use it, perhaps you downloaded it (2) even if someone else downloaded it to a workplace site, a search for outreg2 shows that it is on SSC.

    My main point is different. The author of outreg2 was a poster to Statalist for some while but has not been a member since 2010. outreg2 remains a popular download, it seems, but it doesn't appear to be used much by experienced users here and for that and other reasons questions on it are often unanswered.

    So, I hope you get an answer here, but if not you may need to approach the program author directly.

    Comment


    • #3
      Oh that is sad! In that case is there any way to get results in doc or XLS format having those stats I mentioned by anyother means similar to Outreg2?
      Thanks Nick for alerting me and others on this issue so that we can check for some alternatives. After surfing through Stata, I saw some addstats option to Outreg2 but can't tune it for my purpose.

      For instance, I saw the below codes outreg2 using results, word replace addstat("F-Stat",e(F),"Prob > F",e(p),"Degree of Freedom",e(df_r))

      In the similar fashion, How can I ask Stata to give me adjusted R^2 and no of clusters? What is the syntax
      Last edited by Neelakanda Krishna; 06 Dec 2021, 10:57.

      Comment


      • #4
        I fear that you're over-interpreting my post. There was in #2 a minor point that outreg2 does come from SSC and (by comparison) a major point that you may not get a good answer on it here. Neither rules out it being useful to you, nor do I advise on similar programs. The business of producing elaborate tables from model command output is a very common need, but more rarely mine, or else I write custom code on the fly.

        I can only repeat the second point because I don't use outreg2 and can't advise on its use. The same applies to reghdfebut I don't understand your last question as both quantities you mention are displayed in its output.

        The thread remains wide open for other answers.

        Comment


        • #5
          Originally posted by Neelakanda Krishna View Post
          In the similar fashion, How can I ask Stata to give me adjusted R^2 and no of clusters? What is the syntax
          You can access the estimation results from

          Code:
          ereturn list

          Comment


          • #6
            Thanks Nick Cox for elucidating your point. Earlier, based on post (#2), I was a little bewildered as I thought I had to learn some other commands than -outreg2-.
            ​​​​​​​Thanks ​​​​​​​Andrew Musau for the command mentioned in #5. Luckily, I could see your reply in the post, https://www.statalist.org/forums/for...le#post1509442
            which helped me to tweak the code to get what I need

            Code:
            outreg2 using myresults.doc, title(Crisis years) ctitle(delcash) replace addtext(Firm Fixed Effects, YES, Year Fixed Effects, YES, Industry-Year Interaction,YES) addstat(Adj R-squared,  e(r2_a), R-square within, e(r2_within), No:of firms, e(N_clust), F-Stat, e(F))
            Thanks once again for time and support

            Comment

            Working...
            X