Katarzyna Kulma
2013-May-10 10:28 UTC
[R] Fwd: binomial glm and sole effect of the treatment
Hiya, I'm using simple glm binomial models to test the effect of treatment (factor, 3 levels) on infection prevalence (infected/uninfected): ad3<-glm(Infection~ecs, family=binomial, data=eilb) but summary() function returns for each of the factor-level coefficients against the control treatment:> summary(ad3)Call: glm(formula = Infection ~ ecs, family = binomial, data = eilb) Deviance Residuals: Min 1Q Median 3Q Max -1.4006 -1.0383 -0.9005 1.3232 1.4823 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -0.3365 0.5855 -0.575 0.566 ecsminus2 -0.3567 0.8473 -0.421 0.674 ecsplus2 0.8473 0.9361 0.905 0.365 (Dispersion parameter for binomial family taken to be 1) Null deviance: 43.860 on 31 degrees of freedom Residual deviance: 42.162 on 29 degrees of freedom AIC: 48.162 Number of Fisher Scoring iterations: 4> str(eilb)'data.frame': 32 obs. of 59 variables: (...) $ ecs : Factor w/ 3 levels "control","minus2",..: 2 3 3 3 2 2 1 1 1 1 ... $ Infection : Factor w/ 2 levels "Infected","Uninfected": 1 1 1 1 1 1 1 1 1 1 ... What I want to know is whether the treatment in general had an effect on infection prevalence, not the difference between respective factor levels. If it was a general linear model I could switch between using lm() and aov() functions, but how can I proceed here? I sense I'm missing something obvious, so I'll appreciate your help! cheers, kasia [[alternative HTML version deleted]]
Katarzyna Kulma <katarzyna.kulma <at> gmail.com> writes:> > Hiya, > > I'm using simple glm binomial models to test the effect of treatment > (factor, 3 levels) on infection prevalence (infected/uninfected): > > ad3<-glm(Infection~ecs, family=binomial, data=eilb) > > but summary() function returns for each of the factor-level coefficients > against the control treatment: > > > summary(ad3) > > > What I want to know is whether the treatment in general had an effect on > infection prevalence, not the difference between respective factor levels. > If it was a general linear model I could switch between using lm() and > aov() functions, but how can I proceed here? I sense I'm missing something > obvious, so I'll appreciate your help! >either ad3B <- update(ad3,.~1) anova(ad3,ad3B) or drop1(ad3,test="Chisq") should do what you want (a likelihood ratio test between the model containing the treatment and the model without the treatment). Bonus, the likelihood ratio tests will be more accurate than the Wald tests provided by summary().