Linear Mixed Models

First, What does mixed-effects mean

Mixed-effects models

Fixed effects vs. random effects

Fixed effects

Random effects

Linear mixed model (LMM)

What is LMM

LMM vs. GLMM

  • LMM is mainly for continuous outcomes that are approximately normally distributed.
  • For binary, count, ordinal, or categorical outcomes, use a generalized linear mixed model (GLMM) instead.

Formula

Y=Xβ+Zb+ϵ
Compared to ANOVA & Post-hoc Tests, a basic ANOVA model does not include the random-effect term:
Y=Xβ+ϵ

Intuition of the formula

Why LMM matters

Compared to ANOVA

Compared to ANOVA & Post-hoc Tests, LMM is more flexible:

When to use LMM

Use LMM when:

Assumptions for using LMM

Sampling and independence

Distribution assumptions

Covariance structure

How to build an LMM

  1. Decide fixed effects
  2. Decide random effects
    • Random intercepts/slopes only? intercepts + random slopes?
    • Which grouping variable should have random effects?
  3. Decide Covariance Structure
    • Which structure best describes within-subject or within-group correlation?
  4. Decide common model structures
    • random intercept only
    • random intercepts + fixed slopes
    • fixed intercepts + random slopes
    • random intercepts + random slopes
  5. Compare candidate models