Tutorials › Nonlinear Mixed-Effects Models (NLME) › Simulating Parameters With Lognormal Random Effects

Simulation From Fitted Models · Tutorial 682 of 797

Simulating Parameters With Lognormal Random Effects

Transform normal random-effect draws into positive individual parameters and distinguish their typical values from their arithmetic means and variability.

Intermediate 10 min read

What You'll Learn

  • Transform a normal random effect into a positive individual parameter using an exponential model
  • Derive the individual parameter’s median, arithmetic mean, variance, and coefficient of variation
  • Calculate lognormal quantiles and interpret them in parameter units
  • Simulate individual parameters from hypothetical fitted-model values
  • Check simulated draws and identify common scale and interpretation errors

Why Lognormal Random Effects Need Careful Interpretation

In an NLME model, an individual parameter such as clearance or volume may need to be positive. A normal random effect can enforce positivity by entering the parameter through an exponential transformation. The resulting parameter is lognormally distributed: its distribution is asymmetric, and its typical value is not generally its arithmetic mean. These distinctions matter when generating individual parameters from a fitted model and summarising the resulting simulated population.

This tutorial focuses on the distribution induced by that transformation. It treats the population parameters as fixed at their fitted values and simulates variability between individuals. It does not include uncertainty in the fitted population parameters or residual error in observations.

Definition: For a positive parameter, write the individual value for individual \(i\) as \(\theta_i=\theta_{\mathrm{pop}}\exp(\eta_i)\), where \(\theta_{\mathrm{pop}}>0\) is the population typical value and \(\eta_i\sim N(0,\omega^2)\) is a normal random effect with mean zero and variance \(\omega^2\). Then \(\log(\theta_i)\sim N(\log(\theta_{\mathrm{pop}}),\omega^2)\), so \(\theta_i\) has a lognormal distribution. The quantity \(\omega\) is the standard deviation of the random effect on the log scale.

The model assumes that \(\theta_{\mathrm{pop}}\) is positive, that the random effect is normally distributed with mean zero and variance \(\omega^2\), and that the exponential relationship is the specified model for individual variability. With \(\omega>0\), every simulated \(\theta_i\) is positive, and the distribution is generally right-skewed. If \(\omega=0\), there is no between-individual variability and every individual has \(\theta_i=\theta_{\mathrm{pop}}\).

Median, Mean, and Variability

Because \(\eta_i\) has median zero, the median individual parameter is \(\theta_{\mathrm{pop}}\). In this model, the population typical value is therefore the median of the individual-parameter distribution, not its arithmetic mean. The mean is larger whenever \(\omega>0\), a consequence of the curvature of the exponential function.

$$ \begin{aligned} \operatorname{Median}(\theta_i) &= \theta_{\mathrm{pop}},\\ E(\theta_i) &= \theta_{\mathrm{pop}}\exp(\omega^2/2),\\ \operatorname{Var}(\theta_i) &= \theta_{\mathrm{pop}}^2\exp(\omega^2)\{\exp(\omega^2)-1\},\\ \operatorname{CV}(\theta_i) &= \frac{\sqrt{\operatorname{Var}(\theta_i)}}{E(\theta_i)} =\sqrt{\exp(\omega^2)-1}. \end{aligned} $$

The coefficient of variation (CV) is dimensionless: it is the standard deviation divided by the arithmetic mean. If a CV is reported as a percentage, multiply the displayed ratio by 100. Notice that the CV depends on \(\omega\), not on the size or units of \(\theta_{\mathrm{pop}}\). The mean and standard deviation, in contrast, have the same units as the individual parameter.

Why These Formulas Hold

For a normal random variable \(Z\sim N(0,\omega^2)\), its moment-generating identity is \(E\{\exp(tZ)\}=\exp(t^2\omega^2/2)\). Applying this identity to \(\theta_i=\theta_{\mathrm{pop}}\exp(\eta_i)\) gives the mean directly. Applying it to \(\theta_i^2\) gives the second moment; subtracting the squared mean gives the variance.

