Why Simulate Between-Occasion Variability?
A subject’s parameter may change from one treatment period or occasion to another, even when that subject’s stable characteristics remain the same. For example, a clearance parameter may have a persistent subject component and an additional occasion-specific component. A simulation that includes only the persistent component gives the same parameter on every occasion; one that redraws the entire subject effect for every occasion incorrectly treats the subject as a different person each time.
The essential simulation rule is therefore simple but consequential: draw the subject-level random effect once per subject, draw a new occasion-level random effect for each occasion, and combine them on the scale specified by the model. The resulting profiles vary both between subjects and, within a subject, between occasions.
Exponentiating gives \(\theta_{ij}=\theta_{\mathrm{typ}}\exp(\eta_i+\kappa_{ij})\). This specifies a lognormal parameter distribution: effects are additive on the log scale and multiplicative on the parameter scale. The zero-mean assumption applies to the random effects on the log scale. Consequently, \(\theta_{\mathrm{typ}}\) is the median of the parameter distribution, not generally its arithmetic mean.
These assumptions are a model to be used when supported by the fitted model and the scientific design, not a universal description of every repeated-occasion data set. In particular, independent occasion effects imply no additional correlation between different occasions after accounting for the shared subject effect. If the fitted model specifies correlations among occasion effects or among several parameters, simulation must preserve those specified dependencies rather than replacing them with independent scalar draws.
How the Simulation Separates the Two Sources of Variation
For each simulated subject, first draw one \(\eta_i\). Keep that draw fixed across all occasions for that subject. Then draw a separate \(\kappa_{ij}\) for each occasion. Combine the effects on the model’s specified scale, calculate the occasion-specific parameter, and pass it to the structural model at the relevant occasion. If simulating observed records rather than the underlying model profiles, add residual error according to the residual model as a separate step.
For subject \(i\), draw \(\eta_i\) from the between-subject distribution. Store it once; do not redraw it for each occasion.
For each occasion \(j\), draw \(\kappa_{ij}\) from the between-occasion distribution, using the fitted dependence structure if the effects are not independent.
Combine \(\eta_i\) and \(\kappa_{ij}\) on the model scale, transform if required, and evaluate the structural model for that occasion’s design and covariates.
Worked Example: Generating Profiles for Two Occasions
Consider a hypothetical one-compartment bolus model with concentration \(C_{ij}(t)=2.5\exp(-k_{ij}t)\), where concentration is in mg/L, time is in hours, and the fixed amplitude \(2.5\) mg/L is held constant. Let the typical elimination rate constant be \(k_{\mathrm{typ}}=0.10\ \mathrm{h}^{-1}\). For one simulated subject, suppose the shared effect is \(\eta_i=0.08\), and the two occasion effects are \(\kappa_{i1}=0.12\) and \(\kappa_{i2}=-0.06\). These are hypothetical draws, not measurements from a study.
The combined log deviations are \(0.08+0.12=0.20\) on occasion 1 and \(0.08-0.06=0.02\) on occasion 2. Thus
The same subject effect, \(0.08\), appears in both parameters; only the occasion effect changes. At \(t=4\) hours, the predicted concentrations are
At \(t=8\) hours, the corresponding values are
The different occasion-specific rate constants generate different concentration-time profiles for the same subject. These are structural predictions; they do not include residual observation error. If observations are required, residual error is added according to the specified residual model, not by altering the occasion random effect.
Dependence Across Occasions
The shared subject effect creates dependence between the subject’s occasion-specific log parameters. Let \(z_{ij}=\log(\theta_{ij}/\theta_{\mathrm{typ}})=\eta_i+\kappa_{ij}\). Under the independent, zero-mean assumptions above, the variance on any one occasion and the covariance between two distinct occasions \(j\ne \ell\) follow directly from variance rules:
The last equality holds because the two occasion effects are independent of each other and of \(\eta_i\), so their cross-covariances are zero. Therefore the correlation between two distinct occasion-specific log parameters is \(\omega_B^2/(\omega_B^2+\omega_O^2)\), when the total variance is positive. Occasion variability increases the spread within an occasion but does not erase the correlation induced by a shared subject effect.
Worked Example: Checking the Implied Cross-Occasion Correlation
Suppose a hypothetical fitted model has between-subject standard deviation \(\omega_B=0.20\) and between-occasion standard deviation \(\omega_O=0.15\) on the log scale. These are standard deviations, so their variances are \(0.20^2=0.0400\) and \(0.15^2=0.0225\).
The variance of the log parameter on one occasion is \(0.0400+0.0225=0.0625\). The covariance between two different occasions for the same subject is \(0.0400\), because only the shared subject effect contributes to that covariance. Thus the log-scale correlation is
So, under this model, two different occasions for the same subject have correlation \(0.6400\) in their log parameters. This is not the correlation between concentrations at arbitrary times: the structural model transforms parameters into concentrations, and that relationship also depends on time, dose, and other model components.
Simulating a Cohort Across Repeated Occasions
A useful implementation represents the subject effects as one draw per subject and the occasion effects as one draw per subject-occasion pair. For \(N\) subjects and \(J\) occasions, this gives \(N\) draws of \(\eta_i\) and \(N\times J\) draws of \(\kappa_{ij}\) under the independent scalar model. The resulting values should be combined by matching each occasion effect to its subject, not by pairing draws in an arbitrary order.
Worked Example: Keeping a Subject Effect Shared
Use the same log-scale model, but now take \(\omega_B=0.20\) and \(\omega_O=0.10\). For one hypothetical subject, suppose the subject draw is \(\eta_i=0.20\), with occasion draws \(\kappa_{i1}=0.10\) and \(\kappa_{i2}=-0.10\). Relative to \(\theta_{\mathrm{typ}}\), the two simulated parameters are
Both occasions retain the subject’s positive shared deviation. If instead the subject effect were mistakenly redrawn as \(-0.20\) for occasion 2, the second parameter would be \(\theta_{\mathrm{typ}}\exp(-0.20-0.10)=0.7408\theta_{\mathrm{typ}}\). That result would reflect a different simulated subject effect, not the intended within-subject occasion change. A draw like \(-0.20\) can of course occur for another subject; the error is assigning a new subject-level draw to the same subject’s later occasion.
This distinction is also visible in the covariance. With the stated standard deviations, the correct log-parameter variance per occasion is \(0.20^2+0.10^2=0.0500\), and the covariance across two occasions is \(0.20^2=0.0400\). If the subject effect is incorrectly redrawn independently each occasion, that cross-occasion covariance is lost: two independent subject-effect draws do not represent the same persistent subject characteristic.
Assumptions, Diagnostics, and Alternatives
Before simulating, verify that the fitted model actually contains a between-occasion random effect and identify its scale and distribution. A model containing only a subject-level random effect does not justify adding occasion deviations merely because repeated occasions are present. Conversely, if the fitted model specifies occasion effects, omitting them will understate modeled within-subject variation across occasions.
- Check the indexing. There should be one subject effect per simulated subject and one occasion effect per subject-occasion pair. A subject’s shared draw should be identical in the calculations for all that subject’s occasions.
- Check the scale. If a parameter is modeled on the log scale, add the random effects on that scale and exponentiate afterward. Adding a normal draw directly to a positive parameter is a different model.
- Check the dependence assumptions. Independent occasion effects are appropriate only when that is the model’s specified covariance structure. A shared subject effect induces dependence even when the occasion effects themselves are independent.
- Check the simulated pattern. Across many simulated subjects, occasion-specific log parameters should display variation within subjects and correlation across occasions consistent with the model’s variance components. A lack of within-subject variation may indicate that occasion effects were omitted or reused; implausibly independent occasions may indicate that subject effects were redrawn.
The main alternative is a model with only between-subject effects. It is simpler and implies that a subject’s random parameter is stable across occasions, apart from any explicitly modeled time-varying covariates or residual variation. A model with occasion effects adds a distinct source of parameter variation. These are not interchangeable descriptions: the choice should follow the model and the scientific question, not convenience in coding.
Between-occasion effects also differ from residual error. An occasion effect changes the underlying model parameter and can therefore alter an entire profile; residual error represents observation-level deviations around the predicted profile. Treating every residual as an occasion effect changes the model’s meaning, while adding both sources is appropriate only when both are specified. The simulated profiles are conditional on the assumed parameter values and distributional structure; this procedure by itself does not account for uncertainty in estimated variance components or establish that the assumed distributions are adequate.
Check Your Understanding
Answer each question using the stated log-scale model and assumptions. Solutions are provided below.
- If \(\omega_B=0.30\) and \(\omega_O=0.40\), what is the variance of a log parameter on one occasion, and what is the covariance between two different occasions for the same subject?
- A simulated subject has \(\eta_i=-0.10\), with \(\kappa_{i1}=0.05\) and \(\kappa_{i2}=0.15\). What are the two parameter values relative to \(\theta_{\mathrm{typ}}\)?
- Why is it incorrect to draw a fresh \(\eta_i\) for every occasion when simulating the same subject?
- Does an occasion-level random effect represent residual observation error? Explain the distinction.
Solutions. 1. The variance is \(0.30^2+0.40^2=0.09+0.16=0.2500\). The covariance across distinct occasions is \(0.30^2=0.0900\). 2. The first relative parameter is \(\exp(-0.10+0.05)=\exp(-0.05)\approx0.9512\); the second is \(\exp(-0.10+0.15)=\exp(0.05)\approx1.051\). 3. The subject effect is shared across occasions by definition. Redrawing it independently removes the intended persistent component and changes the cross-occasion covariance. 4. No. An occasion effect changes the underlying parameter for that occasion and can alter its predicted profile; residual error describes deviations of individual observations from the model-predicted values.