70 likes | 193 Views
Exercise 4 week 4. Logistic regression on borrelia data including age. Start model4<- glm(IgG~gender+age,family=binomial,data=data1) model6<- glm(IgG~age,family=binomial,data=data1) anova(model4,model6, test="Chisq") # P-value 0.306 Possible But will work with
E N D
Logistic regression on borrelia data including age Start model4<- glm(IgG~gender+age,family=binomial,data=data1) model6<- glm(IgG~age,family=binomial,data=data1) anova(model4,model6, test="Chisq") # P-value 0.306 Possible But will work with model4<- glm(IgG~gender+age,family=binomial,data=data1)
Question 2 library(multcomp) data.comp1<-glht(model4,linfct=mcp(gender="Tukey")) exp(confint(data.comp1,calpha=1.96)$confint) Estimate lwr upr M - F 1.225709 0.8310079 1.807881 Odds ratio
Question 3 and 4 predict(model4,new=data.frame(gender=c("F","M"), age=c(40,60), type="response")) Female age 40: 0.026 Male age 40: 0.032 Male age 60: 0.047 Female age 60: 0.039
model4<- glm(IgG~gender+age,family=binomial,data=data1) • summary(model4) • # SUMMARY IS LOG ODDS. • # Estimate Std. Error z value Pr(>|z|) • #(Intercept) -4.436081 0.336540 -13.181 < 2e-16 *** • #genderM 0.203520 0.198284 1.026 0.304700 • #age 0.020554 0.005618 3.659 0.000254 ***
Question 5 Man have a higher probability of getting a positive IgG than women. The probability is though not significant between gender. The probability of getting a positive IgG result is increasing significantly with age
Question 6 No. There are too many different ages. Which will result in too many age factors with no or few repeats model23<- glm(IgG~gender*factor(age),family=binomial,data=data)