options pagesize=47 linesize=64; /*********************************************************** Read in the grouped version of the nickel smelter data. afe and tfe are important predictors of other deaths, and so we will analyze data from only one of these groups. The variables are afe= age at first exposure tpers=number of persons yfe= year at first exposure lcdeth=lunc cancer deaths exp= exposure (categories 1-4) ncdeth=nasal cancer deaths tfe= time since first employed tdeths=total deaths py= person-years The other variables don't matter. These data come from Breslow and Day, Vol II, Appendix VII, and at http://faculty.washington.edu/norm/BDdata/nickel4.dat ***********************************************************/ data nickel; infile 'nickel4.dat'; input afe yfe exp tfe tpers lcdeth ncdeth tdeths py A B C; other=tdeths-ncdeth-lcdeth; lpy=log(py); if afe=3 then; else delete; if tfe=2 then; else delete; nolung=ncdeth+other; run; /*********************************************************** Do a proportional mortality analysis of the effect of exposure on nasal cancer deaths, and compare it to the result of two Poisson regressions. In practice, you would do the proportional mortality study in cases when the py variable is unavailable, and the Poisson regression is impossible. We do the Poisson regressions to show that the proportional mortality approach is appropriate, and to show that when it is appropriate the results are the same as the proportional mortality results. ***********************************************************/ title1 'Poisson Regression Model for Nasal Cancer Deaths'; proc genmod data=nickel; model ncdeth=exp /dist=poi offset=lpy itprint; run; title1 'Poisson Regression Model for Other Deaths'; proc genmod data=nickel; model other=exp /dist=poi offset=lpy; run; /*********************************************************** From the second regression, the effect of exposure is small; hence there's no evidence that exposure affects other deaths. If we assume that exposure does not affect other deaths, we can do the following logistic regression to estimate the same exposure effect as our first Poisson regression above estimates. Note here that the exposure estimates from the below regression and the ***********************************************************/ title1 'Logistic Reg. Model for Proportional Mortality'; proc genmod data=nickel; model ncdeth/nolung=exp /dist=bin; run; /********************************************************** Death penalty data from Moore (2000) Basic Practice of Statistics, p. 149 ***********************************************************/ title1 'Death penalty data'; data death; infile 'death.dat'; input bd bv live we; bdc="White Defendant";if bd=1 then bdc="Black Defendant"; bvc="White Victim"; if bv=1 then bvc="Black Victim"; lc="Death"; if live=1 then lc="Not Death"; run; data death; set death; nlive=live*we; run; proc genmod data=death; model nlive/we=bd/dist=bin; run; proc genmod data=death; model nlive/we=bd bv/dist=bin; run; proc genmod data=death; model nlive/we=bd bv bv*bd/dist=bin; run; /********************************************************** data in Table 46 of Andrews and Herzberg (1985) at http://lib.stat.cmu.edu/datasets/Andrews/T46.1 Variables are stage, dose, follow up months, and survival. ***********************************************************/ title1 'Prostate cancer data'; data prostate; infile 'prostate.dat'; input stage rx mofu surv; rx2=0; if rx>2 then rx2=1; rx3=0; if rx>3 then rx3=1; run; proc freq data=prostate; table stage*surv*rx/norow nocol nopercent expected chisq; run; proc genmod data=prostate; model surv=stage rx/dist=bin; run; proc genmod data=prostate; model surv=stage rx rx2 rx3/dist=bin; run;