Announcement

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

  • Report estimates from Heckman AND margins command

    Dear all,
    I am using Stata 14 and have some questions regarding the commands -Heckman-, -margins- and -outreg2-.

    I am trying to produce tables of my regression results using outreg2.
    I am running Stata's Heckman and margins command, using following code:

    Code:
     heckman y1 `heckvarlist', ///
    select(sel=`probvarlist') vce(cluster id) first
    
    margins, dydx(`heckvarlist') predict(ycond) atmean post
    outreg2 using "myfile.xls", append ctitle(dy/dx Second stage pooled Heckman) dec(3)
    However, I would like my output table to include estimates from the original regression, and not just the marginal effects. I read up on Outreg2 and understand that it's possible to create local macros after running -Heckman- in order to store estimates of e.g. lambda and rho, and include it in the outreg2 output using the addstat command, according to:

    Code:
    heckman y1 `heckvarlist', ///
    select(sel=`probvarlist') vce(cluster id) first
    
    local Lambda=e(lambda)
    local Selambda=e(selambda)
    local rho=e(rho)
    
    outreg2 using "myfile.xls", adds(Lambda, `Lambda', Selambda, `Selambda', rho, `rho') append ctitle(dy/dx Second stage pooled Heckman) dec(3)
    Which makes the output look like:


    HTML Code:
     VARIABLES    dy/dx Second stage pooled Heckman    
    x1    0.712***    
          (0.029)    
    x2    0.239***    
          (0.067)    
    x3   0.201***    
         (0.063)    
    x4    -0.619***    
        (0.158)    
    x5    0.362***    
        (0.140)    
    x6    0.028    
        (0.033)    
            
    Observations    3,480      
    Lambda         -4.405    
    Selambda        0.512    
    rho            -0.615        
    Standard errors in parentheses *** p<0.01, ** p<0.05, * p<0.1


    However, I would also like to display the standard error of rho, which is displayed at the bottom of the output table after Heckman, i.e.:
    HTML Code:
           _cons |   2.610507   .8621316     3.03   0.002     .9207605    4.300254
    -------------+----------------------------------------------------------------
         /athrho |  -.7173276   .0944943    -7.59   0.000     -.902533   -.5321223
        /lnsigma |   1.968422   .0338867    58.09   0.000     1.902005    2.034839
    -------------+----------------------------------------------------------------
             rho |  -.6152512    .058725                      -.717529   -.4870017
           sigma |   7.159369   .2426076                      6.699314    7.651017
          lambda |  -4.404811   .5117772                     -5.407875   -3.401746
    ------------------------------------------------------------------------------
    Wald test of indep. eqns. (rho = 0): chi2(1) =    57.63   Prob > chi2 = 0.0000
    In the Stata help file on Heckman, I can't find that estimate stored, though. Does anyone know if it is possible to write a command for including it in the outreg2? I know from the helpfile that the standard error of rho is computed using the delta method, does that help me in any way?

    Best regards,

    Hanna Lindström

Working...
X