Tutorials › Nonlinear Mixed-Effects Models (NLME) › Distinguishing Residual Correlation From Occasion Variability

Between-Subject, Between-Occasion and Residual Variability · Tutorial 135 of 797

Distinguishing Residual Correlation From Occasion Variability

Use within-occasion and between-occasion covariance patterns to tell serial residual correlation apart from occasion-level variability, while recognizing when the two cannot be separated.

Intermediate 12 min read

What You'll Learn

  • Express total within-occasion covariance as the sum of occasion-effect and residual covariance components.
  • Identify the different covariance patterns produced by serial correlation and shared occasion effects.
  • Work out covariances for paired and repeated sampling-time designs.
  • Explain why a single pair of samples may not distinguish the two sources.
  • Check model assumptions and recognize diagnostic patterns that suggest misspecification.

Why covariance patterns matter

Two concentration measurements taken during the same dosing occasion can move together for different reasons. A shared occasion-level change can shift many measurements in that occasion, while serial residual correlation can make measurements close in time more alike than measurements farther apart. Both mechanisms may produce positive covariance for a pair of nearby samples. Treating one as the other can therefore misrepresent how variability is distributed across occasions and sampling times.

The distinction is about the pattern of covariance, not merely whether covariance is present. A shared occasion effect tends to contribute covariance across all samples influenced by that effect. Serial correlation tends to depend on the time gap between samples and is usually confined to a sampling sequence. Earlier material on serially correlated residuals and occasion variability introduces these components; here the focus is how their covariance signatures compare.

A covariance model for repeated samples

Let \(Y_{ikj}\) be the observation for subject \(i\), occasion \(k\), and sampling time \(t_{ikj}\). Let \(m_{ikj}\) denote its model-predicted mean after conditioning on the subject-level random effects. Define the conditional residual as \(r_{ikj}=Y_{ikj}-m_{ikj}\). For a vector of residuals from one occasion, a useful decomposition is

$$ \mathbf r_{ik}=\mathbf Z_{ik}\mathbf b_{ik}+\boldsymbol\epsilon_{ik}, \qquad \operatorname{Cov}(\mathbf r_{ik}\mid\text{subject effects}) =\mathbf Z_{ik}\boldsymbol\Omega_{\mathrm{occ}}\mathbf Z_{ik}^{\mathsf T} +\mathbf R_{ik}. $$

Here \(\mathbf b_{ik}\) is an occasion-level random effect with mean zero and covariance matrix \(\boldsymbol\Omega_{\mathrm{occ}}\); \(\mathbf Z_{ik}\) describes how that effect changes each observation. The vector \(\boldsymbol\epsilon_{ik}\) contains residual errors, with covariance matrix \(\mathbf R_{ik}\). This sum follows when the occasion effect and residual process are independent, conditional on subject effects. The covariance decomposition itself does not require normality, although a Gaussian covariance model is often used for likelihood-based fitting.

For a scalar occasion effect that adds the same amount to each observation, the corresponding row of \(\mathbf Z_{ik}\) is 1. If its variance is \(\tau^2\), it contributes \(\tau^2\) to every pairwise covariance within that occasion, regardless of the time gap. Other occasion effects need not act as a constant shift. For example, an effect on a structural parameter may change concentrations by different amounts at different times. In a local linear approximation, its covariance contribution has entries proportional to the product of the two time-specific sensitivities to that parameter.

A common serial residual model instead specifies, for two distinct samples in one occasion,

$$ \operatorname{Cov}(\epsilon_{ikj},\epsilon_{ikl}) =\sigma_{\epsilon,j}\sigma_{\epsilon,l}\rho(|t_{ikj}-t_{ikl}|). $$

The correlation function \(\rho(\cdot)\) describes how residual correlation changes with separation in time. For example, an exponential correlation function is \(\rho(d)=\exp(-\phi d)\), where \(d\) is the time gap and \(\phi>0\) controls how quickly correlation declines. The residual variances can differ by sampling time; the formula accounts for that through their standard deviations. In a simple constant-variance case, \(\sigma_{\epsilon,j}=\sigma_\epsilon\) for all \(j\).

Key distinction: An occasion effect contributes covariance according to which observations share that effect and how strongly each observation responds to it. Serial residual correlation contributes covariance according to the residual correlation function, commonly declining with time separation. If both mechanisms are present, their covariance contributions add under conditional independence.

Worked examples with paired sampling times

Worked Example: One Pair Cannot Identify the Source

Suppose two samples are taken 1 hour apart during the same occasion. After accounting for subject effects and the predicted means, assume a scalar occasion random intercept with variance \(\tau^2=9\ \text{(concentration units)}^2\). Let each residual have variance \(16\ \text{(concentration units)}^2\), and let their serial residual correlation be \(0.60\). Calculate the total covariance of the paired residuals.

The occasion effect contributes \(9\ \text{(concentration units)}^2\). The residual covariance is the correlation times the residual standard deviations:

$$ \operatorname{Cov}(\epsilon_{ik1},\epsilon_{ik2}) =0.60\sqrt{16}\sqrt{16} =0.60(4)(4) =9.6\ \text{(concentration units)}^2. $$

Thus the total covariance is \(9+9.6=18.6\ \text{(concentration units)}^2\). A single observed pair, or even a single estimated covariance for pairs with this same time gap, does not by itself show how much of the covariance came from each component. The sum is observable through the covariance pattern; separating its parts requires additional information, such as multiple time gaps or replicated occasions.

Worked Example: Comparing Several Time Gaps

Consider three equally spaced samples from one occasion, each 1 hour apart. Assume a scalar occasion random intercept with variance \(4\ \text{(concentration units)}^2\), residual variance \(9\ \text{(concentration units)}^2\), and exponential serial correlation with \(\phi=\log(2)\ \text{hour}^{-1}\). Calculate the total covariance for adjacent samples and for samples 2 hours apart.

For adjacent samples, the serial correlation is \( \exp[-\log(2)(1\ \text{hour})]=0.5\). The residual covariance is \(0.5(9)=4.5\ \text{(concentration units)}^2\). Adding the shared occasion contribution gives \(4+4.5=8.5\ \text{(concentration units)}^2\).

For samples 2 hours apart, the serial correlation is \( \exp[-\log(2)(2\ \text{hours})]=0.25\). Their residual covariance is \(0.25(9)=2.25\ \text{(concentration units)}^2\), so the total covariance is \(4+2.25=6.25\ \text{(concentration units)}^2\).

The occasion component is the same for both pairs, while the serial component is smaller for the more widely separated pair. In this specified model the total covariances are therefore 8.5 and 6.25, respectively. A decline with time gap is consistent with serial correlation, but it does not rule out an occasion effect: the common contribution remains in both covariances.

Worked Example: Replicated Occasions Reveal a Boundary Pattern

Suppose the same subject has two occasions, with samples at 1 and 2 hours on each occasion. After conditioning on subject effects, assume each occasion has an independent random intercept with variance \(4\ \text{(concentration units)}^2\). Within each occasion, residual variance is \(9\ \text{(concentration units)}^2\), and the residual correlation between the two samples is 0.5. Residuals are independent across occasions. Find the covariance matrix in the order: occasion 1 at 1 hour, occasion 1 at 2 hours, occasion 2 at 1 hour, occasion 2 at 2 hours.

Each diagonal entry is the sum of occasion variance and residual variance, \(4+9=13\ \text{(concentration units)}^2\). Within an occasion, the off-diagonal entry is \(4+0.5(9)=8.5\ \text{(concentration units)}^2\). Across occasions, the occasion effects are independent and the residuals are independent, so the covariance is zero. The resulting matrix is

$$ \begin{pmatrix} 13 & 8.5 & 0 & 0\\ 8.5 & 13 & 0 & 0\\ 0 & 0 & 13 & 8.5\\ 0 & 0 & 8.5 & 13 \end{pmatrix} \quad \text{in } \text{(concentration units)}^2. $$

The repeated within-occasion covariance and the lack of cross-occasion covariance reflect both assumptions in this example: a shared effect within each occasion, and independent occasions after conditioning on subject effects. If cross-occasion covariance remained in the data, it could indicate unaccounted-for subject-level variation, dependence between occasions, or an inadequate mean model rather than the specified independent occasion effects alone.

Justifying the decomposition and using design information

The covariance sum follows directly from the model. Write one occasion’s residual vector as \(\mathbf r=\mathbf Z\mathbf b+\boldsymbol\epsilon\), with both component vectors having conditional mean zero. Expanding the covariance gives

$$ \begin{aligned} \operatorname{Cov}(\mathbf r) &=\operatorname{Cov}(\mathbf Z\mathbf b+\boldsymbol\epsilon)\\ &=\mathbf Z\operatorname{Cov}(\mathbf b)\mathbf Z^{\mathsf T} +\operatorname{Cov}(\boldsymbol\epsilon) +\operatorname{Cov}(\mathbf Z\mathbf b,\boldsymbol\epsilon) +\operatorname{Cov}(\boldsymbol\epsilon,\mathbf Z\mathbf b). \end{aligned} $$

