LMM analysis workflow

You do not need to memorise these steps. This page is here so you can refer to it while working through LMM analyses for your DAPR reports, minidissertations, and dissertations.

You won’t need to use every step below for every analysis, and they don’t need to be in this specific order either. This is just the order Elizabeth usually uses 😊

Think of these steps like a buffet to pick and choose from, depending on what your analysis needs.

Phase 1: Before model fitting

1a: Set up your code and data

  • Load the required R packages. You’ll probably need at least:
    • tidyverse (for managing and wrangling data)
    • lme4 (for fitting LMMs)
    • lmerTest (for displaying p-values for the fixed effect coefficients)
    • stats (for xtabs(), useful for identifying possible random slopes)
    • HLMdiag (for computing influence diagnostics)
    • effects (for plotting model-fitted values)
    • car (for checking multicollinearity)
  • Read in your data.
  • Tidy data (e.g., any missingness, any implausible values?).

1b: Set up the fixed effects

1c: Set up the random effects

Phase 2: Model fitting and troubleshooting

Phase 3: After model fitting

3a: Check assumptions and diagnostics

  • Check model assumptions.
    • see Check assumptions flash card
    • If model assumptions about normality/equal variance of errors are violated, think about whether this could be remedied by transforming variables, or might be arising due to model misspecification. If none of those things are the issue, then bootstrap model estimates.
  • Run diagnostics for multicollinearity.
  • Run diagnostics for influential observations and levels of grouping variables.
  • If you find extreme influential observations/groups: run sensitivity analysis.

3b: Plot and interpret model estimates

3c: Write up methods and results