Tuesday, April 8, 2008

Chater 9

Julie and I got through the last question, although we abbreviated filling in the rest of the table using lincom, we just did a couple of examples. Here is our code:

set memory 11000
use C:\WDDtext\8.ex.InjuryDeath.dta
xi: glm inj_dth i.age_mom i.lbw i.educ_mom i.income i.illegit i.oth_chld i.race_mom i.pnclate i.age, family(poisson) link(log) lnoffset(childyrs) eform
* A couple examples of using lincom, completing the rest of the table
lincom pnclate _Iage_mom_29- _Iage_mom_30, irr
lincom _Iage_mom_29- _Iage_mom_30, irr
sort age age_mom lbw educ_mom income illegit oth_chld race_mom pnclate
collapse (sum) childyrs= childyrs inj_dth = inj_dth, by(age age_mom lbw educ_mom illegit income oth_chld race_mom pnclate)
xi: glm inj_dth i.age_mom i.lbw i.educ_mom i.income i.illegit i.oth_chld i.race_mom i.pnclate i.age, family(poisson) link(log) lnoffset(childyrs)
predict e_inj_dth, mu
predict dev, standardized deviance
generate e_rate = 1000* e_inj_dth/ childyrs
label variable e_rate "Incidence of Injury Death per Thousand"
lowess dev e_rate, bwidth(0.2) msymbol(Oh)

No comments: