= Solution
The marginal <Akaike information criterion> is $\operatorname{AIC}=-2\ell(\widehat\vartheta_{\rm ML})+2k$, where $k$ counts estimated population parameters. Here they are $\beta_0,\beta_1,\sigma^2,\tau^2$, so $k=4$. The realized incubator slopes have been integrated out of the <likelihood function>; they are not four additional free population coefficients. From the marginal Gaussian <log-likelihood>, the expression is
$$
\boxed{\operatorname{AIC}_{\rm ML}=n\log(2\pi)+\log\det\widehat V+(Y-X\widehat\beta)^T\widehat V^{-1}(Y-X\widehat\beta)+8.}
$$
All hats here denote the ordinary <maximum likelihood estimation> fit.
The displayed value $14041.1$ is instead a <restricted maximum likelihood> criterion. Thus it cannot simply be substituted for the ordinary maximum-likelihood deviance. The https://lme4.github.io/lme4/reference/merMod-class.html[`logLik` method] defaults to the fitting convention. If one applies `AIC(fly.model)` directly to the displayed REML object, the default restricted <log-likelihood> and the same parameter count give the software's restricted-likelihood-based value $14041.1+8=14049.1$. This number should be labelled as such; it is not the ordinary marginal AIC derived above. To obtain the latter, refit and calculate
``
AIC(update(fly.model, REML=FALSE))
``
The output does not contain that numerical answer. In particular, restricted criteria must not be used to compare models with different fixed-effect designs. A conditional AIC targeting predictions for existing groups is yet another criterion and does not follow by counting each latent slope as an ordinary parameter.
Back to article page