Main Content

Mixed Effects

Linear mixed-effects models

A linear mixed-effects model includes both fixed and random effects in modeling a response variable. This type of model can account for global and local trends in a data set by including the random effects of a clustering variable. You can fit a linear mixed-effects model using fitlme if your data is in a table. Alternatively, if your model is not easily described using a formula, you can create matrices to define the fixed and random effects, and then fit the model using fitlmematrix.

Functions

expand all

fitlmeFit linear mixed-effects model
fitlmematrixFit linear mixed-effects model
predict Predict response of linear mixed-effects model
random Generate random responses from fitted linear mixed-effects model
fixedEffectsEstimates of fixed effects and related statistics
randomEffects Estimates of random effects and related statistics
fittedFitted responses from a linear mixed-effects model
anovaAnalysis of variance for linear mixed-effects model
coefCI Confidence intervals for coefficients of linear mixed-effects model
coefTestHypothesis test on fixed and random effects of linear mixed-effects model
compareCompare linear mixed-effects models
designMatrixFixed- and random-effects design matrices
covarianceParametersExtract covariance parameters of linear mixed-effects model
partialDependenceCompute partial dependence (Since R2020b)
residualsResiduals of fitted linear mixed-effects model
responseResponse vector of the linear mixed-effects model
plotPartialDependenceCreate partial dependence plot (PDP) and individual conditional expectation (ICE) plots
plotResidualsPlot residuals of linear mixed-effects model

Objects

LinearMixedModelLinear mixed-effects model

Topics