# Data Analysis

### Generalised linear mixed models (GLMMs)

I’ll be upfront and admit that this is still greek to me. On their own, generalised linear models (GLMs) and linear mixed models (LMM) are confusing enough… you put them together and BAM you get a recipe for disaster. We really do need a neat, comprehensive tutorial for GLMM use in psychology.

Although GLMMs are not frequently used in psychology (maybe because we rarely use non-continuous response variables), they are useful when you need to analyse multilevel/hierarchically nested data. In R, GLMMs can be fit with the following packages:

`lme4`

using the`glmer`

function. This package can also be used to fit LMMs.`glmmTMB`

using the`glmmTMB`

function.- I believe you can also use
`GLMMadaptive`

but I am not really familiar with this package.

Model diagnostics can be assessed with the `DHARMa`

package. It contains useful tools to check your model for overdispersion!

Here are some resources I’ve found helpful (though they are extremely technical and mostly about GLMM fitting in ecology):

- GLMM FAQ by Ben Bolker is THE resource you should consult if you do intend to fit GLMMs.
- Multilevel Analysis: Techniques and Applications by Hox, Moerbeek, & van de Schoot (2017) has a couple of chapters on fitting GLMMs. A great book!