Announcement

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

  • Negative Binomial Regression output question with IRR

    I currently have the following codes to export negative binomial regression results to excel:

    nbreg $reg1 estimates store m1, title(DV=KEYWORDS)
    nbreg $reg1, irr estimates store m2, title(DV=KEYWORDSPOST)
    estout m1 m2, cells(b(star fmt(3)) se(par fmt(2)))
    legend label varlabels(_cons Constant)


    However, when i run these codes, I am only getting the m1 output with no incidence ratio coefficients. I was wondering if there is a way to export one column showing non-irr results and another column next to each other showing irr results.

    Thank you,

  • #2
    Welcome to Statalist. Please take the time to review the FAQs to improve your future posts. Here are some missing details:

    1. estout is from Stata Journal / SSC.
    2. Incidence-rate ratios here refer to exponentiated negative binomial coefficients

    With more current versions of estout, you can output the same model multiple times. The -irr- option in nbreg only affects the displayed results, i.e., it does not change the coefficients and variance matrices. However, estout has options to output exponentiated coefficients. Here is a reproducible example:

    Code:
    webuse rod93
    generate logexp=ln(exposure)
    qui nbreg deaths i.cohort, exposure(exp)
    estimates store m1
    esttab m1 m1, transform(exp(@), pattern(0 1))
    *COMPARE WITH STATA RESULTS
    nbreg deaths i.cohort, exposure(exp) nolog
    nbreg deaths i.cohort, exposure(exp) nolog irr
    Res.:

    Code:
    . esttab m1 m1, transform(exp(@), pattern(0 1))
    
    --------------------------------------------
                          (1)             (2)  
                       deaths          deaths  
    --------------------------------------------
    deaths                                      
    1.cohort                0               1  
                          (.)             (.)  
    
    2.cohort           -0.268           0.765  
                      (-0.37)         (-0.37)  
    
    3.cohort           -0.457           0.633  
                      (-0.63)         (-0.63)  
    
    _cons              -2.087***        0.124***
                      (-4.08)         (-4.08)  
    --------------------------------------------
    /                                          
    lnalpha             0.594*          1.811*  
                       (2.30)          (2.30)  
    --------------------------------------------
    N                      21              21  
    --------------------------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001
    
    .
    . *COMPARE WITH STATA RESULTS
    
    .
    . nbreg deaths i.cohort, exposure(exp) nolog
    
    Negative binomial regression                    Number of obs     =         21
                                                    LR chi2(2)        =       0.40
    Dispersion     = mean                           Prob > chi2       =     0.8171
    Log likelihood =  -131.3799                     Pseudo R2         =     0.0015
    
    ------------------------------------------------------------------------------
          deaths |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
          cohort |
      1960-1967  |  -.2676187   .7237203    -0.37   0.712    -1.686085    1.150847
      1968-1976  |  -.4573957   .7236651    -0.63   0.527    -1.875753    .9609618
                 |
           _cons |  -2.086731   .5118559    -4.08   0.000     -3.08995   -1.083511
    ln(exposure) |          1  (exposure)
    -------------+----------------------------------------------------------------
        /lnalpha |   .5939963   .2583615                       .087617    1.100376
    -------------+----------------------------------------------------------------
           alpha |   1.811212   .4679475                       1.09157    3.005294
    ------------------------------------------------------------------------------
    LR test of alpha=0: chibar2(01) = 4056.27              Prob >= chibar2 = 0.000
    
    .
    . nbreg deaths i.cohort, exposure(exp) nolog irr
    
    Negative binomial regression                    Number of obs     =         21
                                                    LR chi2(2)        =       0.40
    Dispersion     = mean                           Prob > chi2       =     0.8171
    Log likelihood =  -131.3799                     Pseudo R2         =     0.0015
    
    ------------------------------------------------------------------------------
          deaths |        IRR   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
          cohort |
      1960-1967  |   .7651995   .5537904    -0.37   0.712     .1852434    3.160869
      1968-1976  |   .6329298   .4580292    -0.63   0.527     .1532395    2.614209
                 |
           _cons |   .1240922   .0635173    -4.08   0.000     .0455042    .3384052
    ln(exposure) |          1  (exposure)
    -------------+----------------------------------------------------------------
        /lnalpha |   .5939963   .2583615                       .087617    1.100376
    -------------+----------------------------------------------------------------
           alpha |   1.811212   .4679475                       1.09157    3.005294
    ------------------------------------------------------------------------------
    Note: Estimates are transformed only in the first equation.
    Note: _cons estimates baseline incidence rate.
    LR test of alpha=0: chibar2(01) = 4056.27              Prob >= chibar2 = 0.000
    
    .
    Last edited by Andrew Musau; 09 Oct 2020, 13:10.

    Comment

    Working...
    X