$$ \begin{aligned} E(\theta_i) &=\theta_{\mathrm{pop}}E\{\exp(\eta_i)\} =\theta_{\mathrm{pop}}\exp(\omega^2/2),\\ E(\theta_i^2) &=\theta_{\mathrm{pop}}^2E\{\exp(2\eta_i)\} =\theta_{\mathrm{pop}}^2\exp(2\omega^2),\\ \operatorname{Var}(\theta_i) &=E(\theta_i^2)-\{E(\theta_i)\}^2\\ &=\theta_{\mathrm{pop}}^2\{\exp(2\omega^2)-\exp(\omega^2)\}\\ &=\theta_{\mathrm{pop}}^2\exp(\omega^2)\{\exp(\omega^2)-1\}. \end{aligned} $$

Taking the square root of the variance and dividing by the mean cancels \(\theta_{\mathrm{pop}}\) and leaves \(\sqrt{\exp(\omega^2)-1}\). For the median, the exponential is strictly increasing, so the median of \(\exp(\eta_i)\) is \(\exp(0)=1\); multiplying by \(\theta_{\mathrm{pop}}\) gives the stated result. More generally, the \(q\)-quantile, for \(0<q<1\), is

$$ Q_q(\theta_i)=\theta_{\mathrm{pop}}\exp\{\omega\Phi^{-1}(q)\}, $$

where \(\Phi^{-1}(q)\) is the \(q\)-quantile of the standard normal distribution. Thus a central 95% interval for individual parameters under the model is \(\theta_{\mathrm{pop}}\exp(-1.96\omega)\) to \(\theta_{\mathrm{pop}}\exp(1.96\omega)\). It describes the central 95% of the modelled individual-parameter distribution, not uncertainty about the fitted population value.

Worked Example: Transforming Individual Clearance Draws

Suppose a hypothetical fitted model has typical clearance \(\theta_{\mathrm{pop}}=6\) L/h and random-effect standard deviation \(\omega=0.20\). For three illustrative random-effect draws, \(\eta_i=-0.20,\ 0,\ 0.30\), calculate the individual clearances.

Use \(\theta_i=6\exp(\eta_i)\) L/h for each draw:

$$ \begin{aligned} \eta_i=-0.20 &: \quad \theta_i=6\exp(-0.20)=6(0.8187)=4.912\ \text{L/h},\\ \eta_i=0 &: \quad \theta_i=6\exp(0)=6.000\ \text{L/h},\\ \eta_i=0.30 &: \quad \theta_i=6\exp(0.30)=6(1.3499)=8.099\ \text{L/h}. \end{aligned} $$

Each transformed value is positive. The value at \(\eta_i=0\) is the typical value and the median of the modelled population. These three illustrative draws are not expected to have a sample median or mean exactly equal to the population median or mean; finite simulated samples fluctuate.

Worked Example: Calculating the Mean and CV

For a hypothetical parameter with \(\theta_{\mathrm{pop}}=10\) mg/L and \(\omega=0.35\), calculate the median, arithmetic mean, and CV of the individual-parameter distribution.

The median is \(\theta_{\mathrm{pop}}=10\) mg/L. For the mean, \(\omega^2=0.35^2=0.1225\), so

$$ E(\theta_i)=10\exp(0.1225/2) =10\exp(0.06125) =10(1.0632) =10.63\ \text{mg/L}. $$

For the CV,

$$ \operatorname{CV}(\theta_i) =\sqrt{\exp(0.1225)-1} =\sqrt{1.1303-1} =\sqrt{0.1303} =0.3610. $$

Thus the model-implied CV is about 36.1%. The arithmetic mean, 10.63 mg/L, exceeds the median, 10 mg/L; neither result changes the units of the parameter, while the CV has no units.

Worked Example: Choosing Omega for a Target CV

Suppose a hypothetical simulation should have a 25% CV for an individual parameter, and the desired median parameter value is 4.2 L/h. Find the required random-effect standard deviation and the resulting arithmetic mean.

Starting from \(\operatorname{CV}=\sqrt{\exp(\omega^2)-1}\), square both sides and solve for \(\omega\):

$$ \omega=\sqrt{\log(1+\operatorname{CV}^2)} =\sqrt{\log(1+0.25^2)} =\sqrt{\log(1.0625)} =\sqrt{0.06062} =0.2462. $$

The typical value is the median, 4.2 L/h. The arithmetic mean is

$$ E(\theta_i)=4.2\exp(0.2462^2/2) =4.2\exp(0.03031) =4.2(1.0308) =4.329\ \text{L/h}. $$

