Tutorials › Nonlinear Mixed-Effects Models (NLME) › Subject-Level Effects Across Repeated Observations

The Hierarchical Model · Tutorial 102 of 797

Subject-Level Effects Across Repeated Observations

You will learn why a subject-level random effect is drawn once for each subject and how repeated observations vary around predictions based on that shared effect.

Intermediate 10 min read

What You'll Learn

  • Write a repeated-observation NLME model with one subject-level parameter realization.
  • Distinguish a shared subject effect from record-specific departures around predictions.
  • Explain why a subject’s likelihood combines records conditional on the same random effect.
  • Calculate predictions for several records using one shared parameter value.
  • Recognize when a changing subject effect or systematic trajectory mismatch calls for model review.

One Subject, One Subject-Level Realization

A subject measured many times contributes a trajectory, not a collection of unrelated people. In a standard NLME model, the subject-specific parameter values that shape that trajectory are shared across the subject’s records. The model prediction can change from record to record because the time or other inputs change; the underlying subject-specific parameter realization does not get redrawn at every measurement.

This distinction is central to the hierarchy. A subject’s random effect represents a departure associated with that subject. The observation-level component represents how a particular recorded value may depart from the model prediction. Here we focus on how the subject-level realization is carried across repeated records; the details of distinguishing sources of variability are considered separately.

Definition: Let \(i\) index subjects and \(j\) index records within subject \(i\). A standard subject-level NLME model can be written as $$ \theta_i=g(\theta_{\mathrm{pop}},x_i,\eta_i), \qquad y_{ij}=h(t_{ij},\theta_i)+\epsilon_{ij}. $$ Here \(\theta_{\mathrm{pop}}\) denotes population parameters, \(x_i\) denotes subject-level covariates, and \(\eta_i\) is the subject-level random-effect vector. One realization of \(\eta_i\) determines \(\theta_i\) and is used for every record \(j\) from subject \(i\). The prediction \(h(t_{ij},\theta_i)\) can vary with the record’s inputs, while \(\epsilon_{ij}\) denotes the observation’s departure from that prediction.

For a simple standard formulation, assume that subject effects are independently drawn across subjects from a specified distribution, often a multivariate normal distribution with mean zero and covariance matrix \(\Omega\). Conditional on the subject effect and the model inputs, residuals may be assumed to have mean zero and to be independent across records, with a specified distribution and variance structure. These are modeling assumptions, not universal properties of repeated measurements. The model must also specify whether inputs such as covariates are fixed for the subject or vary by record.

The key indexing is consequential: \(\eta_i\) has a subject index but no record index. If it were instead written \(\eta_{ij}\), the model would describe a different source of variation that can change from record to record. A subject-level effect is not a fresh random draw every time a sample is taken.

Why the Effect Is Shared

The shared effect expresses the model’s claim about what persists within a subject. For example, if a subject’s clearance is higher than the population value, that parameter affects all their predicted concentrations, not just the concentration at one chosen sampling time. The predictions still differ over time because the model’s time-dependent function is evaluated at different times.

The likelihood makes the same point. Suppose, for illustration, that residuals are conditionally independent given \(\eta_i\), with conditional density \(f(y_{ij}\mid\eta_i)\). The likelihood contribution from subject \(i\), before integrating over the random effect, is the product of the record-level densities using the same \(\eta_i\). To obtain the marginal contribution, average that product over the distribution of \(\eta_i\):

$$ L_i=\int \left\{\prod_{j=1}^{n_i} f(y_{ij}\mid\eta_i)\right\}p(\eta_i)\,d\eta_i. $$

The order matters. One subject-level value must account for the subject’s records jointly. Integrating each record’s density over a separately redrawn effect would instead correspond to a different model, in which the subject’s parameter could change independently from one record to the next.

Justification: A subject-level random effect is defined to represent a latent characteristic of subject \(i\). Once a value \(\eta_i\) is assigned, the parameter equation gives one \(\theta_i\). Substituting that same \(\theta_i\) into \(h(t_{ij},\theta_i)\) for each \(j\) preserves the subject’s parameter across records. The record-specific time \(t_{ij}\) changes the prediction, not the assigned parameter. This is why the conditional likelihood multiplies record contributions before averaging over \(\eta_i\).

