Mixed Effects Models

The very basics of how to run linear models with random effects

This page assumes that you already understand the basics of how to run a linear model and how to interpret linear model output.

Linear mixed models can be built in R using the lme4 package. Other packages to work with mixed-effects models are GLMMadaptive, glmmML, glmmTMB, and MCMCglmm.

Linear mixed models have the following structure: Outcome variable ~ fixed effects + random effects

  • Outcome variable = the variable that is hypothesized to be modified by the predictors. For example in a looking while listening study looking time would be a likely outcome variable.

  • Fixed effects are the predictors that are hypothesized not to have individual random variance. For example, in a looking while listening task where children heard some mixed language phrases, language mixing is a fixed predictor of looking time because mixing was always the same in each experiment for each participant.

  • Random effects are the predictors that are hypothesized to have individual random variance. For example, in a looking while listening task we expect each child to perform differently based on their individual traits, so participant is a random predictor of looking time.

To learn more about linear mixed models:

Last updated