Week 13 - Mixed/Multilevel Models
When the Same Person Shows Up More Than Once
Every model so far has assumed each row is a different, independent person. This week the rows come in clusters: three waves from the same kid, ten days from the same sleepy participant. Weβll reshape wide data to long, see why lm() gets the standard errors wrong when rows arenβt independent, and fit our first mixed model with lmer(): random intercepts, the ICC, random slopes, and the difference between a between-person and a within-person effect.
The lecture and activity are short so that most of class is M3 work time.
πΎ Class Check 5 at the start of class (20 min, on myCourses). Covers Weeks 11β12: missing data, model building, logistic regression.
π M3 is due Monday 11/30. Bring your project to class.
Prepare
π§° Install two new packages before class:
install.packages(c("lme4", "lmerTest"))
Slides
Data
ASAP Study (.csv): used in the lecture
The activity uses sleepstudy, which comes with lme4. Nothing to download.
In-Class Activity
π How Much Does a Short Night Cost? π΄
Then: M3 work time.
For Next Time
π¦ No class Thursday 11/26 (Thanksgiving)
π Final Project M3, due Monday 11/30
πChapter 18 - ST
π M4 Reproducibility swap, in class Thursday 12/3
Back to course schedule β