# Mixed effects model validation and selection with lme4::glmer

If I had a glm using on count data I may do the following:

glm(response ~ exp1 * exp2, family = poisson, data =data)


The first thing I would do here is check for overdispersion with the residual deviance/df. If there was overdispersion I may choose to use family = quasipossion

glm(response ~ exp1 * exp2, family = quaispoisson, data =data)


I would then simplify my model to find the optimal model using analysis of deviance based on log likelihoods (likelihood ratio tests)e.g.

m1 <- glm(response ~ exp1 * exp2, family = quaipoissn, data =data)
m2 <- glm(response ~ exp1 + exp2, family = quaipoissn, data =data) #remove interaction
anova(m1, m2, test = "chi") #if it was still poisson
# or
anova(m1, m2, test = "F") #for quasipoisson
# using p-values to assess the significance of the removed interaction


Finally then I would then validate my model by plotting deviance residuals against fitted values, explanatory values e.g. plot(m2). If all is ok, there is independence and no patterns, I don't have to add in extra explanatory variables etc.

My question is, what are the key differences to this process using glmer e.g.

glmer(response ~ exp1 * exp2 + (1|random1/random2), family = poisson, data =data)

• Out of morbid curiosity what does the AIC tells you about your models? Also how "big" is your data? Dec 1 '13 at 16:32
• Hey @user11852 , why is the curiosity morbid :) ? The structure of my data is similar to this question. There are ~240 data points. You want to know my interpretation of model selection using AIC or the use of AIC in general? As I don't think I mentioned the use of AIC in comparing glms Dec 1 '13 at 16:48
• I mentioned it cause I believe it is slightly better than using raw LRT. I also asked about your size of dataset cause for a small sample asymptotic properties (as with all LRTs) suffer. In general your question seems a bit too open I think. In your second case you incorporate random effects, with glm you do not. Is it the equivalent form of the standard LMEM $y|\gamma \sim N(X\beta + Z\gamma,\sigma^2 I)$ you are looking for but for a Poisson model now? Dec 1 '13 at 22:11
• the title sounded so well, but the question "what are the key differences to this process using glmer" disappointed me. Very basic, trivial question, google what random effect means. It would be much more interesting to ask how one knows that the random effect improved the model and how to select between various model with or without various random effects. Dec 2 '13 at 23:00
• @Tomas Thanks for your interest, sorry the question did not live up to the title. There are however many conflicting ideas on this subject and I thought perhaps useful question. Although i am interested in you statements regarding testing the random effect, i.e. if the variance is zero and whether or not the definition of deviance on the glm and glmer are the same. Best. Dec 3 '13 at 22:19

## 1 Answer

A good deal of this is covered in Ben Bolker's excellent at mixed models in R FAQ/wiki

• +1. While it would not be my first suggestion to understand the GLM/GLMM comparison it will probably beneficial for the OP indeed. Dec 5 '13 at 4:47