STAT7030 ANU Generalised Linear Models

User Generated

mpura168792

Mathematics

STAT7030

Australian National University

Description

Unformatted Attachment Preview

Question 1. [48 Marks]. The file Doctor Data, available on the course Wattle page in the Datasets section, is concerned with the number of deaths by heart disease in a sample of doctors from different age groups and with different smoking status (smoker/non-smoker). Further details are given below. Column 1 Observation number - [Variable V1=1 to 10] Column 2 Age - [Variable V2= 1,2,3,4,5] {1 = 35-44 years; 2 = 45-54 years; 3 = 55-64 years; 4 = 65-74 years; 5 = 75-84 years}. Column 3 Deaths - [Varaible V3 = Number of Deaths] {Count Variable}. Column 4 Person-Years at Risk - [Variable V4 = Aggregate years] {Count Variable}. Column 5 Smoker - [Variable V5 = 1,2] { Factor: 1 = Smoker; 2 = Non-Smoker}. Further comment: do not forget to declare variable V 5 as a factor. Please provide answers to the following. (a) Fit a suitable set of Poission regression models to the data and select what you think is the best model, using AIC to inform your selection. Please bear the following points in mind: • Treat log(V 4) as a covariate (as opposed to an offset) throughout part (a). • Although variable V 2 could be treated as a factor, it is suggested that you treat it as a numerical variable. If treated as a factor, Age will use up too many parameters relative to the sample size. Also, consider the covariate V 2 ∗ V 2. • Investigate interactions as well as main effects. • Present the AIC values in a suitable table. • Use suitable residual plots and other diagnostics to investigate the goodness of fit of the model you select. • In part (a) and in part (b) below, take the scale parameter φ to be 1. [12 marks] (b) Focusing on the model you selected in part (a), perform a change of deviance test to assess whether it would be better to treat log(V 4) as an offset or as a covariate. [6 marks] (c) Repeat parts (a) and (b) using negative binomial regression models with a log link. Comment on (i) similarities and (ii) differences in your results for part (c), compared with parts (a) and (b). [18 marks] 2 (d) Returning to the best Poisson regression model that you identified in part (a), estimate the scale parameter φ and provide a Wald test of the null hypothesis that φ = 1, presenting your answer in the form of a p-value. As part of your answer to part (d) you should present the R code that you used. [12 marks] 3 1 1 32 52407 1 2 2 104 43248 1 3 3 206 28612 1 4 4 186 12663 1 5 5 102 5317 1 6 1 2 18790 2 7 2 12 10673 2 8 3 28 5710 2 9 4 28 2585 2 10 5 31 1462 2
Purchase answer to see full attachment
Explanation & Answer:
1000 words
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

View attached explanation and answer. Let me know if you have any questions.

Answer
library(MASS)
data = read.csv("C:/Users/j boy/Dropbox/PC/Desktop/Glr_data.csv")
data
##
Observation Age Deaths Person_years_at_risk Smoker
## 1
1
1
32
52407
1
## 2
2
2
104
43248
1
## 3
3
3
206
28612
1
## 4
4
4
186
12663
1
## 5
5
5
102
5317
1
## 6
6
1
2
18790
2
## 7
7
2
12
10673
2
## 8
8
3
28
5710
2
## 9
9
4
28
2585
2
## 10
10
5
31
1462
2
Smoker_f = factor(data$Smoker, levels =c(1, 2))
is.factor(Smoker_f)
## [1] TRUE
levels(Smoker_f)
## [1] "1" "2"
#question a #
reg_output = glm(formula = Deaths ~ Age + I(Age^2) + Smoker + Age * Smoker +
log(Person_years_at_risk), family = poisson, data = data)
summary(reg_output)
##
## Call:
## glm(formula = Deaths ~ Age + I(Age^2) + Smoker + Age * Smoker +
##
log(Person_years_at_risk), family = poisson, data = data)
##
## Deviance Residuals:
##
1
2
3
4
5
6
7
8
## 0.32165 -0.30774
0.03825
0.09349 -0.04309 -0.68101
0.20454
6966
##
9
10
## -0.61900
0.16801
##
## Coefficients:
##
Estimate Std. Error z value Pr(>|z|)
## (Intercept)
-5.18769
6.38225 -0.813 0.416314
## Age
1.76679
0.20407
8.658 < 2e-16 ***
## I(Age^2)
-0.22104
0.06116 -3.614 0.000302 ***
## Smoker
-1.77851
0.87658 -2.029 0.042466 *
## log(Person_years_at_risk) 0.78366
0.50565
1.550 0.121193

0.5

## Age:Smoker
0.31294
0.09935
3.150 0.001633 **
## --## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
##
Null d...


Anonymous
Just what I was looking for! Super helpful.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags