18  Mixed Effects Models

Overview

In this chapter, we’ll make a quick non-technical overview of fitting mixed effects models, focusing on the use of the function lme().

Objectives

Upon completion of this lesson, you should be able to:


  1. Recognize when a mixed effects model might be appropriate
  2. Be able to fit simple repeated measures models with lme()
  3. Be able to fit simple split-plot models with lme()

Data and R Code Files

The R code file and data files for this lesson can be found on the Essential R - Notes on learning R page.

R logo

18.1 What is a Mixed Effects Model?

Here we’ll introduce the idea behind the mixed-effects model.

Video - STAT 485 Lesson: 18.1

18.2 Repeated Measures Done the Wrong Way

Now we’ll begin a demonstration of the wrong way to analyze data that includes repeated measures, using the “machines” data included in the package nlme.

Video - STAT 485 Lesson: 18.2

18.3 Repeated Measures Using Mixed Effects I

Here we’ll demonstrate the use of lme() to fit a mixed effects model - in this case a separate intercept for each worker.

Video - STAT 485 Lesson: 18.3

18.4 Repeated Measures Using Mixed Effects II

Now we’ll try a different model, with the machine * worker interaction as a random effect. The substantial reducion in AIC and the more reduced patterning in the residuals suggests that this ia a superior model.

Video - STAT 485 Lesson: 18.4

18.5 Split-plot Using Mixed Effects

Here we’ll revisit the split-plot experiment we analyzed using aov() in Lesson 13, this time with lme().

Video - STAT 485 Lesson: 18.5

18.6 Using anova() to Compare Models

Here we’ll demonstrate the use of anova() to compare two models fit by lme() - note that the models must be nested and both must be fit by ML rather than REML.

Video - STAT 485 Lesson: 18.6