Announcement

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

  • Publication-ready tables of margins with bootstrapped standard errors

    I am having trouble creating a publication-ready table from the output of a margins command called from within a bootstrap program. What I want to do is present the margins and standard errors for each outcome side by side. I can do this without the bootstrap. For instance, using Ben Jann's estout (SJ14-2:st0085_2)

    Code:
    clear all
    set more off
    use http://www.stata-press.com/data/r15/nmihs.dta
    
    mlogit bwgrp marital age highbp, baseoutcome(3)
    estimates store one
    foreach o in  1  2 {
             margins, dydx(*) predict(outcome(`o')) post
             estimates store m1_`o'
            estimates restore  one
        }
        
    estout  m1_1 m1_2, cells (b (star fmt(3)) t(par fmt(2)))
    results in


    Code:
    --------------------------------------------
                         m1_1            m1_2  
                          b/t             b/t  
    --------------------------------------------
    marital            -0.046***       -0.034***
                      (-5.91)         (-4.39)  
    age                 0.001*          0.000  
                       (2.21)          (0.10)  
    highbp              0.070***        0.066***
                       (5.32)          (4.93)  
    --------------------------------------------

    How can I get a similar table if I need to bootstrap the standard errors? The following code stores the results of the mlogit command in bs1, not the margins command; I believe that m2_1 and M2_2 contain the results of the last iteration.

    Code:
    program bs_con, eclass
    mlogit bwgrp marital age highbp , baseoutcome(3)
    estimates store bsts
    foreach o in  1  2 {
             margins, dydx(*) predict(outcome(`o')) post
             estimates store m2_`o'
            estimates restore bsts
        }
    end program
    
    bootstrap, reps(5) : bs_con
    estimates store bs1
    On the other hand, this code saves the results I want, but not in the format I'd like for presentation.
    Code:
    program bs_con2, eclass
    mlogit bwgrp marital age highbp , baseoutcome(3)
    estimates store bsts
    margins, dydx(*)  post
    end program
    
    bootstrap, reps(5) : bs_con2
    estimates store bs2
    Code:
    . estout  bs2, cells (b (star fmt(3)) t(par fmt(2)))
    
    ----------------------------
                          bs2   
                          b/t   
    ----------------------------
    marital                     
    1._predict         -0.046***
                      (-6.13)   
    2._predict         -0.034***
                      (-7.64)   
    3._predict          0.081***
                       (7.39)   
    ----------------------------
    age                         
    1._predict          0.001*  
                       (2.45)   
    2._predict          0.000   
                       (0.14)   
    3._predict         -0.002*  
                      (-2.24)   
    ----------------------------
    highbp                      
    1._predict          0.070***
                       (7.94)   
    2._predict          0.066***
                       (4.51)   
    3._predict         -0.136***
                     (-11.96)   
    ----------------------------

    Any advice would be much appreciated.

    Thanks,
    Devra
    Devra Golbe
    Professor Emerita, Dept. of Economics
    Hunter College, CUNY

  • #2
    Stata will let you copy and past results as tables. It may be less trouble to set up the table in your paper and copy and paste these results into the right columns than it would be to program it.

    Comment


    • #3
      Thanks, Phil. I was hoping to avoid that, but perhaps it can't be helped.

      Best,
      Devra
      Devra Golbe
      Professor Emerita, Dept. of Economics
      Hunter College, CUNY

      Comment

      Working...
      X