Tutorials › Pharmacometric Workflows and Reproducible Modeling › Interindividual Random Effects and Covariance Structures

Software Landscape and Interoperability · Tutorial 204 of 399

Interindividual Random Effects and Covariance Structures

Represent clearance and volume variability consistently across four tools, and check whether the chosen covariance structure is valid and interpretable.

Intermediate 12 min read

What You'll Learn

  • Distinguish exponential effects on a log scale from additive effects on the parameter scale.
  • Interpret random-effect variances, covariances, and correlations, including their units.
  • Translate a two-parameter covariance structure across NONMEM, Monolix, nlmixr2, and mrgsolve.
  • Check positive semidefiniteness and recognize singular covariance matrices.
  • Diagnose common translation errors involving parameterization, ordering, and simulation.

Why Random-Effect Translation Needs Care

Interindividual random effects describe how an individual’s model parameters differ from typical values. Their mathematical meaning must remain fixed when a model is represented in different software. A line of code can look plausible while changing the scale of the effect, the order of the parameters, or the covariance structure. These changes affect simulated individual clearances and volumes, even when the population values appear unchanged.

This tutorial uses clearance \(CL\) and volume \(V\) to compare exponential and additive effects in NONMEM, Monolix, nlmixr2, and mrgsolve. The focus is the mapping of the random effects and their covariance—not the software’s estimation algorithms or residual error models. In particular, mrgsolve is used here as a simulation tool: it can apply random effects, but it does not estimate their population distribution.

Definition: An interindividual random effect is a subject-specific random deviation from a population parameter. In this tutorial, \(\eta_{CL}\) and \(\eta_V\) denote the effects on clearance and volume. A common assumption is that the vector of effects has a multivariate normal distribution with mean zero and covariance matrix \(\Omega\): \((\eta_{CL},\eta_V)^\mathsf{T}\sim N(\mathbf{0},\Omega)\). The diagonal entries of \(\Omega\) are variances, and its off-diagonal entry is a covariance.

Two Parameterizations, Two Scales

With exponential effects, the individual parameters are positive when their population values are positive:

$$ CL_i=CL_{\mathrm{pop}}\exp(\eta_{CL,i}), \qquad V_i=V_{\mathrm{pop}}\exp(\eta_{V,i}). $$

The effects are dimensionless because they enter an exponential. If each effect has mean zero on the log scale, \(\exp(\eta)\) has median 1, not arithmetic mean 1. Thus \(CL_{\mathrm{pop}}\) and \(V_{\mathrm{pop}}\) are the medians of the corresponding individual parameter distributions under this model. For example, if \(\eta\sim N(0,\omega^2)\), then \(E[\exp(\eta)]=\exp(\omega^2/2)\). The distinction matters when describing typical values or comparing parameterizations.

With additive effects, the model instead is:

$$ CL_i=CL_{\mathrm{pop}}+\eta_{CL,i}, \qquad V_i=V_{\mathrm{pop}}+\eta_{V,i}. $$

Here the effects have the same units as the parameters: \(\eta_{CL}\) is in units of clearance, and \(\eta_V\) is in units of volume. If the effects have mean zero, the population parameters are also the means of the individual parameter distributions. But additive normal effects do not guarantee positive individual parameters. Whether that is acceptable depends on the model and the range of variability; negative clearance or volume is generally not physically meaningful.

Key distinction: An exponential effect is additive on the log-parameter scale and multiplicative on the parameter scale. An additive effect is additive on the parameter scale. The same numerical variance cannot be copied between these formulations: the exponential-effect variance is dimensionless, while additive-effect variances carry squared parameter units.

Covariance, Correlation, and Validity

For two effects, write the covariance matrix as:

$$ \Omega= \begin{pmatrix} \omega_{CL}^2 & \omega_{CL,V}\\ \omega_{CL,V} & \omega_V^2 \end{pmatrix}. $$

The correlation is the covariance divided by the product of the standard deviations:

$$ \rho_{CL,V}=\frac{\omega_{CL,V}}{\sqrt{\omega_{CL}^2}\sqrt{\omega_V^2}}. $$

A covariance matrix must be positive semidefinite. For this two-effect case, that requires nonnegative diagonal entries and a nonnegative determinant:

$$ \omega_{CL}^2\geq 0,\qquad \omega_V^2\geq 0,\qquad \omega_{CL}^2\omega_V^2-\omega_{CL,V}^2\geq 0. $$

These conditions imply that the correlation is between \(-1\) and \(1\) when both variances are positive. A determinant of zero is allowed: it means the matrix is singular, so the effects lie on a lower-dimensional relationship rather than varying freely in two dimensions. A strictly positive determinant gives a positive-definite matrix.

Worked Example: Checking a Clearance–Volume Covariance Matrix

Suppose hypothetical exponential effects have \(\omega_{CL}^2=0.0400\), \(\omega_V^2=0.0900\), and \(\omega_{CL,V}=0.0120\). The standard deviations are \(\sqrt{0.0400}=0.200\) and \(\sqrt{0.0900}=0.300\). The effects are dimensionless, so these variances and covariance are dimensionless too.

The determinant is:

$$ (0.0400)(0.0900)-(0.0120)^2 =0.00360-0.000144 =0.003456. $$

It is positive and both variances are positive, so the matrix is positive definite. The correlation is \(0.0120/(0.200\times0.300)=0.200\). Thus the hypothetical effects have a positive, moderate correlation, and their joint covariance matrix is valid.

Representing the Same Effects in Four Tools

A translation should preserve four things: the scale of each effect, the order of the effects, the numerical entries of the covariance matrix, and the interpretation of the population parameters. The following examples use the exponential model above. The values are hypothetical; let \(CL_{\mathrm{pop}}=5\) L/h and \(V_{\mathrm{pop}}=50\) L, with the covariance entries from the preceding example.

  • NONMEM: A typical parameter block assigns \(CL=THETA(1)\cdot EXP(ETA(1))\) and \(V=THETA(2)\cdot EXP(ETA(2))\). A two-effect covariance block is specified with `$OMEGA BLOCK(2)`, followed by the lower-triangular entries in order: \(0.0400\), then \(0.0120\) and \(0.0900\). The first and second ETAs must correspond to clearance and volume, respectively.
  • Monolix: In an individual model, lognormal parameter definitions express the same multiplicative model. For example, `CL = {distribution=logNormal, prediction=CL_pop, sd=omega_CL}` and the analogous definition for \(V\) assign population predictions and log-scale standard deviations. The correlation between the associated random effects must also be set in the model’s random-effects configuration; defining two lognormal marginals alone does not specify a nonzero correlation. Check that the configured correlation and standard deviations imply the intended covariance matrix.
  • nlmixr2: In an initialization block, `eta.cl + eta.v ~ c(0.0400, 0.0120, 0.0900)` specifies the two variances and their covariance in that order. The model expressions `cl <- exp(tcl + eta.cl)` and `v <- exp(tv + eta.v)` use log population parameters \(tcl\) and \(tv\). To make the population values 5 L/h and 50 L, initialize \(tcl=\log(5)\) and \(tv=\log(50)\).
  • mrgsolve: The model can declare the same block using `$OMEGA @block` and lower-triangular entries \(0.0400\), then \(0.0120\) and \(0.0900\); model code can apply `ETA(1)` and `ETA(2)` in the exponential expressions. For simulation, ensure that the individual ETAs supplied or generated from this block use the same ordering. Declaring the block does not make mrgsolve an estimation tool.

Software syntax and project configuration are not interchangeable. For example, a Monolix model that defines the two marginal distributions but leaves their correlation at zero does not represent the full matrix above. Likewise, entering the off-diagonal value in the wrong position in a software block can change which parameters are correlated.

Worked Example: Calculating Individual Parameters Under Exponential Effects

For a hypothetical individual, suppose \(\eta_{CL}=0.100\) and \(\eta_V=-0.150\). With \(CL_{\mathrm{pop}}=5\) L/h and \(V_{\mathrm{pop}}=50\) L:

$$ CL_i=5\exp(0.100)=5(1.10517)=5.526\ \mathrm{L/h}, $$
$$ V_i=50\exp(-0.150)=50(0.860708)=43.04\ \mathrm{L}. $$

Both values remain positive. This calculation does not claim that the two effects are independent: the covariance matrix governs their joint distribution across individuals. For one specified pair of effects, the parameter calculations use each effect’s value directly.

Worked Example: Translating Additive Effects and Tracking Units

Now consider a separate hypothetical additive model with the same population values. Let one individual have \(\eta_{CL}=0.400\) L/h and \(\eta_V=-3.00\) L. Then:

$$ CL_i=5.00\ \mathrm{L/h}+0.400\ \mathrm{L/h}=5.40\ \mathrm{L/h}, \qquad V_i=50.0\ \mathrm{L}-3.00\ \mathrm{L}=47.0\ \mathrm{L}. $$

