# math作业 | 作业assignment – McGill University assignment 4

### McGill University assignment 4

math作业 | 作业assignment – 本题是一个利用math的代做, 这个项目是assignment代写的代写题目

Johanna G. Nelehov Generalized Linear Models math 523

``````McGill University, Winter Term 2022
assignment 4
``````
``````Q1 The data
``````
``````Y<- cbind(c(28,4,41,12),c(45,12,44,7),c(29,5,20,3),c(26,2,20,1))
colnames(Y)<-c("ProgressiveDisease","NoChange",
"PartialRemission","CompleteRemission")
therapy <- c("S","S","A","A")
gender <- rep(c("M","F"),2)
``````
``````refer to a clinical trial for the treatment of small-cell lung cancer. Patients were
randomly assigned to two treatment groups. The sequential therapy administered the
same combination of chemotherapeutic agents in each treatment cycle; the alternating
therapy had three different combinations, alternating from cycle to cycle. The response
Ycontains counts at each setting of the predictorstherapy("S" for sequential and
"A" for alternating) and gender ("M" for male and "F" for female). The response
categories are "Progressive Disease", "No Change", "Partial Remission", "Complete
Remission". OpenAssignment4.Rand read inY,therapyandgenderinto your own
Rscript and proceed from there.
``````
``````(1) Fit the baseline category logit modelYtherapyto these data. Calculate the
fitted probabilities for the four response categories and the two types of therapy.
Calculate the odds ratio of a "Progressive Disease" vs. "No Change" for the two
types of therapy along with a 95% confidence interval. Use these calculations to
interpret the therapy effect.
(2) Fit the cumulative logit modelYtherapyto these data. Calculate the cumu-
lative odds ratio for the effect of therapy, along with a 95% confidence interval.
Use it to interpret the therapy effect.
(3) Shouldgender be included in the model when (i) the baseline category logit
model and (ii) the cumulative logit model is used?
``````
``````Q2 The following data set describes the number of insolvent firms in Berlin between 1994
and 1996 (36 months):
``````
``````library(catdata)
data(insolvency)
attach(insolvency)
``````
``````(1) Consider time as an integer between 1 and 35 (variablecasein the dataset) and
fit a Poisson GLM with the intercept,case, and (case)^2 as predictors. Display
the residual plot and comment on whether you suspect overdispersion is present.
(2) How would the parameter estimates and the standard errors change if you were
to fit a quasi-Poisson model with the same predictors instead?
``````

Johanna G. Nelehov Generalized Linear Models MATH 523

``````McGill University, Winter Term 2022
Assignment 4 due on April 8 at noon.
``````
``````(3) Using a suitable statistical test, assess whether there is evidence for overdisper-
sion.
(4) Do you think that the number of insolvent firms changes over time? Use a suitable
statistical test to answer this.
``````
``````Q3 (bonus question for extra marks)
Load the data "BritishDoctors.txt", available on MyCourses under Assignments:
``````
``````read.table("BritishDoctors.txt",header=TRUE)
``````
``````The data records the number of coronary deaths for smokers and nonsmokers of various
ages. For each age group and smoking status, the number of person-years (person) is
also recorded (years of observation time for all persons in the study).
``````
``````(1) Fit a main-effects Poisson GLM using age and smoking as factors, accounting for
person-years in an appropriate way. In discussing the lack of fit, show that this
model assumes a constant ratio of nonsmokers to smokers coronary death rates
over age, and evaluate how the sample ratio depends on age.
(2) Explain why it is sensible to add aquantitativeinteraction of age and smoking.
For this model, show that the log ratio of coronary death rates changes linearly
with age. Assign suitable scores to age, fit the model and interpret.
``````
``````Due on April 8 at noon.
``````