Tutorials › Nonlinear Mixed-Effects Models (NLME) › Sampling Designs for Separating Variance Components

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

Sampling Designs for Separating Variance Components

Compare sampling designs by the covariance information they provide about between-subject, between-occasion, and residual variability.

Intermediate 11 min read

What You'll Learn

  • Identify which repeated observations inform each variance component.
  • Explain why a single sample per subject cannot generally separate subject and residual variability.
  • Use within-occasion and cross-occasion covariances to distinguish variance sources.
  • Compare sparse, dense, and replicated sampling in terms of their information and limitations.
  • Recognize design features that can make variance components practically confounded.

Why Sampling Design Determines What Variability Can Be Learned

A nonlinear mixed-effects model can include separate sources of variability, but having a parameter for each source does not guarantee that the data can estimate them separately. The sampling design determines which observations share a subject effect, which share an occasion effect, and which have only residual variation in common. Those shared-observation patterns create the covariance information used to distinguish variance components.

The key design question is therefore not simply how many measurements are collected. It is which measurements are repeated within the same subject and occasion, and which are repeated across occasions. A large number of subjects measured once each may estimate overall dispersion precisely while providing little information about how that dispersion is divided among its components.

A Working Model for Design Comparisons

Use \(i\) for subject, \(j\) for occasion within subject, and \(k\) for observation within occasion. A convenient local representation of the NLME model is

$$ Y_{ijk}=m_{ijk}+x_{ijk}^{T}\eta_i+x_{ijk}^{T}\kappa_{ij}+\epsilon_{ijk}. $$

Here \(m_{ijk}\) is the population-model prediction at the observation time and covariates; \(\eta_i\) is a subject-level random-effect vector; \(\kappa_{ij}\) is an occasion-level random-effect vector; and \(\epsilon_{ijk}\) is residual variation. The row vector \(x_{ijk}^{T}\) represents how the relevant random effects influence the prediction. It can be understood as a local sensitivity of the prediction to those effects. For a simple random-intercept illustration, \(x_{ijk}=1\).

Working assumptions: Subjects are independent; subject effects have mean zero and covariance \(\Omega_S\); occasion effects have mean zero and covariance \(\Omega_O\), are independent across occasions, and are independent of subject effects; residuals have mean zero, variance \(\sigma^2\), and are independent across observations and of both random-effect levels. These are simplifying assumptions for interpreting design information, not requirements that every application must adopt.

Under these assumptions, two different observations have covariance contributions from the random effects they share. In the scalar random-intercept case, the result is especially transparent: two observations from the same subject on different occasions share subject variability; two observations from the same subject and occasion share both subject and occasion variability; distinct observations do not share independent residual errors. The variance of a single observation includes all three components.

$$ \begin{aligned} \operatorname{Var}(Y_{ijk})&=\tau_S^2+\tau_O^2+\sigma^2,\\ \operatorname{Cov}(Y_{ijk},Y_{ij'k'})&=\tau_S^2,\quad j\ne j',\\ \operatorname{Cov}(Y_{ijk},Y_{ijk'})&=\tau_S^2+\tau_O^2,\quad k\ne k'. \end{aligned} $$

In the vector model, the same sharing logic applies, but covariance also depends on the sensitivity vectors. For two distinct observations from the same subject, the subject contribution is \(x_{ijk}^{T}\Omega_S x_{ij'k'}\); if they are also from the same occasion, add \(x_{ijk}^{T}\Omega_O x_{ij'k'}\). This makes sampling time important: observations at informative times can respond differently to random parameters and therefore reveal covariance patterns that repeated observations at nearly identical times may not.

Worked Example: Why One Sparse Observation Does Not Separate Components

Suppose a hypothetical study measures each of 300 subjects once, on one occasion. For clarity, assume a random-intercept model with \(\tau_S^2=4\), \(\tau_O^2=1\), and \(\sigma^2=1\), all in squared concentration units. What variance does the single observation have, and can the three components be identified from this design alone?

The model gives

$$ \operatorname{Var}(Y_{i11})=\tau_S^2+\tau_O^2+\sigma^2 =4+1+1=6\ \text{(concentration units)}^2. $$

Each subject contributes only one observation, so there are no within-subject observation pairs from which to estimate a shared subject or occasion covariance. The observed spread can inform the total variance of 6, but the same total could arise, for example, from components \(3+2+1\) or \(4+0.5+1.5\). More subjects can improve estimation of the total spread; they do not, by themselves, create the repeated-observation covariance patterns needed to distinguish the components.

What Replication Adds

Replication means collecting multiple observations that share a level of the model. Repeated measurements within an occasion share both subject and occasion effects, while measurements from separate occasions in the same subject share only the subject effect. Comparing these pair types can separate the two shared components. Replicate observations also leave residual variation as the part that contributes to individual-observation variance but not to covariance between distinct measurements, under the working assumptions.

This logic depends on having enough subjects and repeated units to estimate each covariance pattern reliably. One pair of observations can illustrate a covariance, but in practice variance components are inferred from many subjects and many repeated pairs, accounting for the mean model and the full design.

Worked Example: Using Replicated Occasions to Recover Three Components

Consider a hypothetical study with many subjects, two occasions per subject, and two replicate observations per occasion, all taken at comparable conditions. Suppose the fitted covariance patterns are estimated as follows: an observation variance of 6, covariance between distinct replicates within the same occasion of 5, and covariance between observations on different occasions of the same subject of 4. Use the random-intercept model to recover the components.

The cross-occasion covariance contains the subject component only, so

$$ \widehat{\tau_S^2}=4\ \text{(concentration units)}^2. $$

The same-occasion covariance includes the subject and occasion components. Subtract the subject covariance to isolate the occasion component:

$$ \widehat{\tau_O^2}=5-4=1\ \text{(concentration units)}^2. $$

The observation variance contains all three components, so subtract the two shared components to obtain the residual variance:

$$ \widehat{\sigma^2}=6-4-1=1\ \text{(concentration units)}^2. $$

The recovered values are consistent with the assumed covariance structure: \(4+1+1=6\), and \(4+1=5\). This calculation demonstrates what the design makes distinguishable; it is not a recommendation to estimate components by raw covariance subtraction in a nonlinear model. A fitted NLME model uses the likelihood and mean structure, and estimates can be imprecise or constrained by the data.

Dense Sampling and Time-Dependent Information

Dense sampling collects observations at multiple times within an occasion. It can provide rich information about the shape of the individual trajectory and the way random parameters alter that shape. In a linearized model, different times have different sensitivity vectors, so covariance across times can help separate random effects that would look identical at a single time. Dense sampling can also provide multiple within-occasion pairs, helping distinguish shared occasion variation from residual variation.

Density alone is not enough. If measurements are all taken at nearly the same time and have nearly identical sensitivities, the covariance patterns may be almost redundant. Nor can dense measurements on only one occasion per subject directly reveal how occasion effects vary from one occasion to another. To estimate between-occasion variability, the design needs multiple occasions within subjects, with enough repeated information to distinguish occasion-level shifts from residual noise.

Worked Example: Dense Times Reveal a Random-Slope Component

Suppose a hypothetical model is locally represented by

$$ Y_{ijkt}=m_{ijkt}+\eta_{0i}+t\eta_{1i}+\kappa_{ij}+\epsilon_{ijkt}, $$

where \(t\) is time in hours, and the independent variances are \(\operatorname{Var}(\eta_{0i})=4\), \(\operatorname{Var}(\eta_{1i})=0.04\) concentration-squared per hour-squared, \(\operatorname{Var}(\kappa_{ij})=1\), and \(\operatorname{Var}(\epsilon_{ijkt})=0.25\), in compatible units. Compare the covariance of observations at time 0 and time 5 hours from the same subject but on different occasions.

Different occasions do not share \(\kappa_{ij}\), and distinct observations do not share residual error. They do share the subject intercept and subject slope. Therefore,

$$ \begin{aligned} \operatorname{Cov}\{Y_i(0),Y_i(5)\}_{\text{different occasions}} &=4+(0)(5)(0.04)\\ &=4\ \text{concentration}^2. \end{aligned} $$

Now compare two observations both at 5 hours, from the same subject but different occasions:

$$ \operatorname{Cov}\{Y_i(5),Y_i(5)\}_{\text{different occasions}} =4+(5)(5)(0.04)=5\ \text{concentration}^2. $$

The increase of \(5-4=1\) concentration-squared unit is the random-slope contribution at 5 hours. In this idealized calculation, varying the time points reveals the time-dependent subject covariance. Repeated times within occasions would additionally reveal the occasion contribution, while the diagonal observation variance also includes residual variance. If all observations were taken at \(t=0\), the random slope would have no effect on the prediction and could not be learned from this response pattern.

Comparing Sparse, Dense, and Replicated Designs

Design featureMost direct informationMain limitation
Sparse: few observations per subject, often one occasionPopulation-level distribution of observed outcomes; potentially broad coverage across subjectsWith one observation per subject, shared subject and occasion covariances are unavailable, so component separation is weak or impossible
Dense: many times within an occasionTrajectory shape, time-dependent sensitivities, and within-occasion covariance patternsWithout multiple occasions, between-occasion variability is not directly replicated; dense points can be redundant if sensitivities barely change
Replicated: multiple observations within occasions and multiple occasions per subjectWithin-occasion versus cross-occasion covariance contrasts, supporting separation of subject, occasion, and residual componentsCosts more observations per subject and still depends on informative timing, an adequate mean model, and enough independent subjects

