Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Comparing Numerical Integration Settings

Convergence and Identifiability · Tutorial 353 of 697

Comparing Numerical Integration Settings

Learn a controlled comparison workflow for deciding whether numerical integration settings materially affect a shared-random-effects joint-model fit and its reported uncertainty.

Advanced 12 min read

What You'll Learn

  • Set up the subject-level likelihood integral for a shared-random-effects joint model.
  • Compare quadrature rules and settings while holding the model and data fixed.
  • Measure changes in log likelihoods, estimates, and standard errors on useful scales.
  • Separate integration error from optimizer and Hessian error.
  • Recognize when apparently stable output is insufficient evidence of numerical stability.

Why Compare Integration Settings?

A fitted shared-random-effects model can look well behaved while still depending on how its likelihood integral was evaluated. A small change in an integral approximation can shift the likelihood surface, move the reported estimates, or alter the curvature used to calculate standard errors. Therefore, convergence under one numerical setting is not, by itself, evidence that the numerical integration is sufficiently accurate.

The practical question is comparative: if the same model is refitted with more accurate or differently constructed integration settings, do the log likelihood, estimates, and uncertainty measures remain materially unchanged? This is a numerical-stability assessment, not a test of a scientific hypothesis. The earlier material on quadrature accuracy and apparent convergence motivates checking integration error; here the emphasis is on a controlled comparison across complete refits.

Likelihood and Integration Settings

For subject \(i\), let \(y_{ij}\) be the longitudinal response at time \(t_{ij}\), \(T_i\) the observed event or censoring time, and \(\delta_i\) the event indicator. Let \(b_i\) be the subject-specific random-effects vector. A representative shared-random-effects model is

$$ y_{ij}=x_{ij}^{\mathsf T}\beta+z_{ij}^{\mathsf T}b_i+\epsilon_{ij}, \qquad b_i\sim N(0,D), $$

with conditionally independent measurement errors \(\epsilon_{ij}\sim N(0,\sigma^2)\), and a conditional hazard such as

$$ h_i(t\mid b_i)=h_0(t)\exp\{w_i(t)^{\mathsf T}\gamma+\alpha m_i(t;b_i)\}. $$

Here \(m_i(t;b_i)\) is the modeled longitudinal value linked to the hazard, and \(\alpha\) is the association parameter. The exact specification may differ, but the comparison principle is the same. Assume subjects are independent; conditional on \(b_i\) and covariates, the longitudinal and event processes have the stated model distributions; and censoring is noninformative under the model. The baseline hazard and all other model components must be held fixed during the numerical comparison.

The subject contribution integrates out the unobserved random effects. Writing \(f_y(y_i\mid b_i)\) for the longitudinal density, and \(h_i\) and \(S_i\) for the conditional hazard and survival function, respectively, gives

$$ L_i(\theta)=\int f_y(y_i\mid b)\, h_i(T_i\mid b)^{\delta_i}S_i(T_i\mid b)\, \phi(b;0,D)\,db, \qquad \ell(\theta)=\sum_i\log L_i(\theta). $$

The parameter vector \(\theta\) includes the longitudinal, survival, association, and random-effects parameters. Except in special cases, this integral is evaluated numerically. Settings to compare can include the quadrature rule, the number of nodes, whether nodes are adapted to the subject-specific integrand, and any integration tolerance used by the software. A higher node count is not automatically better in every implementation: the useful evidence is whether independently tightened settings give stable results.

Definition: A fit is numerically stable with respect to integration settings when tightening or changing the integration approximation, while keeping the model and data fixed and adequately optimizing each fit, produces changes in the log likelihood, parameter estimates, and standard errors that are negligible for the intended scientific interpretation and reporting precision.

A Controlled Comparison

A fair comparison changes integration settings deliberately, not several aspects of the analysis at once. Use the same observations, model formula, parameter constraints, baseline-hazard specification, and likelihood constants. Use sufficiently reliable optimization settings for every fit, and check that each fit reached a comparable optimum. If starting values vary, distinguish variation due to competing optima from variation due to integration. The earlier material on multiple starting values and gradient checks is relevant to those checks, but integration comparisons do not replace them.

For each refit, record at least the maximized log likelihood, the parameters of substantive interest, and their standard errors. It is also useful to record integration rule and settings, optimizer status, and elapsed computation time. Compare estimates both in their own units and relative to their standard errors. A difference that looks small in raw units may matter for a parameter with a very small standard error, while a larger raw difference may be inconsequential for a poorly identified parameter. Neither comparison should replace subject-matter judgment.

