Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Quadrature For Multimarker Random-Effects Integrals

Multiple Longitudinal Markers · Tutorial 387 of 697

Quadrature For Multimarker Random-Effects Integrals

You will learn to express the multimarker subject likelihood as a random-effects integral, understand its dimension, and compare adaptive Gaussian quadrature with Laplace approximation.

Advanced 13 min read

What You'll Learn

  • Identify the random-effects dimension that determines the dimension of a multimarker likelihood integral.
  • Write the subject-specific joint likelihood conditional on random effects and then marginalize over them.
  • Derive the local quadratic approximation underlying Laplace approximation.
  • Apply adaptive Gaussian quadrature to a non-Gaussian integrand using mode-centered nodes.
  • Compare computational cost, accuracy risks, and diagnostics for the two approximations.

Why the Integral Grows With the Marker Panel

A joint model connects repeated measurements from several markers to a subject’s event time through latent subject-specific effects. To obtain a likelihood for the observed data, those effects must be integrated out. Adding marker-specific random intercepts or slopes can therefore enlarge not only the model but also the dimension of the numerical integral required for each subject. This computational consequence matters: a method that is reliable for one or two random effects may become expensive or inaccurate when the random-effects vector is larger.

Let \(Y_{ik}\) denote the observed measurements for subject \(i\) on marker \(k\), let \(T_i\) be the observed event or censoring time, and let \(\delta_i\) indicate whether the event was observed. Stack the subject’s random effects across all markers into a vector \(b_i\) of dimension \(q\). For example, a marker-specific random intercept and slope for each of \(K\) markers gives \(q=2K\). The dimension is the number of random-effect components being integrated, not the number of measurements.

Definition: A subject-specific random-effects integral is the marginal likelihood contribution obtained by integrating that subject’s conditional data likelihood over the random-effects distribution. If \(b_i\) has \(q\) components, this is a \(q\)-dimensional integral. Marker-specific random effects increase \(q\) when they add components to \(b_i\).

For illustration, suppose \(b_i\sim N_q(0,D)\), where \(D\) is a positive-definite covariance matrix. Conditional on \(b_i\) and the model covariates, write the longitudinal contribution as \(L_{Y_i}(b_i)\), and the event-time contribution as \(L_{T_i}(b_i)\). Under conditional independence of marker outcomes given the random effects, and a conditionally specified survival model, the subject’s marginal contribution is

$$ L_i=\int_{\mathbb{R}^q} L_{Y_i}(b_i)L_{T_i}(b_i)\phi_q(b_i;0,D)\,db_i, \qquad L_{T_i}(b_i)=h_i(T_i\mid b_i)^{\delta_i}S_i(T_i\mid b_i). $$

Here \(\phi_q\) is the \(q\)-variate normal density, \(h_i\) is the conditional hazard, and \(S_i\) is the conditional survival function. The displayed factorization is an assumption of the specified model, not a universal property of multimarker data: residual dependence between markers not represented by \(b_i\) requires a different longitudinal contribution. For censored observations, \(\delta_i=0\), so the survival factor contributes \(S_i(T_i\mid b_i)\), rather than a hazard term.

The numerical methods below assume that the conditional likelihood and random-effects density define a finite integral, and that the log integrand is sufficiently smooth near its dominant region. Laplace approximation additionally needs a well-defined interior mode with negative-definite Hessian there. Both methods can mislead if the assumed conditional models, random-effects distribution, or censoring assumptions are inappropriate; computation does not repair model misspecification.

How Dimension Affects Computation

A tensor-product quadrature rule with \(m\) nodes in each coordinate evaluates the integrand at \(m^q\) points. This exponential growth is the central challenge. Covariance among random effects does not itself add dimensions, but it can rotate and stretch the region where the integrand has appreciable mass, making an unadapted grid inefficient. The following count illustrates the growth before any optimization or data-management overhead is included.

Worked Example: Counting Nodes for Marker-Specific Effects

Suppose three markers each have a random intercept and a random slope. Thus \(q=3(2)=6\). A tensor-product rule using seven nodes in each dimension would require

$$ 7^6=117{,}649 $$

integrand evaluations for one subject. With 15 nodes per dimension, the count is

$$ 15^6=11{,}390{,}625. $$

The count follows from choosing one of \(m\) nodes independently in each of six coordinates; it does not mean there are that many subjects or observations. These counts explain why simply increasing the number of quadrature nodes may become infeasible as marker-specific effects are added. They also explain why reducing the random-effects dimension can be computationally consequential, although such a reduction must be scientifically defensible and preserve the intended model.

Adaptive Gaussian Quadrature

Gaussian quadrature approximates an integral by a weighted sum of integrand evaluations. Adaptive Gaussian quadrature (AGQ) centers and scales the nodes using the mode and local curvature of the integrand. In a joint likelihood, define the log integrand

