Context and current approach:
I read through quite a few posts on this website and on the internet but I'm still not 100% sure on what exactly the assumptions are and how to check them in practice.
Below a (hopefully exhaustive) list of the assumptions I have in mind:
- The model is correctly specified (i.e. linear relationships between outcome and continuous predictors, no perfect colinearities)
- Samples are independent (obviously after e.g. repeated measures have been taking into account)
- Residuals on all levels have constant variance (that is, the "errors" and the random effects)
- Residuals on all levels are normally distributed (again that needs to be true for "errors" and the random effects)
Having all of this in mind, I'm now looking to use R to check these assumptions.
We can use some built in data from the
library("lme4") data("sleepstudy") head(sleepstudy) # Some simple MM sleepstudy_model=lmer(Reaction ~ Days + (1 | Subject), sleepstudy)
- We can look at the "errors" here if we want to see if there's a pattern, check colinearity between predictors, etc.
- We just consider the design of the study at hand for this. I assume we can look for patterns in the "error" terms again.
- Here it gets trickier for me.. For the "errors" it's simple, but what about the random intercept?
# Checking for the errors, just look for a pattern in here plot(sleepstudy_model) #But what about the random intercept? Something like this? plot(data.frame(ranef(sleepstudy_model))$condval, data.frame(ranef(sleepstudy_model))$condsd)
- Same thing here, it's easy for the "errors", but I'm not sure about the random intercept.
# Checking for the errors qqnorm(residuals(sleepstudy_model)) #Checking for the random intercept? qqnorm(data.frame(ranef(sleepstudy_model))$condval)
Did I list all necessary assumptions correctly? If yes, did I correctly check for all of them? Are the any additional nice ways to check for some?
Robert Long's answer to the question "assumptions for lmer models" below:
Frank Harrel's answer to the question "Are there any parametric assumptions for Linear Mixed Models - lmer (multivariate model)" below:
Some answers from to the question "Checking assumptions lmer/lme mixed models in R" below: