Simone Santoro
2011-Sep-22 09:49 UTC
[R] comparing mixed binomial model against the same model without random effect
Hi everybody, If I am correct, you can compare a model with random effect with the same model without the random effect by using the nlme function, like this: no.random.model <- gls(Richness ~ NAP * fExp, method = "REML", data = RIKZ) random.model <- lme(Richness ~NAP * fExp, data = RIKZ, random = ~1 | fBeach, method = "REML") anova(no.random.model,random.model) But, nlme is valid only for the gaussian family, isn't it? In my case I have a mixed model with binomial family, like this: random.model <- lme(sex ~hwp+hcp, data = mydata, random = ~1 | colony, method = "REML") where "sex" is a binary variable, "hwp" and "hcp" are continuous variable and "colony" is a factor with two levels. I want to compare this model with another one without the random effect, I have tried with the lme4 but after this I cannot figure out how to build this same model without the random effect in order to make it comparable to the random effect model. Thanks for any help. Simone [[alternative HTML version deleted]]
lincoln
2011-Sep-24 15:11 UTC
[R] comparing mixed binomial model against the same model without random effect
Any answer to this? I really need to compare a mixed model with binomial error against the same model without the random effect. I would use anova() but I don't know how to specify both models in order to make them comparable. Thanks for any answer Simone -- View this message in context: http://r.789695.n4.nabble.com/comparing-mixed-binomial-model-against-the-same-model-without-random-effect-tp3832891p3839528.html Sent from the R help mailing list archive at Nabble.com.
Billy
2011-Sep-24 20:12 UTC
[R] comparing mixed binomial model against the same model without random effect
Hello Simone, Given that your response variable is binary and, consequently, you should use generalized models, just occurs to me a comparison between a Generalized Linear Model (the model without the random effect) and a Generalized Linear Mixed Model (the model with the random effect). You could write them as follows: no.random.model <- glm(sex ~ hwp + hcp, data = mydata, family=binomial) random.model <- glmer(sex ~ hwp + hcp + (1 | colony), data = mydata, family=binomial) My only doubt here is if one can directly compare both models, built under different algorithms and from different packages. Furthermore, I have no idea if the function 'anova' is able to compare models produced by the 'glmer' function. One possibility is to compare them based on Akaike Information Criteria (AIC) or any one of its corrected versions. I hope it helps you. best wishes -- Gustavo Requena PhD student - Laboratory of Arthropod Behavior and Evolution Universidade de São Paulo Correspondence adress: a/c Glauco Machado Departamento de Ecologia - IBUSP Rua do Matão - Travessa 14 no 321 Cidade Universitária, São Paulo - SP, Brasil CEP 05508-900 Phone number: 55 11 3091-7488 http://ecologia.ib.usp.br/opilio/gustavo.html [[alternative HTML version deleted]]