Why the Trajectory Shape Matters for Prediction
A dynamic prediction at landmark time \(s\) uses a patient’s marker history and event-free status through \(s\) to estimate risk after \(s\). The joint model links that risk to the patient’s latent marker trajectory, not simply to the last recorded measurement. When the trajectory bends over time, predicting with a straight line or a single marker value can misrepresent the hazard over the prediction interval.
The central task here is to evaluate the fitted, subject-specific trajectory at the times needed for prediction. Those times may include future times at which no marker has been measured. The resulting latent values enter the chosen hazard association, and the hazard is integrated over time. The introductory material on conditional survival from a joint model gives the broader prediction target; the focus here is how a nonlinear trajectory supplies its time-varying marker values.
Trajectory Representation and Assumptions
A convenient general representation is \(m_i(t)=\boldsymbol{B}(t)^\top\boldsymbol{\beta}+\boldsymbol{Z}(t)^\top\boldsymbol{b}_i\). The vectors \(\boldsymbol{B}(t)\) and \(\boldsymbol{Z}(t)\) contain fixed-effect and subject-specific time-basis functions, \(\boldsymbol{\beta}\) is a vector of fixed coefficients, and \(\boldsymbol{b}_i\) contains the subject’s random effects. For a quadratic trajectory, basis functions might include \(1,t,t^2\); for a spline, they include functions defined by its knots and boundary choices. The longitudinal observations fluctuate around \(m_i(t)\) according to the specified measurement-error model.
For clarity, suppose the event hazard conditional on the random effects has a current-value association:
Here \(h_0(t)\) is the baseline hazard, \(\boldsymbol{w}_i\) denotes baseline covariates, and \(\alpha\) is the association parameter. The hazard is nonnegative and has units of inverse time. With a slope association, the trajectory derivative \(m_i'(t)\) replaces \(m_i(t)\) in the association term; with a cumulative-exposure association, the relevant quantity is an integral of the trajectory. Thus a nonlinear trajectory may be evaluated, differentiated, or integrated according to the specified association structure.
The prediction relies on several modeling conditions: the fitted trajectory and hazard association must be appropriate over the interval; the time scale and marker units must agree with those used when fitting the model; and the subject-specific random effects must be averaged over their distribution conditional on the available marker history and survival to \(s\). If parameter uncertainty is being propagated, parameter draws must also be handled consistently. In the numerical examples below, model parameters are treated as fixed, while the displayed random-effect draws and weights represent the relevant conditional uncertainty in the trajectory.
Worked Example: Evaluating a Quadratic Latent Trajectory
Suppose time is measured in months, and one subject’s fitted trajectory for a particular random-effect draw is \(m_i(t)=1.00+0.20(t-2)-0.05(t-2)^2\), with marker values in the model’s measurement units. Evaluate the trajectory at months 2, 3, and 4, and find its slope at month 4.
At month 2, \(t-2=0\), so \(m_i(2)=1.00+0.20(0)-0.05(0)^2=1.00\). At month 3, \(t-2=1\), giving \(m_i(3)=1.00+0.20-0.05=1.15\). At month 4, \(t-2=2\), giving \(m_i(4)=1.00+0.40-0.20=1.20\).
Differentiating with respect to time gives \(m_i'(t)=0.20-0.10(t-2)\), in marker units per month. Thus \(m_i'(4)=0.20-0.10(2)=0.00\) marker units per month: the fitted curve is locally flat at month 4. The curve rises between months 2 and 4, but its slope declines over that interval. Evaluating the polynomial, rather than extending its initial slope, captures that curvature.
From a Nonlinear Trajectory to Conditional Risk
For a given trajectory draw, conditional survival from landmark \(s\) to time \(u>s\) is obtained from the hazard along that draw. Define the cumulative hazard \(A_i(s,u\mid\boldsymbol{b}_i)\) as the integral of the conditional hazard. Conditional survival is its negative exponential. Because the random effects are uncertain after observing a patient’s history, the prediction averages this survival over their conditional distribution.
Here \(\mathcal{H}_i(s)\) is the information available through \(s\), and \(T_i>s\) denotes being event-free at the landmark. The corresponding conditional event risk by \(u\) is \(1-S_i(u\mid s,\mathcal{H}_i(s))\). This expectation is over the random-effect distribution updated by the patient’s marker history and event-free follow-up; it is not generally the survival calculated by substituting the mean trajectory into the hazard.
A numerical calculation commonly has two distinct averaging or integration tasks. First, for each trajectory draw, integrate its hazard over calendar time, using a sufficiently fine grid or a suitable quadrature rule. Second, average the resulting conditional survival values over the trajectory draws with their conditional weights. Keeping these tasks separate helps identify whether an inaccurate prediction comes from an inadequate time grid or an inadequate representation of trajectory uncertainty.
Worked Example: Combining Nonlinear Trajectory Draws
Consider a hypothetical prediction from month \(s=2\) to month \(u=4\). Let the baseline hazard be constant at \(0.04\) per month, let \(\alpha=0.5\) per marker unit, and let there be no baseline covariate term. Use two posterior trajectory draws with conditional weights \(0.60\) and \(0.40\). For the first draw, the quadratic trajectory in the previous example gives values \(1.00,\ 1.15,\ 1.20\) at months 2, 3, and 4. For the second draw, suppose the corresponding values are \(1.40,\ 1.55,\ 1.60\). The weights are conditional on the available history and being event-free at month 2.
For the first draw, the hazards at the two endpoints and midpoint are \(0.04\exp(0.5\times1.00)=0.06595\), \(0.04\exp(0.5\times1.15)=0.07109\), and \(0.04\exp(0.5\times1.20)=0.07288\) per month. Simpson’s rule over the two-month interval gives
Therefore the conditional survival for this draw is \(\exp(-0.1411)\approx0.8684\).
For the second draw, the hazards are \(0.04\exp(0.5\times1.40)=0.08055\), \(0.04\exp(0.5\times1.55)=0.08682\), and \(0.04\exp(0.5\times1.60)=0.08902\) per month. The same calculation gives
Now average the two survival values using their conditional weights: \(0.60(0.8684)+0.40(0.8417)=0.8577\), to four significant figures. Thus the estimated conditional event risk between months 2 and 4 is \(1-0.8577=0.1423\), or about 14.23%. This is a risk conditional on the stated history and event-free status at month 2, under the specified joint model.
Evaluating a Spline at Prediction Times
A spline represents the trajectory with locally flexible basis functions. For example, a linear spline with a knot at month 3 can be written \(m_i(t)=b_{0i}+b_{1i}(t-2)+b_{2i}(t-3)_+\), where \((x)_+=\max(x,0)\). This curve is continuous at the knot, while its slope may change there. More flexible splines can be used when smoother curvature is needed. Whatever the basis, evaluate the complete fitted function at each integration time; do not use a basis value from one time point as if it were the marker itself.
Worked Example: Integrating Risk Across a Spline Knot
Suppose a hypothetical patient’s fitted linear spline is \(m_i(t)=1.00+0.20(t-2)-0.05(t-3)_+\), with time in months. Use the same hazard \(h_i(t)=0.04\exp\{0.5m_i(t)\}\) per month to estimate conditional survival from month 2 to month 4. Because the slope changes at the knot, split the interval there and apply Simpson’s rule separately on \([2,3]\) and \([3,4]\).
The spline values at months \(2,\ 2.5,\ 3,\ 3.5,\ 4\) are \(1.00,\ 1.10,\ 1.20,\ 1.275,\ 1.35\). Substituting each value into the hazard gives approximately \(0.06595,\ 0.06933,\ 0.07288,\ 0.07567,\ 0.07856\) per month. For the first subinterval, Simpson’s rule gives \((1/6)\{0.06595+4(0.06933)+0.07288\}=0.06936\). For the second, it gives \((1/6)\{0.07288+4(0.07567)+0.07856\}=0.07569\). The total cumulative hazard is approximately \(0.1450\), so conditional survival is \(\exp(-0.1450)\approx0.8650\), and conditional event risk is about \(0.1350\) over the two months.
Splitting at the knot respects the change in the spline’s shape. A finer grid can further improve the numerical integration, especially when the hazard changes rapidly. This calculation conditions on the displayed spline coefficients; if those coefficients are uncertain, survival must also be averaged over the appropriate trajectory distribution.
Derivation, Diagnostics, and Limitations
The averaging step follows from conditioning on the latent random effects. Given \(\boldsymbol{b}_i\), the joint model specifies the conditional survival as \(\exp\{-A_i(s,u\mid\boldsymbol{b}_i)\}\). Removing the unobserved \(\boldsymbol{b}_i\) while retaining the observed history requires the law of total probability: take the conditional expectation of that survival over the distribution of \(\boldsymbol{b}_i\) given \(\mathcal{H}_i(s)\) and \(T_i>s\). This gives the prediction formula above. In general, the exponential is nonlinear, so averaging and substituting do not commute:
The right-hand side uses one average random effect; it is not, in general, the required average survival. The same issue applies if one averages marker trajectories first and then calculates risk. The trajectory draws must be carried through the hazard and survival calculation before their survival values are averaged.
Useful checks include plotting fitted trajectories against observed measurements, examining whether curvature is supported by the observation times, and checking that the time basis and knot locations are coded consistently at fitting and prediction. Compare numerical integration on successively finer grids; material changes in cumulative hazards or risks indicate that the original grid was inadequate. Check that computed hazards are nonnegative and in inverse-time units, and that predicted survival is between zero and one and does not increase as the prediction horizon advances.
A polynomial can behave implausibly when extrapolated far beyond the observed time range: even a modest quadratic term can eventually dominate. Splines allow more local flexibility but still depend on knot placement and boundary behavior, and sparse measurements near a boundary may leave the future curve weakly determined. A better numerical integral cannot correct a misspecified trajectory or hazard association. Nor does a close fit to recorded measurements alone establish that the latent curve is reliable for future prediction.
Check Your Understanding
Work through the questions, then compare your reasoning with the solutions.
- A fitted trajectory is \(m_i(t)=2+0.3t-0.04t^2\), where time is in years. What is the latent marker value at year 2?
- Why is the observed marker at the landmark not generally interchangeable with \(m_i(s)\)?
- For a spline with a knot inside the prediction interval, what practical change should be made to a simple numerical integration grid?
- What does the conditional weight on a trajectory draw represent in dynamic prediction?
- Why is survival calculated from the average trajectory generally different from the average survival across trajectories?
Solutions. (1) \(m_i(2)=2+0.3(2)-0.04(2^2)=2+0.6-0.16=2.44\) marker units. (2) The observed value includes measurement error and is only one observation; the latent trajectory is the model-implied value at that time and is inferred using the longitudinal history. (3) Include the knot as a grid boundary and integrate on the subintervals separately, or use a sufficiently fine rule that accounts for the change in basis behavior. (4) It represents the trajectory’s conditional contribution after accounting for the available marker history and event-free status at the landmark. (5) Because the hazard and the exponential survival transformation are nonlinear, expectation does not generally commute with those transformations; compute survival for each trajectory first, then average.