PRACTICAL EXERCISE 11

In this exercise we will study further the data from practical exercise 10 on lung cancer death among males in four Danish cities. In practical exercise 10 it is described how you may read the data into R.

In questions a and b we will see how one may compute the occurrence/exposure rates and log-transformed confidence intervals using the glm-command. Thereafter we will study it there is a difference between the four cities.

a) Fit a model without intercept and with age as the only factor (we multiply the average number of male inhabitants by 4 to get personyears; cf. practical exercise 10):

fit.age=glm(cancer~offset(log(4*population))+factor(age)-1, family=poisson, data=lungcancer)

summary(fit.age)

Perform the commands and inspect the output.

b) The summary command for a glm-object gives the estimated coefficients with standard errors. However, for interpretation it is more relevant to consider the exponentials of the coefficients with corresponding confidence intervals. To obtain this we may use the following function:

expcoef=function(glmobj)

{

regtab=summary(glmobj)\$coef

expcoef=exp(regtab[,1])

lower=expcoef*exp(-1.96*regtab[,2])

upper=expcoef*exp(1.96*regtab[,2])

cbind(expcoef,lower,upper)

}

After you have read this function into R, you may use it by giving the command:

expcoef(fit.age)

Perform the command and compare with the occurrence/exposure rates and confidence intervals you found in practical exercise 10.

c) Now fit a model with age and city as factors and inspect the results.

d) Use the anova-command to test if there is a significant difference between the cities.