$$ \ell_i(b)=\log\{L_{Y_i}(b)L_{T_i}(b)\phi_q(b;0,D)\}. $$

Let \(\widehat b_i\) maximize \(\ell_i(b)\), and let \(H_i=-\nabla^2\ell_i(\widehat b_i)\) be its negative Hessian, assumed positive definite for this local approximation. Choose a matrix \(A_i\) such that \(A_iA_i^\mathsf{T}=H_i^{-1}\). For a standard-normal quadrature node \(z\), the corresponding adaptive node in random-effects space is \(b=\widehat b_i+A_i z\). The local curvature therefore places nodes more closely in directions where the integrand is narrow.

For a tensor rule with nodes \(z_r\) and normalized weights \(w_r\), an AGQ approximation can be written as

$$ L_i \approx \exp\{\ell_i(\widehat b_i)\}(2\pi)^{q/2}|H_i|^{-1/2} \sum_r w_r \exp\left\{\ell_i(\widehat b_i+A_i z_r)-\ell_i(\widehat b_i)+\frac{1}{2}z_r^\mathsf{T}z_r\right\}. $$

The weights here sum to one under the standard-normal rule. The exponential correction measures how the actual log integrand differs from its local quadratic approximation at each node. With more nodes, AGQ can represent some of this nonquadratic shape; it does not make a misspecified model correct, and a finite quadrature rule is still an approximation.

Laplace Approximation and Its Connection to AGQ

Laplace approximation replaces the log integrand near its mode by a second-order Taylor expansion. At an interior maximum \(\widehat b_i\), the gradient is zero, so

$$ \ell_i(b)\approx \ell_i(\widehat b_i)-\frac{1}{2}(b-\widehat b_i)^\mathsf{T}H_i(b-\widehat b_i). $$

Exponentiating gives a Gaussian-shaped approximation to the integrand. Integrating that Gaussian over \(\mathbb{R}^q\) gives the Laplace formula:

Laplace approximation: If \(\widehat b_i\) is an interior mode and \(H_i=-\nabla^2\ell_i(\widehat b_i)\) is positive definite, then
$$ L_i\approx \exp\{\ell_i(\widehat b_i)\}(2\pi)^{q/2}|H_i|^{-1/2}. $$
This approximation uses the mode and local curvature but ignores higher-order departures from a quadratic log integrand.

The formula follows by setting \(u=H_i^{1/2}(b-\widehat b_i)\). The quadratic term becomes \(-u^\mathsf{T}u/2\), while the change of variables has Jacobian \(|H_i|^{-1/2}\). Thus the remaining integral is \(\int_{\mathbb{R}^q}\exp(-u^\mathsf{T}u/2)\,du=(2\pi)^{q/2}\). In the AGQ expression, keeping only the local quadratic term makes the correction inside the weighted sum equal to one. Since the normalized weights sum to one, AGQ then reduces to the Laplace approximation. This gives a direct interpretation: Laplace is the local Gaussian baseline, while AGQ adds evaluations of departures from that baseline.

Worked Example: A Three-Node Adaptive Approximation

Consider the one-dimensional integral

$$ I=\int_{-\infty}^{\infty}\exp(-b^2/2-0.1b^4)\,db. $$

The log integrand is \(\ell(b)=-b^2/2-0.1b^4\). Its derivative is \(-b-0.4b^3\), so its mode is \(\widehat b=0\). Its negative second derivative at zero is \(H=1\). The Laplace approximation is therefore

$$ I_{\mathrm{Laplace}}=\exp\{\ell(0)\}\sqrt{\frac{2\pi}{H}} =1\sqrt{\frac{2\pi}{1}}\approx 2.5066. $$

For a three-node standard-normal rule, use nodes \(z=0,\sqrt{3},-\sqrt{3}\), with weights \(2/3,1/6,1/6\), respectively. Here \(A=1\), and the AGQ correction at node \(z\) is \(\exp\{\ell(z)-\ell(0)+z^2/2\}=\exp(-0.1z^4)\). It equals 1 at zero and \(\exp(-0.9)\approx0.40657\) at either nonzero node. Thus

$$ I_{\mathrm{AGQ},3} \approx \sqrt{2\pi}\left\{\frac{2}{3}+ \frac{1}{6}(0.40657)+\frac{1}{6}(0.40657)\right\} =\sqrt{2\pi}(0.80219)\approx2.0108. $$

The nonzero correction arises from the quartic term, which the local quadratic approximation omits. The calculation illustrates how AGQ incorporates nonquadratic shape at selected nodes; it does not, by itself, establish the accuracy of this three-node estimate. Accuracy must be assessed by increasing the node count or comparing against a sufficiently accurate numerical benchmark.