If the same likelihood, data, and constants are used, the maximized log likelihoods should approach one another as the integral approximation becomes more accurate. They need not increase monotonically across settings: each approximation defines a slightly different numerical objective, and the optimizer can locate different approximate maxima. A log-likelihood difference should therefore be read alongside parameter and uncertainty changes, not as a standalone pass/fail test.

Worked Example: Increasing the Number of Quadrature Nodes

Suppose a hypothetical analysis of 180 subjects uses the same shared-random-effects model and optimizer settings in every fit. The quantity of primary interest is the association parameter \(\alpha\), measured as a log-hazard change per one-unit increase in the modeled longitudinal value. The results are:

Gauss–Hermite nodes per dimensionMaximized log likelihood\(\hat{\alpha}\)SE of \(\hat{\alpha}\)
9−1284.620.7420.218
15−1284.310.7580.221
25−1284.300.7590.222
35−1284.300.7590.222

From 9 to 25 nodes, the log likelihood changes by \(−1284.30−(−1284.62)=0.32\). The estimate changes by \(0.759−0.742=0.017\), which is about \(0.017/0.222=0.0766\) of the 25-node standard error. From 25 to 35 nodes, the reported log likelihood, estimate, and standard error agree to the displayed precision. This is evidence that 25 nodes may suffice for these reported quantities in this fit, whereas 9 nodes show a noticeable likelihood change. It is not proof that every parameter or prediction is equally stable; the remaining estimates and relevant derived quantities should also be inspected.

Why Estimates and Standard Errors Can Behave Differently

The numerical approximation affects both the likelihood value and its shape. Estimates depend on where the approximated likelihood is maximized. Standard errors from the observed information depend on its local curvature at that maximum. Consequently, estimates can appear stable while standard errors remain sensitive to integration settings, or the reverse can occur.

A basic justification for checking curvature is the local quadratic approximation to the log likelihood near an interior maximum \(\hat{\theta}\). If the observed information is \(J(\hat{\theta})=-\partial^2\ell(\theta)/\partial\theta\partial\theta^{\mathsf T}\) evaluated at the maximum, the usual covariance estimate is \(J(\hat{\theta})^{-1}\). A small integration error in \(\ell\) does not guarantee a small error in its second derivatives: differentiation can amplify small numerical fluctuations. Thus, standard errors should be compared directly, and a suspicious Hessian should be recomputed using a sufficiently accurate likelihood evaluation.

$$ \ell(\theta)\approx \ell(\hat{\theta}) -\frac{1}{2}(\theta-\hat{\theta})^{\mathsf T} J(\hat{\theta})(\theta-\hat{\theta}), \qquad \widehat{\operatorname{Var}}(\hat{\theta})=J(\hat{\theta})^{-1}. $$

Worked Example: Tightening an Adaptive Integration Tolerance

Consider a hypothetical fit to 120 subjects. The software uses adaptive integration and allows the user to set an integration tolerance. The model and optimizer are unchanged, and the optimizer reports convergence for each fit.

Integration toleranceMaximized log likelihood\(\hat{\alpha}\)SE of \(\hat{\alpha}\)
\(10^{-4}\)−902.4470.5120.164
\(10^{-6}\)−902.4050.5290.169
\(10^{-8}\)−902.4030.5300.169

Tightening the tolerance from \(10^{-6}\) to \(10^{-8}\) changes the log likelihood by \(−902.403−(−902.405)=0.002\), the association estimate by \(0.001\), and its standard error by \(0.000\) to three decimals. The estimate change is \(0.001/0.169=0.00592\) of the tighter-fit standard error. By contrast, the change from \(10^{-4}\) to \(10^{-6}\) is \(0.017\) in the estimate and \(0.042\) in log likelihood. The tighter pair is more reassuring for these quantities. The tolerance is an algorithm control, not a guarantee that the stated number equals the true error in the final estimate; the empirical refit comparison supplies the relevant evidence.

Diagnostics and Failure Modes

A comparison is informative only if differences can reasonably be attributed to integration. Check that every fit used the same data and likelihood definition, that optimizer convergence is credible, and that no parameter has moved to a boundary or a different local optimum. If the likelihood changes substantially but parameters barely move, inspect estimates not shown in a short summary, especially variance and association parameters. If estimates change substantially while likelihoods look nearly identical, a flat ridge or weak identification may be present; a similar likelihood does not imply a unique or precise estimate.

Numerical settings can also expose implementation difficulties. Higher-order quadrature may cost much more, particularly as the random-effects dimension grows. A rule that works well for one random-effects distribution or data configuration may perform poorly for another. Large changes in standard errors can indicate that the Hessian is sensitive to numerical noise, that the likelihood is weakly curved, or both. Re-evaluating the likelihood at the reported estimate with tighter settings, and recomputing derivatives consistently, helps separate these possibilities.

