I am using Stata 15.
I am trying to estimate the marginal effects for a logit-truncated negative binomial hurdle model. Unfortunately I do not have the citation because I am using photocopies of pages from a book given to me by my advisor. The author of the book estimates the two parts of the model and then uses suest followed by a series of local macros followed by margins to estimate the marginal effects. I am following his method and it seems I am running into a silly error that I can't figure out.
Here's my code:
Code:
quietly svy linearized, subpop(SPD):logit useanyhcru i.yearind i.sex i.raceeth2 i.region i.married i.education ib1.natstat c.pcs ib1.agecat ib1.povcat2 i.insstat1 estimates store anyh1 quietly svy linearized, subpop(SPD):tnbreg anyhcru i.yearind i.sex i.raceeth2 i. region i.married i.education ib1.natstat c.pcs ib1.agecat ib1.povcat2 i.insstat1 if anyhcru>0, ll(0) estimates store anyh2 quietly suest anyh1 anyh2 /*hurdle nb model marginal effects*/ local logit "invlogit(predict(eq(anyh1_useanyhcru))) " local ey "exp(predict(eq(anyh2_anyhcru))) " local pygt0 "(nbinomialtail(exp(-predict(eq(/anyh2:lnalpha))),1,""1/(1+exp(predict(eq(anyh2_anyHCRU)))/exp(-predict(eq(/anyh2:lnalpha))))))" margins, dydx(*) expression("`logit'*`ey'/`pygt0'")
When I run the model, I get the following error:
Code:
. /*hurdle nb model suest*/ . quietly svy linearized, subpop(SPD):logit useanyhcru i.yearind i.sex i.raceeth2 i.region i.married i.education ib1.natstat c.pcs ib1.agecat ib1.povcat2 i.insstat1 . estimates store anyh1 . quietly svy linearized, subpop(SPD):tnbreg anyhcru i.yearind i.sex i.raceeth2 i. region i.married i.education ib1.natstat c.pcs ib1.agecat ib1.povcat2 i.insstat1 if anyhcru>0, ll(0) . estimates store anyh2 . quietly suest anyh1 anyh2 . /*hurdle nb model marginal effects*/ . local logit "invlogit(predict(eq(anyh1_useanyhcru))) " . local ey "exp(predict(eq(anyh2_anyhcru))) " . local pygt0 "(nbinomialtail(exp(-predict(eq(/anyh2:lnalpha))),1,""1/(1+exp(predict(eq(anyh2_anyHCRU)))/exp(-predict(eq(/anyh2:lnalpha))))))" . margins, dydx(*) expression("`logit'*`ey'/`pygt0'") Warning: cannot perform check for estimable functions. equation anyh2_anyHCRU not found r(303);
0 Response to "Equation not found" - Hurdle model using suest
Post a Comment