Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Evaluating Biomarker Trajectories at Event Times

Bayesian Joint Models · Tutorial 309 of 697

Evaluating Biomarker Trajectories at Event Times

Learn to evaluate subject-specific biomarker trajectories at event times for each posterior draw and use them correctly in the survival likelihood.

Advanced 11 min read

What You'll Learn

  • Construct a subject-specific latent biomarker trajectory from sampled fixed and random effects.
  • Evaluate the trajectory at an event time, including when no biomarker measurement was taken then.
  • Substitute the event-time value into a shared-current-value hazard.
  • Compute an event likelihood using the hazard at the event and cumulative hazard over follow-up.
  • Recognize when numerical integration and trajectory diagnostics are needed.
  • Distinguish latent-trajectory evaluation from using a noisy measurement or posterior mean.

Why Evaluate the Trajectory at an Event Time?

In a joint model, the biomarker measurements are noisy observations of an underlying subject-specific trajectory. The survival component can use that latent trajectory to describe how the event hazard changes with the subject’s biomarker level. An event may occur between measurement visits, so the relevant biomarker value is generally not an observed measurement: it is the model-implied trajectory evaluated at the event time.

This tutorial focuses on computing that value at each sampled parameter draw and using it in the survival likelihood. The calculations below consider exact event times; handling right-censored observations is a separate likelihood contribution.

Definition: Let \(y_{ij}\) be subject \(i\)'s biomarker measurement at time \(t_{ij}\). A longitudinal model specifies \(y_{ij}=m_i(t_{ij})+\epsilon_{ij}\), where \(m_i(t)\) is the subject-specific latent trajectory. A common trajectory specification is \(m_i(t)=x_i(t)^\top\beta+z_i(t)^\top b_i\), with fixed-effect coefficients \(\beta\), subject-specific random effects \(b_i\), and design vectors \(x_i(t)\) and \(z_i(t)\). For a shared-current-value survival model, the hazard is \(h_i(t)=h_0(t)\exp\{w_i^\top\gamma+\alpha m_i(t)\}\).

Here \(h_0(t)\) is the baseline hazard, \(w_i\) is a vector of survival covariates, \(\gamma\) is its coefficient vector, and \(\alpha\) is the association parameter linking the current latent biomarker level to the hazard. The hazard has units of inverse time. The exponential term is dimensionless, so the scale and units of \(m_i(t)\) and \(\alpha\) must be compatible.

At a Bayesian sampling iteration \(s\), use that iteration’s values \(\beta^{(s)}, b_i^{(s)}, \gamma^{(s)}, \alpha^{(s)}\), and baseline-hazard parameters to compute \(m_i^{(s)}(t)=x_i(t)^\top\beta^{(s)}+z_i(t)^\top b_i^{(s)}\). Evaluate the design vectors at the time of interest, rather than substituting the closest measurement time. The event-time value is \(m_i^{(s)}(T_i)\).

Assumptions and the Event-Time Likelihood

The likelihood calculation relies on the model being well-defined over the subject’s follow-up interval. In particular, the time origin and time scale used by the longitudinal and survival components must agree; the design vectors must be defined at the event time and throughout the interval from zero to that time; and the sampled parameters must define a finite, integrable hazard. The usual shared-random-effects interpretation also assumes that the longitudinal and event processes are conditionally independent given the shared random effects, covariates, and model parameters. The shared latent trajectory then links their likelihood contributions.

For a subject with an exact event at \(T_i\), the survival likelihood contribution is the event-time density. Define the cumulative hazard as the integral of the hazard up to time \(T_i\). The density is the hazard at the event time multiplied by the probability of surviving event-free to that time:

$$ L_i^{\mathrm{surv}} = h_i(T_i)\exp\left\{-\int_0^{T_i}h_i(u)\,du\right\}. $$

The first factor uses the trajectory specifically at \(T_i\); the integral uses the trajectory at all times from zero through \(T_i\). Consequently, evaluating \(m_i(T_i)\) is necessary but not sufficient to calculate the event likelihood.

Substituting the shared-current-value hazard gives the log likelihood contribution \(\log h_0(T_i)+w_i^\top\gamma+\alpha m_i(T_i)-\int_0^{T_i}h_0(u)\exp\{w_i^\top\gamma+\alpha m_i(u)\}\,du\). This expression is evaluated at each sampled parameter draw. The integral may have a closed form for some trajectory and baseline-hazard choices; otherwise, it can be approximated numerically at that draw.

Worked Calculations

Worked Example: Evaluating a Linear Trajectory at an Event Time

Suppose a hypothetical subject has a linear latent trajectory, with time measured in years and biomarker level measured in units: \(m_i(t)=\beta_0+\beta_1t+b_{0i}+b_{1i}t\). At one sampler draw, let \(\beta_0=2.1\), \(\beta_1=0.35\) units per year, \(b_{0i}=0.4\) units, and \(b_{1i}=-0.08\) units per year. The exact event occurs at \(T_i=4\) years.

First combine the fixed and random effects: the intercept is \(2.1+0.4=2.5\) units, and the slope is \(0.35-0.08=0.27\) units per year. Therefore,

$$ m_i^{(s)}(4)=2.1+(0.35)(4)+0.4+(-0.08)(4) =2.1+1.4+0.4-0.32 =3.58\ \text{units}. $$

This is the latent biomarker level used in the hazard at year 4 for this draw. It is not necessarily the recorded biomarker value at year 4: the measurement model includes residual error, and there may not be a visit at that time at all.

Worked Example: Computing the Event Likelihood with a Constant Baseline Hazard

Continue with the hypothetical trajectory \(m_i(u)=2.5+0.27u\) units and event time \(T_i=4\) years. Suppose the baseline hazard is constant at \(h_0(u)=0.04\) per year, \(w_i^\top\gamma=0.2\), and \(\alpha=0.3\) per biomarker unit. These values make the exponent dimensionless. The hazard at the event is

$$ h_i(4)=0.04\exp\{0.2+(0.3)(3.58)\} =0.04\exp(1.274) \approx 0.1430\ \text{per year}. $$

The cumulative hazard is computed over the full four years. Since the exponent along this linear trajectory is \(0.2+0.3(2.5+0.27u)=0.95+0.081u\), integration gives

$$ \int_0^4 h_i(u)\,du = 0.04e^{0.95}\int_0^4 e^{0.081u}\,du = 0.04e^{0.95}\frac{e^{0.324}-1}{0.081} \approx 0.4886. $$

Thus the event density contribution is approximately \(0.1430e^{-0.4886}=0.0877\) per year. Equivalently, the log contribution is \(\log(0.1430)-0.4886\approx-2.434\). The density has units of inverse years; the cumulative hazard and log likelihood are dimensionless.

This calculation assumes the constant baseline hazard and the stated linear trajectory apply throughout years 0 to 4. If either is specified differently, the integral must reflect that specification rather than reusing this closed form.

Worked Example: Evaluating a Nonlinear Trajectory and Approximating the Integral

Consider a hypothetical quadratic trajectory \(m_i(t)=\beta_0+\beta_1t+\beta_2t^2+b_{0i}+b_{1i}t\), with \(t\) in years and the biomarker in units. At a sampled draw, let \(\beta_0=1.8\), \(\beta_1=0.25\), \(\beta_2=-0.02\), \(b_{0i}=0.3\), and \(b_{1i}=0.04\). For an event at \(T_i=3\) years,

$$ m_i(3)=1.8+(0.25)(3)+(-0.02)(9)+0.3+(0.04)(3) =2.79\ \text{units}. $$

Now let \(h_0(t)=0.05\) per year, \(w_i^\top\gamma=-0.1\), and \(\alpha=0.4\) per unit. The event-time hazard is \(h_i(3)=0.05e^{-0.1+(0.4)(2.79)}=0.05e^{1.016}\approx0.1381\) per year.

For an illustrative cumulative-hazard approximation, evaluate the hazard at \(t=0,1.5,3\). The corresponding trajectory values are \(2.10,2.49,2.79\) units, giving hazards approximately \(0.1048,0.1225,0.1381\) per year. Simpson’s rule over this three-year interval yields

$$ \int_0^3h_i(u)\,du \approx\frac{3}{6}\{0.1048+4(0.1225)+0.1381\} =0.3665. $$

The resulting approximate log event contribution is \(\log(0.1381)-0.3665\approx-2.346\). This is a quadrature approximation, not an exact integral. In actual computation, the quadrature rule and grid should be accurate enough for the model and checked by increasing the number of evaluation points.

Why the Calculation Is Done at Every Draw

The trajectory and hazard are nonlinear functions of sampled parameters. In general, evaluating the hazard at posterior mean parameters does not give the posterior mean hazard. For example, because the exponential function is nonlinear, the average of \(\exp\{\alpha m_i(T_i)\}\) over draws is generally not equal to the exponential of the average exponent. The same issue applies to the cumulative hazard and the event likelihood.

The appropriate calculation is therefore draw-by-draw: evaluate the trajectory at the required times using the sampled coefficients and random effects, calculate the hazard and cumulative hazard for that draw, and then summarize the resulting posterior draws if a posterior summary is required. This preserves uncertainty and dependence among the sampled quantities.

1
Take one sampled draw.
Use the fixed effects, subject-specific random effects, association parameters, and baseline-hazard parameters from the same iteration.
2
Evaluate the trajectory.
Calculate \(x_i(t)^\top\beta+z_i(t)^\top b_i\) at the event time and at the points needed to integrate over follow-up.
3
Calculate the survival contribution.
Combine the hazard at the event with the cumulative hazard over the interval.
4
Repeat across draws.
Keep each draw’s trajectory and survival calculation paired; summarize only after obtaining the draw-specific quantities.

Diagnostics, Alternatives, and Limitations

A trajectory evaluation can be arithmetically correct while the model-based calculation is unreliable. Check that the time units match across the longitudinal basis, event times, and baseline hazard; that the same time origin is used in both model components; and that the event time lies within the interval where the trajectory is defined. If the event occurs well beyond the last biomarker measurement, the value at the event may depend substantially on extrapolation from the assumed trajectory form. That uncertainty is not resolved simply by evaluating the formula.

Also check that the cumulative hazard is finite and nonnegative, and compare numerical integration results at successively finer grids when quadrature is used. A large change in the integral as the grid is refined indicates that the approximation is not yet adequate. Implausible event-time trajectory values can indicate a coding error, a time-scale mismatch, or a poorly supported extrapolation.

The shared-current-value association used here is one modeling choice, not a universal description of biomarker-survival association. Other formulations can link the hazard to a trajectory feature such as its slope or accumulated history. Those features answer different scientific questions and require their own definitions and likelihood calculations. For the current-value model, using the noisy observed measurement in place of \(m_i(T_i)\) changes the model: it inserts measurement error into the hazard rather than linking the event process to the latent level.

  • Wrong: “The last recorded biomarker was 3.1, so that is the value at the event.” Correction: Evaluate the sampled latent trajectory at the actual event time; a recorded value is a noisy measurement at its own visit time.
  • Wrong: “The event-time hazard is enough to obtain the event likelihood.” Correction: The event contribution also includes survival to that time, represented by the cumulative hazard over the full interval.
  • Wrong: “Evaluate the trajectory once using posterior mean coefficients.” Correction: Calculate the trajectory and likelihood at each joint parameter draw before taking posterior summaries.

These calculations depend on the chosen longitudinal basis, association structure, and baseline hazard. A trajectory that is adequate near observed visits may behave poorly between visits or under extrapolation. Model fit and scientific plausibility therefore matter alongside correct evaluation.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. A linear trajectory is \(m_i(t)=1.5+0.2t+0.3-0.05t\), with biomarker units and time in years. What is its value at \(t=2\) years?
  2. For an exact event at \(T_i\), why does the survival likelihood require the trajectory over the interval from zero to \(T_i\), as well as its value at \(T_i\)?
  3. At one draw, \(h_i(T_i)=0.12\) per year and the cumulative hazard is \(0.5\). What is the event density contribution, and what are its units?
  4. Why is evaluating the hazard at posterior mean parameters generally not a substitute for calculating it at each sampled draw?

Solutions. (1) Combine the intercepts and slopes: \(m_i(2)=1.8+0.15(2)=2.10\) units. (2) The event density is the hazard at the event multiplied by survival to the event, and survival to \(T_i\) is \(\exp\{-\int_0^{T_i}h_i(u)\,du\}\); that integral depends on the hazard along the interval. (3) The contribution is \(0.12e^{-0.5}\approx0.0728\) per year. (4) The hazard includes nonlinear functions of parameters, so evaluating at parameter means generally differs from averaging the draw-specific hazards and does not preserve posterior uncertainty.

Clinical Biostats