interactions in fixed effects
Tests of the significance of random effects are notoriously problematic, but for your question on glm(), try: anova(GLM0, GLM1, test="LRT") see the docs for anova for more details. Cheers, Josh On Tue, Feb 5, 2013 at 8:58 AM, Gabriela Agostini
<gabrielaagostini18 at gmail.com> wrote:
Hello
I am working whit GLMM (binomial family) in lme4. In order to test
differences between amphibian parasitic infections in two study sites, I am
using a model consisting of two fixed effects ("sa" and "sp" ) and a random
effects ("sdy"). After testing the significance of the random effect, I
chose to use GLM based on the same error structure and variables. My
problem is: when I try to explore the interaction between two fixed
effects, anova () does not show the values of Chi and the probability value.
I am sorry for my question, maybe this is a bit basic. But I could not get
these results.
Thanks!
names(data)
[1] "sa" "sdy" "sp" "inf" "noinf"
### sa(study area) ### ps(species) ### sdy(sample day) ### inf(individual infected) ### noinf(individual non infected)
class(data$sa)
[1] "factor"
levels(data$sa)
[1] "cult" "ref"
class(data$sp)
[1] "factor"
levels(data$sp)
[1] "hpa" "lla" "llj" "rfa"
library(lme4)
data$Ymat<-cbind(data$inf,data$noinf-data$inf) GLM0<-glm(Ymat~sa+sp+sa*sp,data=data,family=binomial) summary(GLM0)
Call:
glm(formula = Ymat ~ sa + sp + sa * sp, family = binomial, data = data)
Deviance Residuals:
Min 1Q Median 3Q Max
-2.2910 -0.8011 0.0000 0.6543 2.5593
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -2.18122 0.19937 -10.941 < 2e-16 ***
saref -1.43460 0.36483 -3.932 8.42e-05 ***
splla 1.82021 0.33694 5.402 6.58e-08 ***
spllj 2.09878 0.20676 10.151 < 2e-16 ***
sprfa 2.10572 0.24216 8.696 < 2e-16 ***
saref:splla -0.08470 0.57874 -0.146 0.884
saref:spllj -0.01143 0.37498 -0.030 0.976
saref:sprfa -0.47644 0.43437 -1.097 0.273
---
Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 1013.00 on 363 degrees of freedom
Residual deviance: 355.21 on 356 degrees of freedom
AIC: 935.48
Number of Fisher Scoring iterations: 5
GLM1<-glm(Ymat~sa+sp,data=data,family=binomial) anova(GLM0,GLM1)
Analysis of Deviance Table
Model 1: Ymat ~ sa + sp
Model 2: Ymat ~ sa + sp + sa * sp
Resid. Df Resid. Dev Df Deviance
1 359 358.80
2 356 355.21 3 3.5908
Thanks!!!
[[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/