version 13.1 use https://www3.nd.edu/~rwilliam/statafiles/couart4.dta, clear sum art female married kid5 mentor phd poisson art, nolog estat gof mgen, pr(0/9) meanpred stub(psn) label var psnobeq "Observed Proportion" label var psnpreq "Poisson Prediction" label var psnval "# of articles" list psnval psnobeq psnpreq in 1/10 graph twoway connected psnobeq psnpreq psnval, /// ytitle("Probability") ylabel(0(.1).4) xlabel(0/9) msym(O Th) poisson art i.female i.married kid5 phd mentor, nolog estat gof mgen, pr(0/9) meanpred stub(psn) replace label var psnobeq "Observed Proportion" label var psnpreq "Poisson Prediction" label var psnval "# of articles" list psnval psnobeq psnpreq in 1/10 graph twoway connected psnobeq psnpreq psnval, /// ytitle("Probability") ylabel(0(.1).4) xlabel(0/9) msym(O Th) glm art i.female i.married kid5 phd mentor, family(poisson) link(log) poisson art i.female i.married kid5 phd mentor, nolog irr margins female married margins, dydx(*) mcp mentor female mchange listcoef, help listcoef, help percent version 13.1 set seed 123456 gen profage = (10 + invnorm(uniform())) * 3 if female == 0 set seed 1234567 replace profage = (5 + invnorm(uniform())) * 3 if female == 1 bysort female: sum profage poisson art i.female i.married kid5 phd ment, nolog exposure(profage) irr use https://www3.nd.edu/~rwilliam/statafiles/couart4.dta, clear nbreg art i.female i.married kid5 phd ment, nolog test [lnalpha]_cons = 1 quietly poisson art i.female i.married kid5 phd ment, nolog est store poisson quietly nbreg art i.female i.married kid5 phd ment, nolog est store nbreg lrtest poisson nbreg, stats force est table poisson nbreg, t varlabel varwidth(32) stats(alpha N) b(%9.3f) quietly nbreg art i.female i.married kid5 phd ment margins female married margins, dydx(*) listcoef listcoef, percent * Hurdle Models - Adapted from Long & Freese 3rd edition, section 9.5 use https://www3.nd.edu/~rwilliam/statafiles/couart4, clear * Run logit model. Nonzero values are treated as 1s by logit command. quietly logit art female married kid5 phd mentor, or nolog est store Hlogit * Run Zero-truncated nbreg. Keep cases where articles are > 0 quietly ztnb art female married kid5 phd mento if art>0, nolog irr est store Hztnb * You need suest to get the standard errors right. suest Hlogit Hztnb, vce(robust) eform(expB) * See Long & Freese section 9.5 for computing predictions, using margins * countfit use http://www.indiana.edu/~jslsoc/stata/spex_data/couart4, clear countfit art i.female i.married kid5 phd mentor, inflate(mentor i.female) replace