Mixed Effects Regression#
Mixed effects regression is a statistical method that allows us to summarize and study relationships between two or more continuous (quantitative) variables, while accounting for the presence of random effects. Random effects are used to model the variability in the response variable that is not explained by the fixed effects. The fixed effects are the variables that are of primary interest in the study, while the random effects are the variables that are of secondary interest.
Multilevel linear models don’t need to assume homogenity of regression slopes as the analysis of covariance. Multilevel linear models can also handle repeated measures without the assumption of independence, and are robust when dealing with missing data. Random slopes and random intercepts are assumed to be normal distributed around the overall model parameters in all the space of possible nestings. Sample size and power: The number of contexts relative to individuals within those contexts is important. Predictors can be centered around the grand mean or the group mean. Group mean centering can account for the covariance of the group characteristics as e.g., group size. See Bates, Mächer, Bolker & Walker 2015; lme4 in R Assessing the need for multilevel models Assess the need for random effects by comparing an intercept only model with a random intercept model and see if likelihood ratio improves significantly by allowing variability in intercepts.
Compare baseline intercept model with and without random effects with an anova
gls(x ~ 1)
lme(x ~ (1|y))
if mixed effects model is a better fit to the data, add a fixed effect and test if the better model is a random intercept or a random slopes and random intercepts model
lme(x ~ y1 +(1|y))
lme(x ~ y1 + (y1|y))
Practical issues group mean centering eliminated all effects, and not only the covariance of group size. This is due to the fact that the treatment “inbreeding” is not within groups but between groups, and group means are not further comparable once centered.