Welcome to the final part of our four-part blog series aimed at providing you with a brief introduction to linear mixed models. In this final part, we discuss how to check the assumptions of the linear mixed model and assess goodness of fit.
Part 4: Model checking and goodness of fit
Conditional and marginal fitted values and residuals
Conditional fitted values are calculated from all the fixed and random effects. The conditional residuals are the difference between the observed data and the conditional fitted values. That is, they are estimates of the model deviations (i.e., the random error, e). The conditional residuals can be used to check the normality and variance homogeneity assumptions of the model deviations. (Note, conditional residuals and fitted values are not formed when the model contains negative variance components as these quantities are undefined in this case.)
Marginal fitted values calculated from only the fixed effects. The marginal residuals are the difference between the observed data and the marginal fitted values. The marginal residuals can be used to assess the linearity of the fixed effects and the variance-covariance structure.
Checking assumptions
For conditional residuals, and for BLUPs, we expect that they should reflect the variance model for the random term from which they arise. Thus, for a set of independent random effects, it is often useful to form a histogram or Normal quantile plots of the residuals or BLUPs to assess the approximation to a Normal distribution. For random effects with serial correlation and a common variance, it may be helpful to plot a one- or two-dimensional variogram to assess whether the observed pattern of correlation matches that expected for the model.
Construction of the fitted values plot, which plots the residuals against the fitted values to detect variance heterogeneity, requires some thought. The inclusion of random effects in the conditional fitted values means that shrinkage (see Part 2) may induce correlation between the conditional residuals and fitted values, which occasionally results in trend in a fitted values plot. If this does occur, it can be investigated by plotting the conditional residuals against the marginal fitted values. If the trend vanishes, then it is an artefact of shrinkage and can be ignored; if the trend does not vanish, then it indicates some underlying problem with the model.
Goodness of fit
There is currently no generally accepted analogue of the adjusted R2 statistic to quantify the explanatory performance of linear mixed models. It is generally acceptable to state whether fixed terms show evidence of group differences (factors) or linear trend (variates), based on the outcome of Wald or approximate F-tests. However, one approach to calculating the percentage variance accounted for by the fixed model is based on the variance of an observation, as defined in Part 2, in terms of the sum of the variance components. The baseline total variance can be calculated as the sum of the variance components when the constant term alone is included in the fixed model. This is compared to the sum of the variance components for the fixed model under consideration, and the percentage reduction can then be considered as the percentage variance accounted for by the fixed model. This statistic can be used to quantify the performance of different fixed models, for a given response and random model.
As an illustration, let’s calculate the % variance accounted for by the genotype factor by comparing Model 1:
Fixed model:Â Genotype
Random model:Rep+Rep.Subblock
to the null model, Model 0:
Fixed model:
Random model:Rep+Rep.Subblock
The variance components and the residual variance for both models are given in the table below. Note, the total variance is equal to the sum of the variance components and the residual variance:

Thus, the percentage variance accounted for by adding the genotype term into the model is therefore 100 × (3178 – 1824) / 3178 = 42.6%.