6.6 Generalized and Mixed?

So far in this chapter we have dealt with with two extensions to the General Linear Model: the Generalized Linear Model for non-continuous outcome variables, and the Linear Mixed Model when there is clustering in the data. You might be asking the question: what if I have both a non-continuous outcome variable, and clustering.

That’s no problem: you need to use both extensions at the same time, making a Generalized Linear Mixed Model. You fit a Generalized Linear Mixed Model with lmerTest exactly as we have done so far this session. Instead of lmer(), the function you need is glmer(), and the additional thing that you need to put in the function call is the specification of a family of models (e.g. binomial, Poisson), exactly as we did with function glm() earlier in the chapter. So the call will look something like: s1 <-glmer(y ~ x + (1|participant), family=binomial, data=data).