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)
results in
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.
On the other hand, this code saves the results I want, but not in the format I'd like for presentation.
Any advice would be much appreciated.
Thanks,
Devra
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)))
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
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
Comment