Worked Predictions Along a Subject’s Trajectory

Worked Example: One Clearance Value Across Three Samples

Consider a hypothetical one-compartment intravenous bolus model. The population typical clearance is \(5\ \mathrm{L/h}\). For one hypothetical subject, let the exponential random effect be \(\eta_i=\ln(1.2)\), and let volume be \(40\ \mathrm{L}\). A \(400\ \mathrm{mg}\) dose is sampled at 1, 4, and 8 hours. Use the model \(CL_i=5\exp(\eta_i)\), \(k_i=CL_i/V_i\), and \(C_i(t)=D/V_i\exp(-k_i t)\).

First calculate the subject’s clearance once:

$$ CL_i=5\exp\{\ln(1.2)\}=5(1.2)=6\ \mathrm{L/h}, \qquad k_i=\frac{6\ \mathrm{L/h}}{40\ \mathrm{L}}=0.15\ \mathrm{h}^{-1}. $$

The initial concentration is \(D/V_i=400\ \mathrm{mg}/40\ \mathrm{L}=10\ \mathrm{mg/L}\). Use the same \(CL_i\), \(k_i\), and volume at all three sampling times:

$$ \begin{aligned} C_i(1)&=10\exp(-0.15\times1)=8.607\ \mathrm{mg/L},\\ C_i(4)&=10\exp(-0.15\times4)=5.488\ \mathrm{mg/L},\\ C_i(8)&=10\exp(-0.15\times8)=3.012\ \mathrm{mg/L}. \end{aligned} $$

Suppose the hypothetical observed concentrations are \(8.9\), \(5.1\), and \(3.2\ \mathrm{mg/L}\), respectively. The observed-minus-predicted departures are \(0.293\), \(-0.388\), and \(0.188\ \mathrm{mg/L}\) (rounded). The predictions differ because time differs; all three use the same subject-specific clearance. It would not be consistent with this subject-level model to use a new clearance draw for each sample.

Records Are Combined Under One Effect

The following calculation illustrates how repeated records inform a subject’s contribution to the model under one fixed effect realization. Continue the hypothetical example, and suppose the residuals are conditionally normal with standard deviation \(\sigma=0.4\ \mathrm{mg/L}\). This normal, constant-variance residual assumption is used only for this calculation. The conditional log likelihood for the three observations, given the calculated subject effect, is

$$ \ell_i(\eta_i) =-3\ln\!\left(0.4\sqrt{2\pi}\right) -\frac{(0.293)^2+(-0.388)^2+(0.188)^2}{2(0.4)^2} \approx -0.857. $$

The squared departures sum to approximately \(0.2718\ (\mathrm{mg/L})^2\), and \(2(0.4)^2=0.32\ (\mathrm{mg/L})^2\). Thus the residual term is approximately \(0.849\); the normalizing term is approximately \(-0.00794\). Their sum is approximately \(-0.857\). This is a conditional log density for the three records using the same \(\eta_i\), not a probability that the subject has that effect. In model fitting, the contribution is then averaged over possible subject effects as in the likelihood expression above.

Worked Example: Comparing Two Subjects at the Same Sampling Times

Suppose two hypothetical subjects have the same volume, \(40\ \mathrm{L}\), and receive the same \(400\ \mathrm{mg}\) intravenous bolus. Their population typical clearance is \(5\ \mathrm{L/h}\). Subject A has \(\eta_A=\ln(1.2)\); subject B has \(\eta_B=\ln(0.8)\). Calculate each subject’s clearance and predictions at 1 and 4 hours.

For subject A, \(CL_A=5\exp\{\ln(1.2)\}=6\ \mathrm{L/h}\), so \(k_A=6/40=0.15\ \mathrm{h}^{-1}\). The predictions are \(C_A(1)=10\exp(-0.15)=8.607\ \mathrm{mg/L}\) and \(C_A(4)=10\exp(-0.60)=5.488\ \mathrm{mg/L}\).

