Thursday, April 23, 2009

Poisson Regression


melanoma<-read.csv("U:/data/R/datasets/melanoma.csv")

out<-glm(cases~age+region, family=poisson(link="log"),
offset=log(total), data=melanoma)
out1<-glm(cases~age, family=poisson(link="log"),
offset=log(total), data=melanoma)
out2<-glm(cases~region, family=poisson(link="log"),
offset=log(total), data=melanoma)

# type 3
anova(out1,out)
anova(out2,out)

# melanoma
Obs age region cases total

1 35-44 south 75 220407
2 45-54 south 68 198119
3 55-64 south 63 134084
4 65-74 south 45 70708
5 75+ south 27 34233
6 <35 south 64 1074246
7 35-44 north 76 564535
8 45-54 north 98 592983
9 55-64 north 104 450740
10 65-74 north 63 270908
11 75+ north 80 161850
12 <35 north 61 2880262

No comments: