Mixed Models

Mixed models (aka multilevel or hierarchical models) are statistical models containing both fixed- and random-effects terms. They are useful when multiple measurements exist for each unit of observation (e.g., participant or item), or for hierarchical data. Linear mixed models (LMMs) are used for normally distributed dependent variables, generalized linear mixed models (GLMMs) are applicable to other distributions (e.g., binomial data).

lmm_exampleMixed models extend ordinary linear, ANOVA, or generalized linear models and have only relatively recently been introduced to psychology . They allow for the modeling of dependency structures in the data that are difficult to handle with ordinary linear or generalized linear models such as repeated measurements by the same individual  (e.g., allowing repeated-measures logistic regressions) or hierarchical data structures such as participants blocked in classes or sessions. Furthermore, they enable the modeling  of multiple independent random effects simultaneously, such as participant and item effects, unifying so-called F1 and F2 analysis. Together with David Kellen, I have written an introductory chapter to mixed models. Further information on how to specify mixed models for experimental designs are given by Barr and colleagues and arguments for considering both participants and items simultaneously are given by Judd et al.  .

The reference package for estimating mixed models in the statistical programming language R is lme4. A technical introduction to the models estimated by lme4 can be found here. I have developed the afex package which complements the functionality of lme4, for example by obtaining *p*-values for effects in mixed models.