Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Propagating Uncertainty in the Latent Trajectory

Dynamic Prediction · Tutorial 515 of 697

Propagating Uncertainty in the Latent Trajectory

Learn to integrate future survival over plausible latent biomarker trajectories, rather than treating an estimated path as known.

Advanced 11 min read

What You'll Learn

  • Define the posterior distribution of a latent trajectory at a prediction landmark.
  • Derive conditional survival by averaging path-specific survival over that distribution.
  • Calculate predictions from discrete and time-varying trajectory distributions.
  • Explain why survival evaluated at a mean path can differ from averaged survival.
  • Identify numerical and modeling checks for trajectory-integrated predictions.
  • Compare posterior path integration with plug-in and linearized approximations.

Why Trajectory Uncertainty Changes a Prediction

A patient’s biomarker history does not reveal their underlying biomarker path exactly. Measurement error, sparse visits, and uncertainty in individual trajectory features leave several future paths plausible. A survival prediction that inserts one estimated path into the hazard treats that path as if it were known. Instead, the prediction can average the future survival associated with each plausible path, weighted by how plausible that path is given the patient’s information.

This matters because a hazard usually depends nonlinearly on the latent marker, and survival depends exponentially on accumulated hazard. Consequently, the survival computed from an average path need not equal the average survival across paths. The goal here is to propagate uncertainty in the latent trajectory through the hazard and into conditional survival.

Conditional Survival Averaged Over Latent Paths

Let \(s\) be a prediction landmark, and let \(u>s\) be a future time. Write \(H_i(s)\) for patient \(i\)’s observed biomarker history through \(s\), and let \(T_i>s\) denote that the patient is event-free at the landmark. Let \(b_i\) denote the patient-specific latent effects that determine their biomarker trajectory \(m_i(v;b_i)\). For illustration, suppose the time-dependent hazard given \(b_i\) is

$$ h_i(v\mid b_i)=h_0(v)\exp\{x_i^\mathsf{T}\beta+\alpha g_i(v;b_i)\}, $$

where \(h_0(v)\) is the baseline hazard, \(x_i\) is a vector of baseline covariates, \(\beta\) is its coefficient vector, and \(\alpha\) is an association parameter. The function \(g_i(v;b_i)\) is the chosen feature of the latent path, such as its current value or slope. The association structure is treated as specified; the issue here is uncertainty about the patient’s path.

Definition: The trajectory-integrated conditional survival probability from \(s\) to \(u\) is the average of path-specific conditional survival over the distribution of latent effects given the patient’s observed history and survival to \(s\). With model parameters \(\theta\) held fixed, it is $$ S_i(u\mid s,H_i(s),T_i>s;\theta) = \int \exp\left\{-\int_s^u h_i(v\mid b_i)\,dv\right\} q_i(b_i\mid H_i(s),T_i>s;\theta)\,db_i, $$ where \(q_i\) is the conditional distribution of \(b_i\) given that information.

The inner integral is the cumulative hazard along one specified path from \(s\) to \(u\). Its negative exponential is the probability of remaining event-free over that interval, conditional on that path. The outer integral averages those probabilities over the paths still plausible for this patient. The weights in \(q_i\) reflect both the biomarker history and being event-free at the landmark.

This expression assumes a correctly specified joint model and hazard, with the event and longitudinal process conditionally independent given the shared latent effects and included covariates. It also assumes that the conditional distribution \(q_i\) is properly formed from the patient’s available information. In this tutorial, fitted model parameters are held fixed: the integration propagates uncertainty in the individual trajectory, not uncertainty in the estimated population parameters. Future biomarker measurements are not used in a prediction made at \(s\).

Why Averaging Comes After Computing Survival

The order of operations follows from conditioning on the latent effects and then removing that conditioning. Given \(b_i\), the probability of surviving from \(s\) to \(u\) is the exponential of the negative cumulative hazard. The law of total probability then averages that probability over the conditional distribution of \(b_i\):

$$ \begin{aligned} P(T_i>u\mid H_i(s),T_i>s;\theta) &= \int P(T_i>u\mid b_i,H_i(s),T_i>s;\theta)\, q_i(b_i\mid H_i(s),T_i>s;\theta)\,db_i\\ &= \int \exp\left\{-\int_s^u h_i(v\mid b_i)\,dv\right\} q_i(b_i\mid H_i(s),T_i>s;\theta)\,db_i. \end{aligned} $$

A common shortcut is to average the paths first and calculate survival from that mean path. That generally changes the calculation: the hazard may be nonlinear in the path, and the exponential of cumulative hazard is nonlinear as well. Even the inequality from convexity must be applied carefully. If \(A(b_i)=\int_s^u h_i(v\mid b_i)\,dv\), then \(E[\exp\{-A(b_i)\}]\geq \exp\{-E[A(b_i)]\}\), since \(\exp(-A)\) is convex. But the cumulative hazard of the mean path is not generally \(E[A(b_i)]\). Thus there is no general ordering between integrated survival and survival evaluated at the mean path.

Worked Example: Two Plausible Constant Paths

Suppose that, at the landmark, the posterior distribution assigns probability \(0.5\) to a constant marker path \(m(v)=0\) and probability \(0.5\) to \(m(v)=2\). Assume \(h_0=0.10\) per year, \(\alpha=0.5\) per marker unit, no baseline covariate contribution, and \(g_i(v;b_i)=m(v)\). Predict survival over the next two years.

For the path \(m(v)=0\), the hazard is \(0.10\exp(0.5\times0)=0.10\) per year. Its two-year cumulative hazard is \(0.10\times2=0.20\), so survival is \(\exp(-0.20)=0.8187\).

For the path \(m(v)=2\), the hazard is \(0.10\exp(0.5\times2)=0.2718\) per year. Its two-year cumulative hazard is \(0.2718\times2=0.5437\), so survival is \(\exp(-0.5437)=0.5806\).

The integrated prediction is \(0.5(0.8187)+0.5(0.5806)=0.6997\). Thus the model predicts about 70.0% conditional survival over two years, or a 30.0% conditional event risk. By contrast, the posterior mean path is \(m(v)=1\). Substituting it gives hazard \(0.10\exp(0.5)=0.1649\) per year and survival \(\exp\{-(0.1649)(2)\}=0.7191\). That is not the integrated prediction: evaluating survival at the mean path overstates survival by about 1.94 percentage points in this example. These are conditional predictions under the stated model, not causal effects.

Time-Varying Paths Require Integration Over Time Too

A latent path can change within the prediction horizon. Then each plausible path contributes its own time-varying hazard, which must first be accumulated over time. The following example shows both integrations: over future time within each path, and over the posterior distribution of paths.

Worked Example: Uncertain Marker Slope

Suppose there are two equally likely trajectories over the next year: \(m_A(t)=0\) and \(m_B(t)=2t\), where \(t\) is years since the landmark. Let \(h_0=0.10\) per year, \(\alpha=0.5\) per marker unit, and \(g_i(t;b_i)=m(t)\). Assume no baseline covariate contribution.

For path A, the hazard is constant at \(0.10\), so its cumulative hazard is \(\int_0^1 0.10\,dt=0.10\), and its survival is \(\exp(-0.10)=0.9048\).

For path B, \(\alpha m_B(t)=t\), so the hazard is \(0.10e^t\). Its cumulative hazard is \(\int_0^1 0.10e^t\,dt=0.10(e-1)=0.1718\), giving survival \(\exp(-0.1718)=0.8421\). Averaging the two path-specific probabilities gives \(0.5(0.9048)+0.5(0.8421)=0.8735\).

The mean path is \(m(t)=t\). Its hazard is \(0.10e^{0.5t}\), with cumulative hazard \(\int_0^1 0.10e^{0.5t}\,dt=0.20(e^{0.5}-1)=0.1297\). Survival at this mean path is \(\exp(-0.1297)=0.8783\), which differs from 0.8735. The distinction arises even though each candidate trajectory is simple and the association is a current-value association.

Computing the Integral in Practice

For many joint models, the integral over \(b_i\) does not have a closed form. A direct approximation uses posterior draws \(b_i^{(1)},\ldots,b_i^{(M)}\) from \(q_i\). For each draw, compute the path-specific cumulative hazard and survival, then average the survival values:

$$ \widehat S_i(u\mid s) = \frac{1}{M}\sum_{r=1}^{M} \exp\left\{-\int_s^u h_i(v\mid b_i^{(r)})\,dv\right\}. $$

The time integral may itself require numerical quadrature. Alternatively, if posterior draws are sampled from a convenient distribution rather than \(q_i\), use importance weights: multiply each path-specific survival by its normalized weight and sum. The weights must represent the target conditional distribution, including the information available at the landmark.

1
Represent path uncertainty.
Obtain draws or weighted candidate values of the latent effects from the patient-specific conditional distribution at the landmark.
2
Compute each path-specific prediction.
For each draw, evaluate the hazard along the path, integrate it from \(s\) to \(u\), and take the negative exponential.
3
Average survival probabilities.
Average the path-specific survival values using equal weights for posterior draws or the appropriate normalized importance weights.
4
Check numerical stability.
Repeat with more draws or a finer time grid and check that the predicted probability changes negligibly at the intended reporting precision.

