Comparing mixed multiple regression models
When to use:
Model comparison serves to choose the set of independent variables (fixed effects) that describes the data best with as few parameters as possible. It works like comparing multiple regression models: we compare a full model with a reduced model (without some of the variables), or let the program select the model automatically (backward, forward, stepwise or subset selection).
In mixed models one additional rule applies: the random structure is shared by all compared models. Selection concerns the fixed effects only, and the random intercept, random slopes and covariance type set in the window remain in every model. A variable that has been given a random slope stays in every compared model as a fixed effect (one cannot remove the fixed effect of a variable while keeping its random slope). Whether the random effects themselves are needed is decided by the LR tests in the mixed multiple regression report.
Definitions of measures
Models are compared with the information criteria AIC, AICc and BIC (the smaller, the better) and, for nested models, with the likelihood ratio test (LR): the statistic \(2(\ell_{full}-\ell_{reduced})\) follows a \(\chi^2\) distribution with degrees of freedom equal to the number of removed variables. A non-significant result means that the removed variables carry no information and the simpler model should be chosen; a significant result – that the full model is significantly better.
Out-of-sample evaluation of models
The information criteria and the LR test are determined on the same data on which the models were fitted, which makes the assessment of the models too optimistic. As in comparing multiple regression models, the analysis window therefore makes it possible to evaluate the models on observations that did not take part in fitting them (the Validation option): \(k\)-fold cross-validation or a random test set, with the split determined by the Seed. For each model the report then gives RMSE, MAE and the predictive \(R^2\), and in the model selection block – the error of the null model and the best model by validation (the one with the smallest RMSE); validation error can also be chosen as the automatic selection criterion. In mixed models two additional rules apply:
- whole groups are split – all the observations of one group (e.g. one patient) go to the same part of the data. Observations of the same group are correlated with each other, so dividing them between the training part and the evaluated part would understate the error. The number of folds \(k\) is limited to the number of groups, and the share of the test set means the percentage of groups;
- the prediction for a new group is based on the fixed effects only – the random effect of a group that was not in the training set is unknown, so its expected value, i.e. zero, is assumed. The validation measures therefore tell how well the fixed effects of the model predict the observations of a new group (e.g. a new patient), and they correspond to the marginal, not the conditional, \(R^2\). RMSE also includes the variability between groups, so it is larger than the residual standard deviation of the model.
The null model here is the model with the intercept, the shared random structure and the variables that were given a random slope (they stay in every model); it is fitted and evaluated in the same way as the other models.
How to set up the analysis
Statistics \(\to\) Mixed models \(\to\) Mixed multiple regression – comparing models.

In the window we indicate the dependent variable \(Y\), the variables of the full model and of the reduced model (or the automatic selection criterion), as in comparing multiple regression models. Mixed-model options:
- Grouping variable (ID) – the column identifying the group; shared by all models,
- Random slopes (from full-model X) – variables whose effect differs between groups; such a variable stays in every compared model,
- Random effects covariance – independent or unstructured (correlated), shared by all models,
- Model coefficients (selection: ML) – REML or ML for the coefficient tables; the selection itself is always ML,
- Fixed effects degrees of freedom – Satterthwaite or Wald z test in the coefficient tables,
- Criterion – the automatic selection criterion: AIC, AICc, BIC, p (LR / F test) with a threshold, or validation error,
- Validation – none, k-fold CV, k = with the number of folds (from 2 to 100, 10 by default) or test set, % = with the share of the test set as a percentage of the groups (from 5 to 90, 30 by default); whole groups are split,
- Seed – the seed of the random split (12345 by default); the same seed means the same split.
Results and interpretation
The report contains a frame describing the shared random structure (grouping variable, number of groups, random components, covariance), the table Information criteria and LR tests with \(-2LL\) (ML), AIC, AICc, BIC, marginal and conditional \(R^2\) of each model and the LR test between successive models, and the coefficient tables of the compared models (conditional fixed effects, with the random-effect variances of each model). If a singular fit occurred for any model, it is marked in the table. When validation is switched on, the report additionally contains the Out-of-sample evaluation block (the method of splitting, the seed, the split unit, the error of the null model, the best model by validation), and for each model – RMSE, MAE and the predictive \(R^2\).
Example 1. continuation of example 2 (orthodontics.pqs file)
The growth model of the pituitary–pterygomaxillary fissure distance contained: age, sex and the interaction age\(\times\)sex. We check whether the interaction (different growth rates of girls and boys) is really needed, comparing the full model with a reduced model without the interaction. Random structure: random intercept and random slope of age, unstructured covariance, shared by both models.

The full model has \(-2LL=348.70\) (ML), AIC \(=364.70\), BIC \(=384.52\); the model without the interaction \(-2LL=354.99\), AIC \(=368.99\), BIC \(=386.33\). LR test: \(\chi^2=354.99-348.70=6.28\), \(df=1\), \(p=0.012\) – removing the interaction significantly worsens the fit, and both information criteria point to the full model. We keep the model with the interaction: girls and boys grow at different rates. If we additionally compared the model with age only (\(-2LL=360.72\), AIC \(=372.72\)), it would turn out that sex carries information only together with the interaction – in the model without the interaction its effect is the average difference over the whole age range (\(b=-2.04\), \(p=0.008\)), which hides the fact that this difference grows with age.
Out-of-sample evaluation. We will also check whether the interaction improves the prediction of growth in children who did not take part in fitting the model. We repeat the same comparison, choosing in the Validation field the k-fold CV, k = option with 10 folds (seed 12345). The 27 patients are split, not the 88 measurements – all the measurements of one child go to the same part.

| training set | cross-validation (\(k=10\)) | |||
| model | AIC | RMSE | MAE | predictive \(R^2\) |
| null (age only) | 2.46 | 1.84 | ||
| Model 1 (with interaction) | 364.70 | 2.27 | 1.80 | 0.41 |
| Model 2 (without interaction) | 368.99 | 2.31 | 1.80 | 0.38 |
The model with the interaction has a smaller out-of-sample error (RMSE \(=2.27\) mm versus \(2.31\) mm) and a larger predictive \(R^2\) (\(0.41\) versus \(0.38\)); both models predict better than the null model, which – because of the random slope of age – contains age only (RMSE \(=2.46\) mm). Validation therefore confirms the result of the LR test and of the information criteria, although the advantage of the model with the interaction is small. It is worth noting that the predictive \(R^2\) (\(0.41\)) is close to the marginal \(R^2\) of the model (\(0.47\)), not to the conditional one (\(0.82\)): for a new child we do not know its random effect, so the prediction is based on the fixed effects alone.
PQStat