Upload
paulina-wood
View
216
Download
0
Embed Size (px)
Citation preview
Applied Statistics
Week 4 Exercise 3
Tick bites and suspicion of Borrelia
Mihaela Frincu
20.12.2011
Presentation of data set
gender
IgG F M
neg 1660 1252
pos 57 50
IgG – presence of Borrelia infection neg/pos
Gender – M=male, F=female
Age [years]
1. Perform a logistic regression with IgG as response and gender as explanatory variable
fitlog<-glm(IgG~gender, family=binomial,data=borrelia)summary(fitlog)
Deviance Residuals: Min 1Q Median 3Q Max -0.2798 -0.2798 -0.2599 -0.2599 2.6097 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -3.3715 0.1347 -25.028 <2e-16 ***genderM 0.1510 0.1973 0.765 0.444 ---Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 (Dispersion parameter for binomial family taken to be 1)Null deviance: 924.89 on 3018 degrees of freedomResidual deviance: 924.31 on 3017 degrees of freedomAIC: 928.31Number of Fisher Scoring iterations: 6
2. Assess the effect of gender by a likelihood ratio test
First model: infection depends on genderfitlog<-glm(IgG~gender, family=binomial,data=borrelia)
Second model: infection is independent of gender:fitno<-glm(IgG~1, family=binomial,data=borrelia)
Comparison of the two models:anova(fitlog,fitno,test="Chisq")Analysis of Deviance TableModel 1: IgG ~ genderModel 2: IgG ~ 1 Resid. Df Resid. Dev Df Deviance Pr(>Chi)1 3017 924.31 2 3018 924.89 -1 -0.58355 0.4449
P=0.4449 there is no significant difference between the two models -> infection does not depend on gender
3. Calculate the relative change in odds of a positive IgG test (odds ratio) due to gender
> summary(fitlog)
Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -3.3715 0.1347 -25.028 <2e-16 ***genderM 0.1510 0.1973 0.765 0.444 ---Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Relative change in odds ratio due to gender is:
exp(0.1510)= 1.162997
4. Provide the odds ratio with a 95% CI
library(multcomp)
gencomp<-glht(fitlog,IgG=mcp(gender))
exp(confint(gencomp,calpha=1.96)$confint)
Estimate lwr upr
(Intercept) 0.034337350.02636945 0.04471287
genderM 1.163051400.78997917 1.71230915
5. What value of the odds ratio corresponds to no association between gender and IgG
If infection does not depend on gender we expect the odds ratio to be 1 (equal odds).
6. Do we get the same conclusion from the 2 test, the likelihood ratio test, and the 95% CI for the odds ratio
We got the same answer.
2 test: P=0.444 there is no significant difference between the two models -> infection does not depend on gender
Likelihood ratio test: for the effect of gender p=0.4449 -> no significant gender effect
95% CI: genderM 1.16305140 0.78997917 1.71230915 ->
1 is in the confidence interval
Reporting the results
The influence of gender on the incidence of Borrelia infections was investigated by a logistic regression with IgG as response and gender as explanatory variable. The influence of the gender on the incidence of infections was not found to be significant (p=0.444).
The dataset was also ivestigated using a likelihood ratio test. The result was similar (p=0.4449), which indicates that gender does not have a significant influence on the incidence of borrelia infection.
The odds ratio of infection male:female for the data set was found to be (95% CI) = 1.16 (0.79-1.71)
The analysis was performed in R version 2.14.0 (www.R-project.org)