Key to assignment 11 1.(a) glue <- factor(glue) coplot(strength<-thick|glue) (b) options(contrast="contr.treatment") reg101.sep<-lm(strength~glue/thick-1) reg101.samesl<-lm(strength~glue+thick) anova(reg101.samesl, reg101.sep) Conclusion: separate slopes NOT necessary. (c) summary(reg101.samesl) Different levels of glue do not have significant effect. Also, you can do following: reg101.same<-lm(strength~thick) anova(reg101.same, reg101.samesl) Therefore, separate intercepts are NOT necessary. This means strength ~ a + b*thick Both intercept and slope are significant. 2.(a) glm2<-glm(disease ~ socio*age, family=binomial) summary(glm2) p-values are large. Try glm3<-glm(disease ~ socio + age, family=binomial) summary(glm3) Fitted model: log(p/(1-p)) = 2.63 - 1.56 sociomiddle - 2.84 socioupper - 0.10 age where p is probab of disease; sociomiddle is 1 if middle class, 0 otherwise; and socioupper is 1 if upperclass, 0 otherwise. p-value for coefficient of sociomiddle is 0.06. Should we drop it? (b) Try to expand the model. For example, quadratic term in age. Then use `anova' of the fit. Residual deviance does not change much for the quadratice term. Try model reduction. Drop one variable and use `anova' to compare smaller model with the bigger one. Final model is as in 2(a). As age increases, odds of getting disease decreases. For `socio', reference class is `lower'. odds for upper class is (significantly) less than lower class.