Linear mixed models (2024)

This video series provides a brief first lesson on linear mixed models, also known as multilevel models. It was created as part of a statistics class for first-year psychology PhD students in 2024. It consists of five videos listed on this page and in a Youtube playlist.

Linear mixed models are useful in cases where your individual observations are clustered or nested within larger units. For example, your experiment may expose each participant to randomly ordered trials (many trials per participant), or you may have tested classes of students together (many students per classroom). In brief, when you have a categorical variable indicating groups of observations that are non-independent, you may want to allow your model intercept and/or slopes to vary among levels of this grouping variable. Linear mixed models accomplish this by including random intercepts and/or random slopes.

These videos are designed to be viewed in order. For example, later videos continue discussing hypothetical data examples from earlier videos. These videos also assume that students have a conceptual understanding of interactions in linear regression models and proficiency with the lm function in R. They are designed to be viewed after the regression interactions video series.

I show some slides in videos 1 through 3. Those slides are available here: Slides for linear mixed models [pdf]. The slides will not make sense without the context given in the videos, and you do not need the slides to watch the videos. I walk through some example R code in videos 4 and 5. That code is available here: Code for linear mixed models [text].

List of Videos

The videos linked below are also available in a single Youtube playlist.

Part 1: General introduction: Background

Part 2: General introduction: Graphical illustration

Part 3: General introduction: Model code and output

Part 4: Analyzing a simple experiment: Example data

Part 5: Analyzing a simple experiment: Model code and output