Announcement

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

  • Outreg2, stats()

    Hi, I am trying to create output tables for logistic and multinomial logistic regression which will show odds ratio or relative risk ratio instead of coefficients. I use outreg2 using "..docx", stats (coef ci pval) and it works when I am looking for coefficients instead of OR/RRR. But I need to create output tables reporting OR/RRR instead along with CIs.
    There is no way to specify OR/RRR in stats(). My tables are pretty huge so copy-pasting OR/RRR from output one-by-one is not a good idea. Is there a way to do this?
    Thanks!

  • #2
    outreg2 is from SSC (FAQ Advice #12). You just need a transformation of the coefficients and standard errors.

    Code:
    webuse lbw, clear
    logit low age lwt i.race, or
    outreg2 using myfile, stats(coef se) stnum(replace coef=exp(coef), replace se=coef*se)
    Res.:

    Code:
    . logit low age lwt i.race, or
    
    Iteration 0:   log likelihood =   -117.336  
    Iteration 1:   log likelihood = -111.44695  
    Iteration 2:   log likelihood = -111.33851  
    Iteration 3:   log likelihood = -111.33847  
    Iteration 4:   log likelihood = -111.33847  
    
    Logistic regression                                     Number of obs =    189
                                                            LR chi2(4)    =  12.00
                                                            Prob > chi2   = 0.0174
    Log likelihood = -111.33847                             Pseudo R2     = 0.0511
    
    ------------------------------------------------------------------------------
             low | Odds Ratio   Std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
             age |   .9747731   .0324118    -0.77   0.442      .913273    1.040415
             lwt |   .9857717   .0064287    -2.20   0.028     .9732518    .9984526
                 |
            race |
          black  |   2.727539   1.358248     2.01   0.044     1.027764    7.238499
          other  |   1.558693   .5614898     1.23   0.218     .7693628    3.157838
                 |
           _cons |   3.685916   3.942892     1.22   0.223     .4528972    29.99793
    ------------------------------------------------------------------------------
    Note: _cons estimates baseline odds.
    Click image for larger version

Name:	Screenshot 2022-10-08 200120.png
Views:	1
Size:	18.5 KB
ID:	1684832

    Comment


    • #3
      Thank you very much, this works. However, instead of transformation of the standard errors I want to have the confidence interval. I tried:
      outreg2 using myfile, stats(coef ci pval) stnum(replace coef=exp(coef), replace ci=coef*ci) But this didn't work, it says ci ambiguous abbreviation. How to transform? Thanks!

      Comment


      • #4
        Maybe easier with

        Code:
        outreg2 using myfile, replace stats(coef ci pval) eform

        Comment


        • #5
          Thanks, it works!

          Comment

          Working...
          X