# Covariance structure with one or more random intercepts

I need to choose a suitable covariance structure including one or more random intercepts:

If one factor B is nested in another factor A, one option would of course be to consider a model with random intercepts of both A and B, corresponding to (1|A) + (1|B) when using lmer in the R package lme4 or providing the argument random = ~1|A/B to the lme function in the R package nlme, but would it make any sense to consider a model with only the random intercept of B, even if B is nested in A?

Let consider 2 levels in factor A and 2 individuals in each level of factor A, so totally 4 individuals. $$i$$ indicates level of factor A and $$j$$ for B.

When the two intercepts are used, we have $$Y_{ij} = X\beta + \gamma_i + \gamma_j + \epsilon_{ij}$$ $$Var(\gamma_i) = \sigma_A^2, Var(\gamma_j) = \sigma_B^2, Var(\epsilon) = \sigma^2$$

Then $$Var\left(\begin{matrix}Y_{11}\\ Y_{12}\\Y_{21}\\Y_{22}\end{matrix}\right)= \left(\begin{matrix}\sigma^2+\sigma_A^2 + \sigma_B^2 & \sigma_A^2 + \sigma_B^2 & \sigma_A^2&\sigma_A^2 \\ \sigma_A^2 + \sigma_B^2 & \sigma^2+\sigma_A^2 + \sigma_B^2 & \sigma_A^2&\sigma_A^2 \\ \sigma_A^2 & \sigma_A^2 & \sigma^2+\sigma_A^2 + \sigma_B^2 &\sigma_A^2 + \sigma_B^2\\ \sigma_A^2 & \sigma_A^2 & \sigma_A^2 + \sigma_B^2&\sigma^2+\sigma_A^2 + \sigma_B^2 \end{matrix}\right)$$

If intercept for factor B only, we have $$Y_{ij} = X\beta + \gamma_j + \epsilon_{ij}$$

Then $$Var\left(\begin{matrix}Y_{11}\\ Y_{12}\\Y_{21}\\Y_{22}\end{matrix}\right)= \left(\begin{matrix}\sigma^2 + \sigma_B^2 & \sigma_B^2 & 0&0\\ \sigma_B^2 & \sigma^2+ \sigma_B^2 & 0&0\\ 0&0& \sigma^2+ \sigma_B^2 & \sigma_B^2\\ 0 & 0& \sigma_B^2&\sigma^2 + \sigma_B^2 \end{matrix}\right)$$

When two intercepts are in the model, $$Y$$ from the same individual has covariance $$\sigma_A^2+\sigma_B^2$$, $$Y$$ from different individuals but from same level of factor A has covariance $$\sigma_A^2$$, which is smaller than covariance from the same individual. Generally this assumption is reasonable.

When just individual level intercept is kept in the model, the covariance between the difference individual is zero, even they come from the same level of factor A. Generally, this is not what we want.

In general I would recommend including both (1|A) and (1|B) in the model - otherwise you're not fitting the maximal model, i.e. the model that includes all terms that are statistically identifiable. If the variation in A is reasonably large and you omit the (1|A) term, the model for the random effects corresponding to the remaining (1|B) term (that they are independently drawn from a zero-centred Normal distribution) might be off. Some reasons it might be reasonable to omit the (1|A) term:

• there is something about your data that would eliminate any differences in A (not just experimental control: for example, maybe you've already subtracted the mean from the observations in each A group)
• you get a singular fit, i.e. an estimate of zero variance among levels of A (in this case you'll get exactly the same answer if you drop this term)
• you think there are too few levels of A to estimate the variance (in this case it would be more conservative to include A in the model as a fixed effect
• if you are using data-driven model selection to decide what terms to include, and the model including (1|A) is not selected (e.g. the AIC is higher). (In general you need to be very careful when doing this kind of "sacrificial pseudoreplication" (sensu Hurlbert 1984) that you don't mess up your coverage/type-I error ...)

(Note that the levels of B need to be uniquely coded - otherwise you should specify the nested syntax (1|A/B) (or (1|A) + (1|A:B)) in lme4 as well in nlme ...)