Why Nesting Matters
Repeated observations from one person are not generally independent. Measurements from the same person can resemble one another because of stable between-subject differences. Measurements from the same person and occasion can share an additional occasion-specific deviation. Separating these sources of variation gives a precise account of which pairs of observations are expected to covary.
In pharmacometrics, an occasion might be a treatment period or a distinct dosing period for a subject. A subject-level random effect is shared across that subject’s occasions; an occasion-level random effect is shared only by observations from that subject on that occasion. This nesting determines the covariance pattern.
Assumptions and Covariance Structure
For the standard variance-component model, assume \(E(B_i)=E(O_{ij})=E(\varepsilon_{ijr})=0\). Let the corresponding variances be \(\tau_B^2\), \(\tau_O^2\), and \(\sigma^2\). Assume subject effects are independent across subjects; occasion effects are independent across occasions and subjects; and residuals are independent across observations. Also assume the three collections of effects are mutually independent. These assumptions imply that effects from different levels contribute covariance only when they are shared by both observations.
Normal distributions are not required to derive these covariances: zero means, finite variances, and the stated independence are sufficient. Normal random effects and residuals may be assumed when a Gaussian likelihood is needed. The mean \(\mu_{ijr}\) may vary with time, dose, or other modeled predictors; covariance here concerns deviations around those means.
The indicator \(\mathbf{1}(\cdot)\) equals 1 when its stated condition is true and 0 otherwise. Thus, observations from different subjects share no random component; observations from the same subject but different occasions share only \(B_i\); and distinct observations from the same subject and occasion share both \(B_i\) and \(O_{ij}\). A measurement is also correlated with itself, so its variance includes the residual variance.
For any observation under this model, its variance is \(\tau_B^2+\tau_O^2+\sigma^2\). If two distinct observations share a subject and occasion, their covariance is \(\tau_B^2+\tau_O^2\). If they share only a subject, their covariance is \(\tau_B^2\); if they share neither, it is zero. When variances are common, the corresponding correlations are these covariances divided by the total variance. These are marginal covariances: they describe the repeated observations after the random effects have been integrated over, not the residuals conditional on the random effects.
Deriving the Result
The key step is to expand the covariance and use independence. For observations \(Z_{ijr}\) and \(Z_{i'j'r'}\), the fixed means do not affect covariance. The remaining terms are \(B_i+O_{ij}+\varepsilon_{ijr}\) and \(B_{i'}+O_{i'j'}+\varepsilon_{i'j'r'}\). Independence makes every cross-covariance between different components zero. A subject effect contributes only if the subject indices match, an occasion effect contributes only if both subject and occasion indices match, and a residual contributes only if the observations are the same.
For example, consider distinct replicates \(r\ne r'\) on the same occasion. The residual covariance is zero, while the subject and occasion effects are shared. Therefore the covariance is \(\tau_B^2+\tau_O^2\). If the occasions differ but the subject is the same, the occasion effects are independent and the covariance reduces to \(\tau_B^2\). This also explains why the occasion effect is called nested: the label \(j\) identifies an occasion within a particular subject, not a random effect shared across subjects.
Worked Covariance Calculations
Worked Example: Comparing Same- and Different-Occasion Covariance
Suppose the analyzed quantity is on a log scale, and a hypothetical model has subject variance \(\tau_B^2=0.36\), occasion variance \(\tau_O^2=0.16\), and residual variance \(\sigma^2=0.09\), all in squared log units. Calculate the variance of one observation and the covariance of two distinct observations from (a) the same occasion and (b) different occasions of the same subject.
The marginal variance of one observation is $$ 0.36+0.16+0.09=0.61 $$ squared log units.
For two distinct observations on the same subject and occasion, the shared components are \(B_i\) and \(O_{ij}\), so $$ \operatorname{Cov}=0.36+0.16=0.52 $$ squared log units. Their correlation is \(0.52/0.61=0.8525\).
For observations from different occasions of the same subject, only \(B_i\) is shared: $$ \operatorname{Cov}=0.36 $$ squared log units, giving correlation \(0.36/0.61=0.5902\). The higher same-occasion correlation follows from the additional shared occasion effect. These calculations assume both observations have the same marginal variance and are distinct, so the residual does not contribute to their covariance.
Worked Example: Constructing a Covariance Matrix
Consider two occasions for one hypothetical subject, with two observations on each occasion. Let \(\tau_B^2=0.49\), \(\tau_O^2=0.16\), and \(\sigma^2=0.09\), in squared units of the analyzed response. Order the observations as occasion 1, replicates 1 and 2, followed by occasion 2, replicates 1 and 2.
Each diagonal entry is the total variance, \(0.49+0.16+0.09=0.74\). The covariance between the two observations on occasion 1 is \(0.49+0.16=0.65\); the same applies to the two observations on occasion 2. A pair from different occasions shares only the subject effect, so each such covariance is \(0.49\). Thus the covariance matrix is $$ \begin{pmatrix} 0.74 & 0.65 & 0.49 & 0.49\\ 0.65 & 0.74 & 0.49 & 0.49\\ 0.49 & 0.49 & 0.74 & 0.65\\ 0.49 & 0.49 & 0.65 & 0.74 \end{pmatrix}. $$ The matrix is symmetric, as a covariance matrix must be. Its equal diagonal entries and repeated off-diagonal patterns express the model’s assumptions of common variances and exchangeability within each relationship category.
Worked Example: Covariance Across Subjects
Suppose two hypothetical observations have the same modeled mean, and the variance components are \(\tau_B^2=4.0\), \(\tau_O^2=1.0\), and \(\sigma^2=2.0\) in squared concentration units. One observation is from subject 1, occasion 1; the other is from subject 2, occasion 1. Find their covariance and explain why it is not 1.0.
The subject indices differ, so the subject effects are independent. The occasion labels both equal 1, but these are occasions nested within different subjects; they do not identify a common random effect. The residuals are also distinct. Substitution into the covariance formula gives $$ 4.0(0)+1.0(0)+2.0(0)=0 $$ squared concentration units. The covariance is zero under this model. The occasion variance does not contribute because occasion effects are indexed within subject, so \(O_{1,1}\) and \(O_{2,1}\) are different effects.
Using and Checking the Model
The nested model is useful because its covariance pattern gives a direct interpretation to each variance component. In particular, the difference between covariance within an occasion and covariance across occasions of one subject is \(\tau_O^2\), when both pairs consist of distinct observations and the assumptions hold: $$ (\tau_B^2+\tau_O^2)-\tau_B^2=\tau_O^2. $$ The covariance shared across distinct subjects is zero in this simple model. These relationships clarify what the model implies; they do not guarantee that all variance components can be estimated precisely from every design.
In a nonlinear mixed-effects model, subject and occasion effects often enter a parameter equation rather than being added directly to the observed response. For a positive parameter \(P\), for example, a nested log-scale parameter model can be written $$ \log(P_{ij})=\log(P_{\mathrm{pop}})+B_i+O_{ij}. $$ This makes the subject and occasion terms additive on the log-parameter scale. The covariance formula above applies exactly to quantities modeled additively with those terms. If the observed response is a nonlinear function of \(P_{ij}\), its marginal covariance on the response scale need not equal the simple additive formula. The scale of the model and the scale of the covariance calculation must therefore be stated. A linearized prediction may be used to approximate covariance on the response scale, but the resulting sensitivities and covariance should not be confused with the exact log-parameter covariance.
Useful checks include comparing empirical residual patterns across the three relationships: within the same occasion, across occasions of the same subject, and across subjects. If within-occasion pairs are not more similar than same-subject pairs from different occasions, the occasion component may be weak, poorly estimated, or inconsistent with the data. A pattern of association across subjects may indicate omitted shared structure or dependence not represented by this model. Such comparisons are diagnostic clues, not formal proof of a particular cause.
The model also has important limitations. It assumes one scalar occasion effect is shared equally by all observations on that occasion, independent occasion effects across occasions, and independent residuals. Unequal residual variances, correlated occasions, or correlations between multiple occasion effects require a different covariance specification. Cross-parameter correlations among occasion effects are a distinct extension; the scalar model here does not imply any such relationship. In addition, designs with few occasions or few replicates may contain limited information for separating variance components. A fitted estimate near zero should not automatically be interpreted as proof that the corresponding biological variability is absent.
Common Mistakes and Alternatives
- Counting an occasion effect across subjects. Two records both labeled “occasion 1” do not share an effect unless they belong to the same subject. Occasion effects are nested within subject.
- Adding residual variance to every covariance. Residual variance contributes to an observation’s own variance. Under independent residuals, it does not contribute to covariance between distinct records.
- Treating same-subject observations as independent. They share \(B_i\), so their covariance is \(\tau_B^2\) even across different occasions.
- Applying the response-scale formula to a nonlinear parameter model. The additive covariance result holds on the scale where the random effects enter additively; a nonlinear transformation can change covariance on another scale.
A model with only a subject effect and residual has covariance \(\tau_B^2\) for every pair of distinct observations from the same subject, whether or not they share an occasion. Adding a nested occasion effect allows same-occasion pairs to have the extra covariance \(\tau_O^2\). At the other extreme, a model with no subject effect would assign zero covariance to observations from different occasions of the same subject. Choosing among these structures depends on the scientific meaning of occasions and on whether the data can support the added component; a more complex structure is not automatically better.
Check Your Understanding
Answer each question using the nested model and its assumptions. Solutions follow the questions.
- If \(\tau_B^2=0.25\), \(\tau_O^2=0.10\), and \(\sigma^2=0.15\), what is the variance of one observation?
- Using those same components, what is the covariance between two distinct observations from the same subject and occasion?
- What is the covariance between observations from different occasions of the same subject? Explain which component contributes.
- Two observations are from different subjects, but both are labeled occasion 2. What is their covariance under the nested model?
- Why does the residual variance contribute to the variance of one observation but not the covariance of two distinct observations?
Solutions. (1) The variance is \(0.25+0.10+0.15=0.50\) squared units. (2) The covariance is \(0.25+0.10=0.35\) squared units because the subject and occasion effects are shared. (3) It is \(0.25\) squared units: only the subject effect is shared. (4) It is zero, because occasion 2 refers to a separate nested effect for each subject, and the subjects differ. (5) An observation contains its own residual, so its variance includes \(\sigma^2\); distinct observations have independent residuals, so their residual covariance is zero.