Hi Statalist,
I am using a two-part model to estimate healthcare expenditure for some demographic groups (married unmarried) where I need to bootstrap marginal effects. I have used the following codes (Belotti et al. 2015):
capture program drop dydx_boot
program define dydx _boot, eclass
foreach sex in male female {
foreach agegroup in age1824 age2544 age4564 age6574 age75over {
foreach region in neast midw west south {
di "`region', `sex', `agegroup'"
svy: twopm totexp married unmarried `controls' if `sex' == 1 & `agegroup' == 1& `region', firstpart(logit) secondpart(glm, family(gamma) link(log))
margins, dydx(married unmarried) subpop (if `sex' == 1 & `agegroup' == 1 & `region') predict(duan) nose post
}
}
}
End
bootstrap _b, seed(1234) reps(100) nodrop: dydx_boot
While the program codes ran without any errors, the dydx_boot picked the last estimates (female age75over south) only to bootstrap the marginal effects. It did not bootstrap the marginal effects for other estimates. The marginal effects of all estimates were already saved in the memory as executing dydx_boot displayed marginal effects for all estimates. So how can I tell stata to bootstrap marginal effects of all estimates?
Thanks in advance for your expertise!
Ramesh Ghimire
University of Georgia
Athens, GA 30605
I am using a two-part model to estimate healthcare expenditure for some demographic groups (married unmarried) where I need to bootstrap marginal effects. I have used the following codes (Belotti et al. 2015):
capture program drop dydx_boot
program define dydx _boot, eclass
foreach sex in male female {
foreach agegroup in age1824 age2544 age4564 age6574 age75over {
foreach region in neast midw west south {
di "`region', `sex', `agegroup'"
svy: twopm totexp married unmarried `controls' if `sex' == 1 & `agegroup' == 1& `region', firstpart(logit) secondpart(glm, family(gamma) link(log))
margins, dydx(married unmarried) subpop (if `sex' == 1 & `agegroup' == 1 & `region') predict(duan) nose post
}
}
}
End
bootstrap _b, seed(1234) reps(100) nodrop: dydx_boot
While the program codes ran without any errors, the dydx_boot picked the last estimates (female age75over south) only to bootstrap the marginal effects. It did not bootstrap the marginal effects for other estimates. The marginal effects of all estimates were already saved in the memory as executing dydx_boot displayed marginal effects for all estimates. So how can I tell stata to bootstrap marginal effects of all estimates?
Thanks in advance for your expertise!
Ramesh Ghimire
University of Georgia
Athens, GA 30605
Comment