Announcement

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

  • Where is alpha stored after using zinb

    Hello,

    The following is the example from the Stata manual for a zinb regression.

    Click image for larger version

Name:	zinb_alpha.png
Views:	1
Size:	101.9 KB
ID:	1649636


    I would like to include alpha and its confidence interval in the table generated by outreg2. When using outreg2, only the coefficient of lnalpha and its confidence interval are reported, not alpha.
    I would like to manually put alpha into the outreg2 table by using adds() option, but I cannot find where alpha is stored. I've tried `_b[alpha]', but it doesn't work.
    I would really appreciate it if someone could let me know how I could make it work. Thank you.

  • #2
    I can't speak to using -outest- but alpha is obtained easily enough by exponentiating -lnalpha- (which literally means the natural log of alpha) as back-transformation.

    One way to get these estimates is to use -lincom- which will conveniently exponentiate the results for you. Save the results in scalars and then you can do whatever you wish with them.

    Code:
    lincom _b[/lnalpha], eform
    scalar alpha = r(estimate)
    scalar alpha_lb = r(lb)
    scalar alpha_ub = r(ub)
    
    scalar list alpha alpha_lb alpha_ub
    Result

    Code:
    . lincom _b[/lnalpha], eform
    
     ( 1)  [/]lnalpha = 0
    
    ------------------------------------------------------------------------------
           count |     exp(b)   Std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
             (1) |   1.667029   .3028685     2.81   0.005     1.167604    2.380076
    ------------------------------------------------------------------------------
    
    . scalar alpha = r(estimate)
    . scalar alpha_lb = r(lb)
    . scalar alpha_ub = r(ub)
    
    . scalar list alpha alpha_lb alpha_ub
         alpha =  1.6670288
      alpha_lb =  1.1676037
      alpha_ub =  2.3800757

    Comment


    • #3
      Just for a little more explanation, if it makes sense, you can always (usually) acces stuff like this from matricies.

      Code:
      use https://www.stata-press.com/data/r17/fish, clear
      
      cls
      
      
      qui zinb count persons, inflate(child camper)
      
      mat A = e(b)
      
      mat l A

      Comment


      • #4
        Thank you Leonardo. This works perfectly.

        Originally posted by Leonardo Guizzetti View Post
        I can't speak to using -outest- but alpha is obtained easily enough by exponentiating -lnalpha- (which literally means the natural log of alpha) as back-transformation.

        One way to get these estimates is to use -lincom- which will conveniently exponentiate the results for you. Save the results in scalars and then you can do whatever you wish with them.

        Code:
        lincom _b[/lnalpha], eform
        scalar alpha = r(estimate)
        scalar alpha_lb = r(lb)
        scalar alpha_ub = r(ub)
        
        scalar list alpha alpha_lb alpha_ub
        Result

        Code:
        . lincom _b[/lnalpha], eform
        
        ( 1) [/]lnalpha = 0
        
        ------------------------------------------------------------------------------
        count | exp(b) Std. err. z P>|z| [95% conf. interval]
        -------------+----------------------------------------------------------------
        (1) | 1.667029 .3028685 2.81 0.005 1.167604 2.380076
        ------------------------------------------------------------------------------
        
        . scalar alpha = r(estimate)
        . scalar alpha_lb = r(lb)
        . scalar alpha_ub = r(ub)
        
        . scalar list alpha alpha_lb alpha_ub
        alpha = 1.6670288
        alpha_lb = 1.1676037
        alpha_ub = 2.3800757

        Comment

        Working...
        X