Why a Linear-Gaussian Case Is a Useful Benchmark
Marginal likelihoods in nonlinear mixed-effects models generally require integrating over the subject-specific random effects. In a special but important case, that integration is exact: the individual prediction is linear in Gaussian random effects, and the residual errors are Gaussian. The resulting marginal distribution gives a reference calculation against which approximate marginal likelihoods can be checked. It is a benchmark, not a claim that nonlinear pharmacokinetic or pharmacodynamic models are generally Gaussian after marginalization.
The key point is that marginalization changes the covariance as well as removing the random effects from the conditional mean. A random intercept, for example, makes observations from the same individual correlated, even when their residual errors are independent. The covariance expression makes that dependence explicit.
Here \(n_i\) is the number of observations for individual \(i\), and \(q\) is the number of random effects: \(y_i\) and \(\epsilon_i\) are \(n_i\)-vectors, \(X_i\) is \(n_i\) by the number of fixed effects, \(Z_i\) is \(n_i\) by \(q\), and \(b_i\) is a \(q\)-vector. The notation \(N(m,S)\) denotes a multivariate normal distribution with mean \(m\) and covariance \(S\). Independence across individuals is also assumed when the total likelihood is written as a product of subject likelihoods.
Marginal Distribution and Exact Likelihood
Conditionally on \(b_i\), the response is Gaussian with mean \(X_i\beta+Z_i b_i\) and covariance \(R_i\). Since \(Z_i b_i\) is a linear transformation of a Gaussian vector, it is Gaussian with mean zero and covariance \(Z_i\Omega Z_i^\mathsf{T}\). It is independent of \(\epsilon_i\). Adding the two independent Gaussian terms therefore gives the marginal distribution:
Thus the exact marginal density is a multivariate normal density. Defining \(r_i=y_i-X_i\beta\), its log-likelihood contribution is
The three terms have distinct roles: the normalizing constant depends on the number of observations; the log determinant accounts for the scale and shape of the marginal covariance; and the quadratic form measures the residual’s distance from the predicted mean in units of that covariance. The total log-likelihood is \(\ell=\sum_i\ell_i\) when individuals are independent. In estimation, \(V_i\) may depend on unknown variance parameters, so both the log determinant and the quadratic form must be recomputed as those parameters change.
Justifying the Marginalization by Integration
The Gaussian-sum argument establishes the distribution directly. The same result can be checked by evaluating the conditional-likelihood integral, which connects this benchmark to the general definition of a marginal likelihood. For clarity, omit the individual subscript, let \(r=y-X\beta\), and write \(A=\Omega^{-1}+Z^\mathsf{T}R^{-1}Z\) and \(h=Z^\mathsf{T}R^{-1}r\). The terms in the joint exponent that involve \(b\) satisfy
This is completion of the square: expanding the first term on the right produces \(b^\mathsf{T}Ab-2b^\mathsf{T}h+h^\mathsf{T}A^{-1}h\), and the final term cancels the added \(h^\mathsf{T}A^{-1}h\). Integrating the centered Gaussian kernel over \(b\) contributes the factor \((2\pi)^{q/2}|A|^{-1/2}\). Combining it with the conditional and random-effects normalizing constants gives the marginal density. The determinant identity \(|R||\Omega||A|=|R+Z\Omega Z^\mathsf{T}|\) and the inverse identity \(R^{-1}-R^{-1}ZA^{-1}Z^\mathsf{T}R^{-1}=(R+Z\Omega Z^\mathsf{T})^{-1}\) then yield the same determinant and quadratic form as the marginal Gaussian formula above. Positive definiteness ensures these inverses and Gaussian integrals exist.
Worked Calculations
Worked Example: One Observation With a Random Intercept
Suppose a hypothetical individual has one observation under \(y=\mu+b+\epsilon\), where \(\mu=1.000\), \(b\sim N(0,0.0400)\), and \(\epsilon\sim N(0,0.0131)\), independently. The observed value is \(y=2.086278\). Find the marginal variance and log-likelihood contribution.
The marginal mean is \(\mu=1.000\), and the variance is the sum of the independent random-intercept and residual variances: \(V=0.0400+0.0131=0.0531\). The residual from the marginal mean is \(r=2.086278-1.000=1.086278\), so \(r^2\) is approximately \(1.1800\), and \(r^2/V\) is approximately \(1.1800/0.0531=22.222\).
For one observation, the exact log-likelihood is \(\ell=-\frac12\log(2\pi)-\frac12\log(V)-\frac12r^2/V\). Substitution gives \(\ell=-0.918939-\frac12\log(0.0531)-\frac12(22.222)\approx-10.562\).
The log-likelihood is a density-based quantity, not a probability assigned to this exact continuous observation. Its numerical value depends on the measurement units. The calculation illustrates that a residual far from the mean relative to its marginal standard deviation can give a strongly negative log density.
Worked Example: A Second Scalar Likelihood Check
For a separate hypothetical one-observation case, let the marginal mean be \(1.000\), marginal variance \(V=0.0841\), and observation \(y=1.400083\). These values could arise from independent random-effect and residual variances \(0.0625\) and \(0.0216\), respectively. Calculate the log-likelihood.
The residual is \(r=1.400083-1.000=0.400083\). Its square is \(r^2=0.160066406889\), and the standardized quadratic term is \(r^2/V=0.160066406889/0.0841\approx1.9032866\). Therefore, \(\ell=-\frac12\log(2\pi)-\frac12\log(0.0841)-\frac12(1.9032866)\).
Using \(\log(2\pi)\approx1.837877\) and \(\log(0.0841)\approx-2.475749\), the arithmetic is \(\ell\approx-0.918939+1.2378745-0.9516433=-0.6327\). This value is higher than the first example’s log density because the observation is less extreme relative to its marginal variance; it does not mean that the second parameter set is better overall, since these are distinct hypothetical data situations.
Worked Example: Correlation From a Shared Random Intercept
Suppose two hypothetical measurements from one individual follow \(y_j=\mu+b+\epsilon_j\), with \(\mu=0.300\), \(b\sim N(0,0.0400)\), and independent residuals \(\epsilon_j\sim N(0,0.0100)\). The observations are \(y=(0.200,0.400)^\mathsf{T}\). Find the marginal covariance and log-likelihood.
With \(Z=(1,1)^\mathsf{T}\), the covariance is \(V=0.0400ZZ^\mathsf{T}+0.0100I\), or \(V=\begin{pmatrix}0.0500&0.0400\\0.0400&0.0500\end{pmatrix}\). Each marginal variance is \(0.0500\), and the covariance between the observations is \(0.0400\); the resulting correlation is \(0.0400/0.0500=0.8000\). This positive correlation arises from the shared random intercept, despite independent residual errors.
The residual vector is \(r=(-0.100,0.100)^\mathsf{T}\). The determinant is \(|V|=(0.0500)(0.0500)-(0.0400)^2=0.0009000\). For this contrast residual, \(V^{-1}r=(-10.000,10.000)^\mathsf{T}\), so \(r^\mathsf{T}V^{-1}r=2.000\). The two-observation log-likelihood is \(\ell=-\log(2\pi)-\frac12\log(0.0009000)-\frac12(2.000)\approx0.6687\).
A positive log density is possible because a continuous density is not a probability and can exceed one, depending on the scale and units of measurement.
Worked Example: A Random Intercept and Random Slope
Consider two hypothetical observations at times \(t=0\) and \(t=1\), with marginal mean zero and model \(y_j=b_0+t_jb_1+\epsilon_j\). Let \(b_0\) and \(b_1\) be independent with variances \(0.0400\) and \(0.0100\), and let the residual variances be \(0.0100\) at both times, independently. The observed vector is \(y=(0.100,0.000)^\mathsf{T}\).
The random-effects design is \(Z=\begin{pmatrix}1&0\\1&1\end{pmatrix}\), with \(\Omega=\begin{pmatrix}0.0400&0\\0&0.0100\end{pmatrix}\). Multiplication gives \(Z\Omega Z^\mathsf{T}=\begin{pmatrix}0.0400&0.0400\\0.0400&0.0500\end{pmatrix}\), and adding the residual covariance gives \(V=\begin{pmatrix}0.0500&0.0400\\0.0400&0.0600\end{pmatrix}\). The determinant is \((0.0500)(0.0600)-(0.0400)^2=0.001400\). Its inverse is \(V^{-1}=(1/0.001400)\begin{pmatrix}0.0600&-0.0400\\-0.0400&0.0500\end{pmatrix}\), so \(y^\mathsf{T}V^{-1}y=0.0100(0.0600/0.001400)=0.4286\).
Thus \(\ell=-\log(2\pi)-\frac12\log(0.001400)-\frac12(0.4286)\approx1.233\). This example shows how the design matrix carries time-varying random effects into the covariance, including the covariance between measurements.
Assumptions, Diagnostics, and Scope
The exact result relies on linearity in the random effects, Gaussian random effects, Gaussian residuals, and independence between those two sources of variation. The covariance matrices must be valid and the likelihood must use the correct residual covariance structure. Residuals need not be independent across occasions: a specified positive-definite \(R_i\) may include serial correlation. However, the formula only gives the intended likelihood if that structure is appropriate for the data.
Useful checks include confirming that \(V_i\) is symmetric positive definite, verifying dimensions before matrix multiplication, and checking that the marginal covariance contains the intended shared-parameter correlations. A non-positive determinant or an attempted inverse of a singular matrix signals a parameterization, data-design, or numerical problem; it is not a valid log-likelihood calculation. Also check whether observations have been centered around \(X_i\beta\), not around a conditional prediction that still includes a particular random-effect value.
The benchmark does not diagnose model adequacy by itself. A mathematically correct Gaussian marginal likelihood can still be a poor description of observations if the structural mean, residual distribution, covariance structure, or random-effects distribution is wrong. In nonlinear models, the prediction is generally not affine in the random effects, so the marginal distribution need not be Gaussian. FO, FOCE, and Laplace methods address marginalization in that broader setting by approximation; their performance can be assessed against this exact case when the model is linear-Gaussian. This tutorial establishes the reference likelihood, not the construction or behavior of those approximation procedures.
A common mistake is to use only \(R_i\) in the marginal likelihood because residual errors are the only errors visible in the observation equation once a subject’s prediction is specified. That is conditional reasoning: marginalization must include uncertainty in \(b_i\), so the correct covariance is \(Z_i\Omega Z_i^\mathsf{T}+R_i\). Another mistake is to add variances but leave off-diagonal covariances at zero; shared random effects induce off-diagonal terms whenever the corresponding rows of \(Z_i\) load on the same effects.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions below.
- In a scalar random-intercept model, the random-intercept variance is \(0.0300\) and the residual variance is \(0.0200\). What is the marginal variance of one observation?
- Two observations share a random intercept with variance \(0.0400\), and each has independent residual variance \(0.0100\). What is their marginal covariance and correlation?
- Why is the log determinant term needed in the marginal log-likelihood, in addition to the quadratic residual term?
- Does the exact marginal Gaussian result apply automatically when the individual prediction is nonlinear in a Gaussian random effect? Explain.
Solutions. (1) The marginal variance is the sum, \(0.0300+0.0200=0.0500\). (2) The covariance is the shared random-intercept variance, \(0.0400\); each marginal variance is \(0.0400+0.0100=0.0500\), so the correlation is \(0.0400/0.0500=0.8000\). (3) The quadratic term measures the residual’s covariance-scaled distance from the mean, while the log determinant accounts for the volume or scale of the covariance distribution and its normalization. (4) No. A nonlinear transformation of a Gaussian random effect is not generally Gaussian, so this exact marginal Gaussian formula is limited to the stated linear-Gaussian setting.