Worked Example: Stable Estimates but an Unstable Standard Error

In a hypothetical one-parameter profile calculation for \(\alpha\), the estimate remains \(0.61\) under two integration settings. At the estimate, the less accurate setting gives profile curvature 51.02, while the tighter setting gives curvature 27.70. For this one-parameter profile, the approximate variance is the reciprocal of the curvature.

Using the less accurate curvature gives \(SE(\hat{\alpha})=\sqrt{1/51.02}=0.1400\). Using the tighter setting gives \(SE(\hat{\alpha})=\sqrt{1/27.70}=0.1900\). Thus the estimate is unchanged to the displayed precision, but the standard error increases by \(0.0500\), or about \(35.7\%\) relative to \(0.1400\). Reporting the first standard error simply because the point estimate agrees would be unjustified. The curvature needs to be checked at higher integration accuracy; if it continues to vary, uncertainty quantification is not numerically stable.

Choosing Among Approaches

Product Gauss–Hermite quadrature is a deterministic option with a transparent node-count control, but the number of node combinations grows rapidly with random-effects dimension. Adaptive Gauss–Hermite quadrature shifts and scales nodes to better match the subject-specific integrand; this can improve efficiency, though results still require a settings comparison. Other deterministic integration or Monte Carlo approaches may be useful when the dimension makes a product rule impractical, but they introduce their own controls, such as tolerances or simulation variability. A Laplace approximation can be computationally attractive, but it is an approximation of a different form and should not be treated as numerically interchangeable with a highly resolved quadrature fit.

For a focused sensitivity check, first compare progressively tighter settings within one integration approach. If results do not stabilize or the dimension makes that approach impractical, compare a suitable alternative and report the method used. Agreement across two methods is reassuring, but both can share modeling or optimization problems. Conversely, disagreement does not identify which result is correct; it signals a need for further numerical investigation.

1
Fix the analysis.
Keep the observations, likelihood, covariates, constraints, and model specification identical across refits.
2
Choose a sequence of settings.
Increase node counts or tighten tolerances in a documented sequence, and consider an alternative rule when appropriate.
3
Verify each optimization.
Check convergence and ensure results are not being compared across distinct optima or boundary solutions.
4
Compare the outputs.
Review log likelihoods, all important estimates, and standard errors; scale estimate differences by their standard errors as one useful diagnostic.
5
Report the evidence and limits.
State the settings checked and any material sensitivity; do not describe agreement to displayed precision as proof of exact integration.

Common Mistake and Practical Limits

A common mistake is to conclude, “The optimizer converged, so the integration must be accurate.” Optimizer convergence means that the algorithm met its stopping criteria for the objective it was given; it does not certify that the objective accurately approximates the intended likelihood. The correction is to assess integration sensitivity separately and to inspect estimates and standard errors, not only the optimizer message or log likelihood.

There is no universal numerical threshold that makes every comparison acceptable. A difference small relative to an estimate's standard error is useful context, but scientific consequences depend on the parameter scale, the intended use, and reporting precision. Nor does this exercise diagnose every source of instability: weak identification, model misspecification, sparse follow-up, and influential observations require their own assessment. Numerical stability supports interpretation of a fitted model; it does not establish that the model is scientifically adequate.

Check Your Understanding

Answer each question, then compare with the solutions.

  1. Why should the data, model specification, and likelihood constants be kept fixed when comparing integration settings?
  2. A parameter estimate changes by 0.012, and the standard error from the tighter fit is 0.040. Express the change in standard-error units and explain what that comparison does and does not establish.
  3. Two fits have nearly identical estimates, but the standard error changes from 0.10 to 0.16. Is the numerical comparison reassuring? Explain.
  4. Why is optimizer convergence under one integration setting not enough to establish integration accuracy?
  5. What does it mean if the log likelihoods are close but an association estimate varies materially across settings?

Solutions. (1) Holding these fixed makes integration the intended changing factor; otherwise a change in output has multiple possible explanations. (2) The scaled change is \(0.012/0.040=0.30\) standard errors. This suggests a modest shift relative to the fitted uncertainty, but it does not establish stability of other parameters, standard errors, or model assumptions. (3) No. The estimate may be stable while curvature-based uncertainty is sensitive, so the Hessian and its integration accuracy need further checking. (4) The optimizer checks its stopping conditions for the numerically approximated objective, not whether that approximation is accurate. (5) Similar likelihood values can occur along a flat or weakly identified region; parameter sensitivity remains important and should be investigated rather than dismissed on the basis of likelihood agreement.

Clinical Biostats