The result is a log-scale random-effect standard deviation of about 0.2462, not a CV of 0.2462. Substitution into \(\sqrt{\exp(\omega^2)-1}\) returns 0.2500, as required.

Simulating and Checking Parameters

For a single parameter, simulation at fixed fitted population values has a simple sequence: draw \(\eta_i\) from \(N(0,\omega^2)\), then calculate \(\theta_i=\theta_{\mathrm{pop}}\exp(\eta_i)\). For multiple parameters, the random effects may be drawn jointly from a multivariate normal distribution with the fitted covariance structure, then transformed component by component. The transformation preserves positivity, but the correlations on the parameter scale need not equal the correlations on the random-effect scale.

For example, if two log-scale random effects have standard deviations \(\omega_1,\omega_2\) and correlation \(\rho\), then their transformed parameters have correlation

$$ \operatorname{Corr}(\theta_{i1},\theta_{i2}) = \frac{\exp(\rho\omega_1\omega_2)-1} {\sqrt{\{\exp(\omega_1^2)-1\}\{\exp(\omega_2^2)-1\}}}. $$

This follows by calculating the covariance of the exponentials using the joint normal moment-generating function and dividing by their standard deviations. It is a reminder to distinguish the random-effect correlation from the correlation between simulated parameter values.

Useful checks on a simulation include verifying that every transformed parameter is positive, comparing the simulated median with \(\theta_{\mathrm{pop}}\), and comparing the simulated mean and CV with \(\theta_{\mathrm{pop}}\exp(\omega^2/2)\) and \(\sqrt{\exp(\omega^2)-1}\). A finite simulation will not match these theoretical values exactly. Larger samples generally reduce Monte Carlo fluctuation, but a discrepancy that is large relative to sampling variation may indicate an incorrect transformation, an incorrect value of \(\omega\), or a coding error.

Choosing and Interpreting the Distribution

The lognormal model is useful when individual parameters must be positive and variability is naturally described by multiplicative departures from a typical value. A random effect of \(0.1\) multiplies the typical value by \(\exp(0.1)\), while a random effect of \(-0.1\) multiplies it by \(\exp(-0.1)\). These are reciprocal factors, not equal additive changes. By contrast, an additive normal model \(\theta_i=\theta_{\mathrm{pop}}+\eta_i\) describes additive departures and can assign positive probability to negative parameter values. That may be unsuitable for a parameter that must remain positive.

The lognormal model is not automatically appropriate for every positive parameter. Its right-skewness can produce a long upper tail, and the model can imply very large values when \(\omega\) is large. The fitted distribution and the scientific plausibility of its implied range should be examined rather than relying only on the fact that exponentiation guarantees positivity.

Common pitfall: It is incorrect to report \(\theta_{\mathrm{pop}}\) as the arithmetic mean of individual parameters under a lognormal random-effects model. The correction is \(E(\theta_i)=\theta_{\mathrm{pop}}\exp(\omega^2/2)\); \(\theta_{\mathrm{pop}}\) is the median and typical value. A second common error is to use \(\omega\) itself as the CV. The correct CV is \(\sqrt{\exp(\omega^2)-1}\).

Check Your Understanding

Answer each question using the lognormal random-effects model defined above. Solutions follow the questions.

  1. If \(\theta_{\mathrm{pop}}=8\) mg/L and \(\omega=0.30\), what is the median individual parameter?
  2. For \(\omega=0.30\), calculate the model-implied CV.
  3. Explain why exponentiating a normal random effect guarantees positive individual parameters when \(\theta_{\mathrm{pop}}>0\).
  4. What does the central 95% interval for individual parameters describe, and what does it not describe?

Solutions. 1. The median is \(\theta_{\mathrm{pop}}=8\) mg/L. 2. \(\operatorname{CV}=\sqrt{\exp(0.30^2)-1}=\sqrt{\exp(0.09)-1}=\sqrt{0.09417}=0.3069\), or about 30.7%. 3. For every real draw \(\eta_i\), \(\exp(\eta_i)>0\); multiplying by positive \(\theta_{\mathrm{pop}}\) leaves \(\theta_i>0\). 4. The interval describes the central 95% of individual parameter values implied by the model at the stated population values. It is not a confidence interval for \(\theta_{\mathrm{pop}}\) and does not represent uncertainty in its estimate.