For additive effects, a hypothetical covariance matrix might have variances \(0.160\;(\mathrm{L/h})^2\) and \(9.00\;\mathrm{L}^2\), with covariance \(0.600\;(\mathrm{L/h})\mathrm{L}\). Its correlation is \(0.600/(\sqrt{0.160}\sqrt{9.00})=0.600/(0.400\times3.00)=0.500\). Copying the exponential model’s dimensionless covariance values into this additive model would be a unit and model-scale error.

Short Justification: Why the Determinant Check Works

For a symmetric two-by-two matrix with entries \(a\), \(c\), and \(b\), written \(\begin{pmatrix}a&c\\c&b\end{pmatrix}\), the quadratic form for any vector \((x,y)^\mathsf{T}\) is \(ax^2+2cxy+by^2\). Positive semidefiniteness means this expression is nonnegative for every \(x,y\). When \(a>0\), completing the square gives:

$$ ax^2+2cxy+by^2 =a\left(x+\frac{c}{a}y\right)^2+ \left(b-\frac{c^2}{a}\right)y^2. $$

The first term is nonnegative. The second is nonnegative for every \(y\) exactly when \(b-c^2/a\geq0\), or \(ab-c^2\geq0\). If \(a=0\), positive semidefiniteness requires \(c=0\), since otherwise choosing \(x\) with a suitable sign makes \(2cxy+by^2\) negative for some \(x,y\). This establishes the diagonal-and-determinant check for the two-effect case, including its singular boundary.

Diagnostics, Alternatives, and Common Mistakes

A diagonal covariance matrix assumes zero covariance between the effects; it does not require their estimated variances to be equal. A full block allows nonzero covariance. In some settings, it can be useful to express a block through standard deviations and a correlation, since the correlation is scale-free and easier to compare across parameter units. Regardless of representation, the implied covariance matrix must be valid and the tool must use the same parameter order.

When checking a translation, inspect the implemented equations and the configured random-effects structure—not just the labels in a table. Useful checks include:

  • Confirm that exponential effects are used in the exponent and additive effects are added on the parameter scale.
  • Check the order of clearance and volume effects against every covariance block and simulation input.
  • Verify that the covariance block is positive semidefinite and that its diagonal entries are variances, not standard deviations.
  • Check units for additive variances and covariances, and confirm that exponential effects are dimensionless.
  • For simulation, inspect whether the software is drawing or receiving subject-level effects as intended. A declaration of a distribution and an estimation of that distribution are different tasks.

A common mistake is to enter \(0.200\) and \(0.300\) as the diagonal entries of an \(\Omega\) block because these are the standard deviations. The block requires variances, \(0.200^2=0.0400\) and \(0.300^2=0.0900\). A related error is to copy a covariance without checking the associated parameterization and units.

Another mistake is to reject any matrix whose determinant is zero. For example, the matrix with variances \(0.0400\) and \(0.0900\), and covariance \(0.0600\), has determinant \((0.0400)(0.0900)-(0.0600)^2=0.00360-0.00360=0\). Its diagonal entries are positive, so it is positive semidefinite and valid, but singular; its correlation is \(0.0600/(0.200\times0.300)=1\). It represents perfectly correlated effects, not an invalid covariance matrix. Singularity can nevertheless cause computational or estimation difficulties, so validity alone does not guarantee that a structure is practically suitable.

Finally, the exponential and additive models are not merely two syntaxes for the same assumption. Exponential effects preserve positivity and imply multiplicative differences; additive effects imply constant-scale deviations and can produce implausible negative parameter values. Choose the model that matches the intended scientific and statistical assumptions, then translate that model faithfully.

Check Your Understanding

Answer each question using the parameterization and units specified.

  1. In an exponential model, what are the units of \(\eta_{CL}\), and why?
  2. For an additive clearance effect, if \(CL_{\mathrm{pop}}=6.0\) L/h and \(\eta_{CL}=-0.5\) L/h, what is the individual clearance?
  3. A covariance matrix has variances \(0.0400\) and \(0.0900\), and covariance \(0.0600\). Is it valid, and what is its correlation?
  4. Why does a Monolix model defining two lognormal marginals not, by itself, establish a nonzero correlation between their random effects?

Solutions. (1) It is dimensionless because it enters the exponent. (2) \(CL_i=6.0-0.5=5.5\) L/h. (3) Yes: the determinant is \((0.0400)(0.0900)-(0.0600)^2=0\), so the matrix is positive semidefinite and valid, but singular; its correlation is \(0.0600/(0.200\cdot0.300)=1\). (4) Marginal distributions specify each effect separately; their joint dependence must also be configured. Without that joint specification, the intended nonzero covariance is not guaranteed.

Clinical Biostats