Conditional independence of \(\mathbf b\) and \(\boldsymbol\epsilon\) makes the two cross-covariance terms zero. Substituting \(\operatorname{Cov}(\mathbf b)=\boldsymbol\Omega_{\mathrm{occ}}\) and \(\operatorname{Cov}(\boldsymbol\epsilon)=\mathbf R\) yields \(\mathbf Z\boldsymbol\Omega_{\mathrm{occ}}\mathbf Z^{\mathsf T}+\mathbf R\). If the components are dependent, those cross terms need not vanish, and the simple additive decomposition is not justified.

The design determines whether the component patterns can be distinguished. A single pair at one time gap provides only one off-diagonal covariance, which may be explained by many combinations of occasion and residual covariance. Samples at several time gaps offer more information about a declining residual correlation function. Replicated occasions provide a further contrast: a residual process restricted to each occasion does not, under the assumed independence, create cross-occasion covariance, whereas a shared subject-level effect could do so. The interpretation depends on conditioning appropriately on subject effects and on the assumption that occasion effects are independent across occasions.

Assumptions, diagnostics, and alternatives

Before interpreting covariance patterns, check the assumptions that give them meaning. The conditional mean model should adequately describe the systematic concentration-time trajectory; otherwise, residuals can share patterns because predictions are wrong. Subject-level effects must be accounted for when assessing occasion-level covariance. The form of the occasion effect must be plausible for the scientific mechanism, and the residual correlation function should reflect the sampling process. Independence between occasion effects and residual errors, and any assumed independence across occasions, should be stated rather than silently presumed.

Useful diagnostics compare residual covariance or correlation by time lag and by whether observations belong to the same occasion. Patterns that remain similar across a range of within-occasion time gaps suggest a shared contribution, especially if within-occasion residuals remain associated even at long gaps. A steady decline with time gap supports a serial component. Cross-occasion association after conditioning on subject effects challenges a model that assumes independent occasions and residual processes. These are clues, not definitive tests: finite data, unequal sampling schedules, changing residual variances, and uncertain mean predictions can obscure the ideal patterns.

The main alternatives are to fit an occasion effect alone, a serial residual structure alone, or both together. A model with only an occasion effect may miss a clear decline in correlation with time separation. A serial-only model may fail to account for a common within-occasion contribution that persists at long gaps. A combined model is more flexible, but can be difficult to estimate when there are few observations per occasion or too few replicated occasions. Compare whether the fitted covariance reproduces the observed within- and between-occasion patterns, and whether parameter estimates are stable and scientifically interpretable; a better numerical fit alone does not establish that a component has the correct scientific interpretation.

A scalar random intercept is only one possible occasion effect. If occasion variability acts through a parameter that changes the shape of the concentration-time curve, its covariance can vary with sampling time according to the model’s sensitivities. In that setting, a constant covariance contribution is not the right benchmark. Also, an occasion effect and serial correlation can be difficult to distinguish when the observed time gaps cover only a narrow range. No covariance pattern can compensate for a design that does not contain enough repeated information to identify the proposed components.

Common mistake

A common mistake is to see positive covariance between two samples from the same occasion and conclude that an occasion random effect must be present. That reasoning ignores serial residual correlation, which can also produce positive within-occasion covariance. The correction is to examine covariance across multiple time gaps and replicated occasions, and to compare the patterns implied by the candidate mechanisms. When the design supplies only one pair type, report that the sources are not separately identified by that covariance alone rather than assigning the entire pattern to one component.

Key takeaway: Covariance from a shared occasion effect follows shared exposure to that effect; serial residual covariance follows the residual correlation structure. Distinguishing them requires repeated measurements that reveal more than one covariance pattern.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. Under a shared occasion random-intercept model, what contribution does the occasion effect make to the covariance of two samples from that occasion? Does it depend on their time gap?
  2. With residual variance \(25\ \text{(concentration units)}^2\) and residual correlation 0.4, calculate the residual covariance for a pair of samples.
  3. Why can one estimated covariance for one sampling-time pair fail to distinguish serial correlation from occasion variability?
  4. In a model with independent occasion effects and residual processes confined to occasions, what cross-occasion covariance is expected after conditioning on subject effects?
  5. Name one diagnostic pattern that supports a serial correlation component and one assumption whose failure could make the covariance decomposition misleading.

Solutions. 1. For a scalar random intercept with variance \(\tau^2\), the contribution is \(\tau^2\) for any pair sharing that occasion; it does not depend on the time gap. 2. The residual standard deviation is \(5\ \text{concentration units}\), so the covariance is \(0.4(5)(5)=10\ \text{(concentration units)}^2\). 3. The observed covariance can be the sum of an occasion contribution and a residual contribution, and one pair type does not provide enough distinct covariance information to separate the two. 4. Zero, under the stated conditional independence assumptions. 5. A decline in residual correlation as the within-occasion time gap increases supports serial correlation. If the occasion effect and residual process are dependent, cross-covariance terms need not be zero, so the simple additive decomposition can be misleading.