Worked Example: Posterior Weights After the Landmark

Suppose the patient’s history and event-free status at the landmark imply posterior weights \(0.80\) for a constant path \(m(v)=0\) and \(0.20\) for a constant path \(m(v)=1\). These are conditional weights, not prior probabilities. Take \(h_0=0.15\) per year, \(\alpha=0.8\) per marker unit, and a one-year horizon.

The low path gives cumulative hazard \(0.15\times1=0.1500\), so its survival is \(\exp(-0.1500)=0.8607\). The higher path gives hazard \(0.15e^{0.8}=0.3338\) per year, cumulative hazard \(0.3338\), and survival \(\exp(-0.3338)=0.7162\).

Weighting the path-specific survivals gives \(0.80(0.8607)+0.20(0.7162)=0.8318\). The conditional event risk is \(1-0.8318=0.1682\), or 16.82%. The mean path is \(0.80(0)+0.20(1)=0.20\). At that path, the cumulative hazard is \(0.15e^{0.8(0.20)}=0.1760\), giving survival \(\exp(-0.1760)=0.8386\). The result differs from the weighted prediction because averaging the path first discards information about the spread of plausible paths.

Approaches, Diagnostics, and Limitations

Posterior path integration is the direct approach when the aim is to average over uncertainty about an individual trajectory. A plug-in approach evaluates survival at one path, often a posterior mean path. It is simpler, but does not in general equal the integrated prediction. A linearized or delta-method approximation can be computationally cheaper when trajectory uncertainty is small and the survival functional varies smoothly near a representative path. It is an approximation and may be unreliable when the posterior is broad or skewed, or when hazard changes sharply with the marker. These approaches differ in how they handle path uncertainty; none removes the need for an appropriate joint model.

Useful checks focus on whether both integrations are being computed and whether the numerical approximation is stable. Inspect the posterior distribution of the path over the prediction horizon, not only its uncertainty at the landmark. Check that path-specific cumulative hazards are nonnegative and that computed survival probabilities lie between zero and one. Increase the number of posterior draws and refine the time grid; material changes suggest Monte Carlo error or inadequate time integration. If a few paths dominate the weighted average, investigate whether the conditional distribution or importance weights are being computed reliably.

A subtle but common mistake is to average the marker paths and then call the resulting survival the patient-specific prediction. This is incorrect whenever the survival functional does not commute with averaging: in general, \(E[S_i(u\mid b_i)]\ne S_i(u\mid E[b_i])\). The correction is to compute survival for each plausible path first and average those probabilities using the conditional path weights.

Trajectory integration does not protect against model misspecification. Predictions can still be poorly calibrated if the longitudinal model, association structure, baseline hazard, or conditional-independence assumptions are inappropriate. Nor does the calculation automatically include uncertainty in fitted population parameters; those are held fixed here. It predicts from information available at the landmark and does not account for future measurements that have not yet been observed.

Key takeaway: For each plausible latent biomarker path, integrate its hazard over the prediction horizon and convert that cumulative hazard to survival. Then average the path-specific survival probabilities over the patient’s conditional trajectory distribution.

Check Your Understanding

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

  1. Why is the patient-specific conditional distribution of latent effects conditioned on survival to the landmark as well as biomarker history?
  2. Two equally likely paths have one-year survival probabilities 0.90 and 0.70. What is their integrated survival, and what is the conditional event risk?
  3. For a fixed cumulative hazard \(A\), path-specific survival is \(\exp(-A)\). State the convexity inequality comparing \(E[\exp(-A)]\) with \(\exp\{-E[A]\}\), and explain why it does not by itself compare integrated survival with survival at the mean trajectory.
  4. Name two numerical checks that can help detect an inaccurate trajectory-integrated prediction.

Solutions. (1) Being event-free through the landmark is information about latent risk; the prediction must average over the distribution conditional on all information available at that time. (2) Integrated survival is \(0.5(0.90)+0.5(0.70)=0.80\), so conditional event risk is \(1-0.80=0.20\), or 20%. (3) Since \(\exp(-A)\) is convex, \(E[\exp(-A)]\geq\exp\{-E[A]\}\). But the cumulative hazard evaluated at the mean trajectory need not equal the mean cumulative hazard, so this inequality does not establish an ordering against survival at the mean trajectory. (4) Increase the number of posterior draws and check whether the prediction stabilizes; refine the time-integration grid and check for material changes. Also verify that computed survival values lie between zero and one.

Clinical Biostats