For subject B, \(CL_B=5\exp\{\ln(0.8)\}=4\ \mathrm{L/h}\), so \(k_B=4/40=0.10\ \mathrm{h}^{-1}\). The predictions are \(C_B(1)=10\exp(-0.10)=9.048\ \mathrm{mg/L}\) and \(C_B(4)=10\exp(-0.40)=6.703\ \mathrm{mg/L}\).

Each subject has one clearance value across both times, but the subjects have different values. Each prediction also changes with time. If a record is missing, the effect assigned to the subject does not change: it remains the same for the subject’s available records.

Model Checks, Alternatives, and Limitations

A shared subject-level effect is a structural assumption, not a guarantee that every observed trajectory will match the model well. Review predictions and observed records in their subject and time context. A pattern in which a subject is consistently above or below predictions may suggest that the subject-level parameter structure needs review. A pattern that changes systematically over time may indicate that the assumed time course, covariates, or residual assumptions are inadequate. A single unusual record does not, by itself, establish that the subject’s parameter changed.

Check the data structure as well as the plots. Records must be assigned to the correct subject, and times and covariates must be attached to the correct records. If a software implementation accidentally treats each record as a new subject, it cannot preserve the intended shared effect. If it reuses one subject’s effect for a different subject, it makes the opposite indexing error.

The main alternatives answer different scientific questions. A model with only population parameters and no subject-level random effects gives subjects with the same covariates the same parameter values. A model with record-level random effects allows effects to change across records rather than remain subject-specific. If physiology or treatment changes over time, a static subject-level parameter may be insufficient; a model with explicitly time-varying inputs or a distinct occasion-level effect may be considered. These alternatives should be chosen for the scientific structure of the data, not as interchangeable ways to fit the same assumption.

The standard model also has limits. It does not imply that the subject’s biology is literally constant in every respect, only that the specified subject-level parameter is treated as constant over the records represented by that effect. The assumed residual distribution and conditional independence may also fail in practice. Systematic trajectory patterns, poor predictive performance, or implausible parameter estimates are reasons to investigate model structure and data quality rather than to redraw a subject effect record by record without justification.

Common pitfall: “There are five samples, so this subject gets five random-effect draws.” That reasoning confuses the number of observations with the level at which the effect is defined. In a subject-level model, one draw \(\eta_i\) determines \(\theta_i\), and that parameter is used for all five records. The records can still have different predictions and different observation-level departures.

Check Your Understanding

Answer each question, then compare with the brief solutions.

  1. In the model \(y_{ij}=h(t_{ij},\theta_i)+\epsilon_{ij}\), which quantities are indexed by subject and record, and which parameter is shared across a subject’s records?
  2. A subject has \(\eta_i=\ln(1.1)\) and a typical clearance of \(8\ \mathrm{L/h}\). Under an exponential random-effect model, calculate the subject’s clearance. Is it recalculated for each record?
  3. Why does a subject’s conditional likelihood combine all record densities before integrating over \(\eta_i\)?
  4. A subject has observations at 1 and 5 hours, but the 3-hour sample is missing. Does the missing record cause a new subject-level effect to be assigned?
  5. What modeling concern might be raised by a systematic time pattern in observed-minus-predicted values, and why is redrawing a subject effect for each record not automatically the solution?

Solutions. (1) \(i\) indexes subjects and \(j\) indexes records; \(t_{ij}\), \(y_{ij}\), and \(\epsilon_{ij}\) are record-indexed, while \(\eta_i\) and the resulting \(\theta_i\) are shared within subject. (2) \(CL_i=8\exp\{\ln(1.1)\}=8.8\ \mathrm{L/h}\). That value is used for every record for the subject. (3) All records for that subject are conditioned on the same latent subject effect, so their conditional densities are multiplied and that shared effect is then integrated over once. (4) No. The same \(\eta_i\) applies to the available 1- and 5-hour records. (5) It may indicate a mismatch in the time-course model, inputs, or residual assumptions. A record-by-record random effect changes the model’s scientific meaning and is not justified merely by a poor trajectory fit.