Comparing the Approximations in a Joint Likelihood

Laplace approximation is usually cheaper once the mode and Hessian are available: it requires no large grid of evaluations around the mode. AGQ can improve on the local Gaussian approximation when the integrand is skewed or otherwise nonquadratic, but tensor-product cost grows rapidly with \(q\) and node count. Neither approximation is uniformly best. In particular, AGQ’s added flexibility is useful only if the quadrature rule covers the important mass of the integrand.

FeatureAdaptive Gaussian quadratureLaplace approximation
Local information usedMode and curvature, plus integrand evaluations at adaptive nodesMode and curvature only
Cost as dimension growsTensor rules can grow as \(m^q\)Typically avoids a tensor grid, but still requires mode and Hessian calculations
Potential advantageRepresents some nonquadratic shape around the modeComputationally economical when the integrand is well approximated by a Gaussian
Important failure modeInsufficient nodes or missed mass away from the adaptive regionSkewness, heavy tails, multiple modes, or weak curvature can undermine the local approximation

Worked Example: A Two-Dimensional Laplace Contribution

Suppose the subject-specific log integrand has a well-defined mode in two random-effects dimensions. At that mode, assume \(\exp\{\ell(\widehat b)\}=0.014996\) and \(\sqrt{|H|}=3.3166\), with the latter value rounded for display. The two-dimensional Laplace formula is

$$ L_{\mathrm{Laplace}} \approx 0.014996\frac{2\pi}{3.3166} =0.014996\frac{6.2832}{3.3166} \approx 0.02841. $$

Using the displayed rounded inputs gives approximately \(0.0284095\); unrounded optimizer output can give approximately \(0.0284084\). Both round to \(0.02841\) at five decimal places. The factor is \(2\pi\), rather than \(\sqrt{2\pi}\), because \(q=2\). This is one subject’s approximate likelihood contribution; the full likelihood combines contributions across subjects.

For either method, useful diagnostics include checking that the optimizer finds a stable interior mode, that the negative Hessian is positive definite, and that results are stable under tighter optimization tolerances. For AGQ, compare estimates or log-likelihood values at increasing node counts where feasible. For Laplace, compare with AGQ or another reliable integration method on a representative subset of subjects if computationally possible. Large changes with modest increases in quadrature order, unstable modes, or nearly singular curvature indicate that the approximation or model parameterization needs further attention.

Common Pitfalls and Practical Limits

  • Counting observations instead of effects. The integration dimension is \(q\), the length of the random-effects vector. More repeated measurements increase the cost of evaluating the conditional likelihood but do not, by themselves, add integration dimensions.
  • Assuming a good mode guarantees a good Laplace approximation. Laplace depends on the integrand being adequately represented by its local quadratic shape over the region that matters to the integral.
  • Assuming more AGQ nodes always solve the problem. A tensor rule can become infeasible as \(q\) grows, and a poorly located adaptive region may not cover important probability mass.
  • Using a non-positive-definite Hessian in the stated formula. If \(H_i\) is not positive definite at the proposed mode, the local Gaussian integral is not defined as written. Check optimization, parameterization, and model identifiability rather than forcing a determinant into the formula.
  • Confusing numerical accuracy with scientific validity. Both methods approximate the likelihood under the chosen model. Neither addresses an incorrect random-effects distribution, unmodeled residual dependence, or inappropriate censoring assumptions.

Monte Carlo integration is a broad alternative when deterministic tensor grids are too costly in higher dimensions, though it has its own simulation error and computational demands. The practical choice depends on the number and structure of random effects, the shape of the integrand, and the precision needed for the inferential task. These methods approximate the marginal likelihood; they do not change the interpretation of the marker-to-hazard associations specified by the joint model.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. Four markers each have a random intercept and slope. What is the random-effects integration dimension, and how many points are in a tensor rule with five nodes per dimension?
  2. Why does Laplace approximation use \((2\pi)^{q/2}\) in dimension \(q\)?
  3. In the quartic-integrand example, what feature makes the three-node AGQ estimate differ from the Laplace estimate?
  4. Name two diagnostics that can reveal an unreliable approximation or mode calculation.

Solutions. (1) There are \(q=4(2)=8\) random-effect components, so the integral is eight-dimensional and the five-node tensor rule has \(5^8=390{,}625\) points. (2) After transforming the quadratic form at the mode to a standard \(q\)-dimensional Gaussian, its integral is \((2\pi)^{q/2}\); the change of variables contributes \(|H|^{-1/2}\). (3) The quartic term is absent from the second-order local approximation but appears in AGQ’s node-specific correction, which is \(\exp(-0.1z^4)\) here. (4) Examples include checking that the mode is stable and interior, confirming that the negative Hessian is positive definite, and checking whether AGQ results stabilize as the node count increases.

Clinical Biostats