These are not mutually exclusive choices. A practical design can combine a subset of dense profiles with many sparse subjects, or use replicated samples at selected times across several occasions. Such compromises can preserve broad population coverage while retaining enough repeated structure to identify key variance sources. The best allocation depends on which random effects matter scientifically, the expected covariance structure, and the precision required.

Derivation: The Covariance Signature of Shared Effects

The separation principle follows directly from the working model. For two distinct observations, subtract their means and multiply the deviations. Terms from independent, mean-zero effects have expectation zero; a shared random effect contributes its variance or covariance. In the scalar random-intercept case, if observations share subject and occasion, both \(a_i\) and \(c_{ij}\) appear in each deviation. If they share only the subject, only \(a_i\) appears in both. If they are different observations, independent residual errors have zero covariance.

$$ \begin{aligned} \operatorname{Cov}(Y_{ijk},Y_{ijk'}) &=E[(a_i+c_{ij}+\epsilon_{ijk})(a_i+c_{ij}+\epsilon_{ijk'})]\\ &=\tau_S^2+\tau_O^2,\quad k\ne k',\\ \operatorname{Cov}(Y_{ijk},Y_{ij'k'}) &=E[(a_i+c_{ij}+\epsilon_{ijk})(a_i+c_{ij'}+\epsilon_{ijk'})]\\ &=\tau_S^2,\quad j\ne j'. \end{aligned} $$

The second equality uses independence of occasion effects across occasions and independence of residuals. The diagonal variance adds the residual variance, giving \(\tau_S^2+\tau_O^2+\sigma^2\). Thus, in the idealized design, same-occasion covariance identifies the sum of subject and occasion components; cross-occasion covariance identifies the subject component; and the remaining diagonal variance identifies the residual component. If the assumed independence or covariance structure is wrong, these contrasts need not have those interpretations.

Design Diagnostics, Alternatives, and Limitations

Before fitting a model, make a table of how many subjects have each number of occasions and how many observations are available within each occasion. Then check whether the design actually contains each informative pair type: distinct observations within an occasion, and observations across occasions within the same subject. For random effects that alter trajectory shape, also inspect whether sampling times span regions with meaningfully different sensitivities.

After fitting, warning signs include variance estimates at or near zero, very large uncertainty in variance estimates, strong dependence of estimates on starting values, and difficulty obtaining a stable covariance matrix. These can indicate weak design information, although model misspecification or numerical problems can produce similar symptoms. A design-based check is to ask whether different allocations of variance would produce nearly the same covariance among the observations actually collected. If so, the components may be practically difficult to distinguish even when they are formally identifiable under an idealized model.

A sparse design can be useful when the main goal is population coverage or when prior information supports a simpler variance structure. A dense design can be preferable for learning trajectory shape and time-varying random-effect signatures. Replicated occasions are particularly valuable when between-occasion variability is a target. The alternatives are therefore about allocation and scientific purpose, not a universal ranking.

The covariance calculations here use an additive local representation and simple independence assumptions. In a nonlinear model, the relationship between random effects and observations may vary across time and concentration, and the sensitivity vectors may change with parameters. Residual variance may also vary with the prediction, and residuals may be correlated. Those features require their own model specification; they do not remove the basic design principle that a component is learned through the patterns of observations that share it.

Common Mistake

Pitfall: “There are hundreds of subjects, so the model can separate subject, occasion, and residual variance.” A large subject count improves information across subjects, but if each subject contributes only one observation, the design supplies no within-subject covariance contrast. The correction is to distinguish sample size from replication structure: component separation requires observation patterns that share some random effects and not others.

Check Your Understanding

Answer each question using the covariance-sharing logic in the tutorial. Brief solutions follow the questions.

  1. In a random-intercept model, what components contribute to the covariance of two distinct observations from the same subject and occasion?
  2. Each subject has one observation on each of two occasions. Under the stated independence assumptions, which covariance component can cross-occasion pairs inform directly, and which component cannot be separated from residual variance using those pairs alone?
  3. A design collects many time points within each subject but only one occasion per subject. What variability source remains especially difficult to estimate separately?
  4. In the random-intercept-and-slope example, calculate the subject covariance between observations at 2 hours and 5 hours on different occasions, using \(\operatorname{Var}(\eta_{0i})=4\) and \(\operatorname{Var}(\eta_{1i})=0.04\), with independent intercept and slope effects.

Solutions. 1. Both the subject and occasion components contribute: \(\tau_S^2+\tau_O^2\). Residual error does not contribute to covariance between distinct observations under the independence assumption. 2. Cross-occasion pairs inform the shared subject component directly. They do not share an occasion effect, and without within-occasion replication the occasion component cannot be separated from residual variance using only these pairs and individual variances. 3. Between-occasion variability remains difficult to estimate because there are no repeated occasions within subjects to show occasion-to-occasion variation. 4. The shared subject covariance is \(4+(2)(5)(0.04)=4+0.4=4.4\) concentration-squared units; the observations are on different occasions, so no occasion covariance is added.