Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Predicting Under a Slope Association

Dynamic Prediction · Tutorial 513 of 697

Predicting Under a Slope Association

Calculate patient-specific future risk when the event hazard depends on a latent biomarker slope, and see why uncertainty and survival to the prediction landmark must both be accounted for.

Advanced 10 min read

What You'll Learn

  • Specify a proportional-hazards model that links event risk to the latent biomarker slope.
  • Express landmark risk as an integral over the distribution of latent effects given the observed history.
  • Update slope weights to account for remaining event-free through the landmark.
  • Calculate risk from discrete posterior slope values and compare it with a plug-in prediction.
  • Check the units, assumptions, and numerical behavior of slope-based predictions.

Why a Slope Association Changes the Prediction

A patient’s biomarker level at a prediction landmark is only one feature of the observed trajectory. Two patients can have the same current level but different rates of change; a joint model with a slope association allows those rates to carry different information about event risk. The prediction target is the patient’s probability of experiencing the event over a future horizon, given the biomarker history and survival to the landmark.

The latent slope is not observed directly. It is inferred from the patient’s noisy, possibly sparse measurements and the longitudinal model. A prediction that substitutes a single estimated slope as though it were known can therefore understate or misrepresent risk. The calculation below averages the future risk over the slope values that remain plausible given the patient’s history.

Model and Prediction Target

Definition: Let \(T_i\) be the event time for patient \(i\), \(m_i(u;b_i)\) the patient’s latent biomarker trajectory at time \(u\), and \(m_i'(u;b_i)\) its time derivative. A slope-association hazard model is $$ h_i(u\mid b_i,\theta)=h_0(u)\exp\{\gamma^\top w_i+\alpha m_i'(u;b_i)\}, $$ where \(h_0(u)\) is the baseline hazard, \(w_i\) is a vector of baseline covariates, \(b_i\) contains the patient-specific latent effects, and \(\theta\) denotes model parameters. The parameter \(\alpha\) describes the change in log hazard per unit increase in latent slope, holding the other terms fixed.

For example, if the biomarker is measured in units per year, then \(m_i'(u;b_i)\) is in biomarker units per year, and \(\alpha\) has the reciprocal units. The product \(\alpha m_i'(u;b_i)\) is dimensionless, as required inside the exponential. A positive \(\alpha\) means a higher slope corresponds to a higher hazard, conditional on the model; it does not imply that changing the biomarker would cause a change in event risk.

Conditional on \(b_i\) and \(\theta\), the event survival function from time zero is

$$ S_i(t\mid b_i,\theta) = \exp\left\{-\int_0^t h_i(u\mid b_i,\theta)\,du\right\}. $$

Let \(Y_i(t)\) denote the biomarker measurements observed through landmark time \(t\). The target is \(P(t<T_i\leq t+\Delta\mid T_i>t,Y_i(t),w_i,\theta)\), for a specified future horizon \(\Delta>0\). In a fitted-model prediction, \(\theta\) is often held at an estimated value; the integration here addresses uncertainty about the patient’s latent effects, and hence about the slope.

Prediction formula: If \(\pi_i(b_i\mid Y_i(t),\theta)\) is the distribution of latent effects given the biomarker history before accounting for survival to \(t\), then $$ P(t<T_i\leq t+\Delta\mid T_i>t,Y_i(t),\theta) = \frac{ \int \left\{S_i(t\mid b_i,\theta)-S_i(t+\Delta\mid b_i,\theta)\right\} \pi_i(b_i\mid Y_i(t),\theta)\,db_i }{ \int S_i(t\mid b_i,\theta)\pi_i(b_i\mid Y_i(t),\theta)\,db_i }. $$

The numerator averages the probability of surviving to \(t\) and then having the event by \(t+\Delta\), over latent effects compatible with the biomarker history. The denominator is the probability of surviving to the landmark under that same history. Their ratio is the requested risk conditional on being event-free at \(t\). Equivalently, one can first update the latent-effect distribution using both the biomarker history and survival to \(t\), then average the conditional future risk \(1-S_i(t+\Delta\mid b_i)/S_i(t\mid b_i)\).

Why Survival to the Landmark Updates Slope Weights

The longitudinal history gives information about the slope, but event-free follow-up also gives information. A latent effect associated with a high hazard makes survival to \(t\) less likely. Thus, among otherwise comparable patients known to have survived to \(t\), that latent effect should receive less weight than it had from the biomarker history alone.

This follows directly from conditioning. The joint contribution of a latent effect \(b_i\), the observed biomarker history, and survival to \(t\) is proportional to \(\pi_i(b_i\mid Y_i(t),\theta)S_i(t\mid b_i,\theta)\). Normalizing that expression gives the distribution among patients who survived to the landmark:

$$ \pi_i(b_i\mid Y_i(t),T_i>t,\theta) = \frac{S_i(t\mid b_i,\theta)\pi_i(b_i\mid Y_i(t),\theta)} {\int S_i(t\mid b_i,\theta)\pi_i(b_i\mid Y_i(t),\theta)\,db_i}. $$

Substituting this distribution into the average of the conditional future risk yields the prediction formula above. This is a short derivation of why landmark conditioning cannot be replaced by simply averaging future risks using weights based on the biomarker history alone.

Worked Example: Risk at a Fixed Latent Slope

Suppose, for illustration, the baseline hazard is constant at \(0.04\) per year, there are no baseline covariates, and the latent biomarker slope is known to be \(0.50\) biomarker units per year. Let \(\alpha=0.70\) per biomarker unit per year. Calculate the two-year risk under this fixed slope.

The hazard is constant in time under these assumptions, with value

$$ h=0.04\exp(0.70\times0.50) =0.04\exp(0.35) =0.04(1.4191) =0.05676\text{ per year}. $$

The two-year cumulative hazard is \(2(0.05676)=0.11352\). Therefore,

$$ P(T_i\leq 2\mid b_i) =1-\exp(-0.11352) =0.1073. $$

Under the stated fixed-slope model, the predicted event risk over two years is about 10.73%. This is a conditional calculation for a specified slope; it does not yet account for uncertainty in the slope estimate.

Averaging Over Slope Uncertainty

In practice, the slope is typically a function of \(b_i\), which is not known. The longitudinal model and the patient’s observed measurements induce a distribution over plausible \(b_i\) values. Under the slope-association hazard, each plausible value can imply a different hazard path and a different future risk. The prediction averages these risks using the appropriate conditional distribution; it does not generally evaluate the risk at the average slope.

The integrals can be computed by numerical quadrature or by averaging over draws from the relevant latent-effect distribution. With discrete values \(b_{ik}\) and normalized weights \(q_{ik}\), the calculation is a weighted sum. If the weights already condition on survival to the landmark, the sum is \(\sum_k q_{ik}\{1-S_i(t+\Delta\mid b_{ik})/S_i(t\mid b_{ik})\}\).

Worked Example: Integrating Over Three Plausible Slopes

Suppose the patient’s biomarker history and survival through the landmark have led to three slope values with weights \(0.20\), \(0.50\), and \(0.30\). The slopes are \(-0.20\), \(0.30\), and \(0.80\) biomarker units per year. Assume the same constant baseline hazard \(0.04\) per year, \(\alpha=0.70\), and a two-year prediction horizon beginning at the landmark. For simplicity, the slope and hazard are constant during that horizon.

For a constant slope \(s\), the hazard is \(0.04\exp(0.70s)\), and the two-year risk is \(1-\exp\{-2[0.04\exp(0.70s)]\}\). The three calculations are:

  • For \(s=-0.20\), \(h=0.04\exp(-0.14)=0.03477\) per year. Thus the cumulative hazard is \(2(0.03477)=0.06955\), and the risk is \(1-\exp(-0.06955)=0.06719\).
  • For \(s=0.30\), \(h=0.04\exp(0.21)=0.04935\) per year. The cumulative hazard is \(2(0.04935)=0.09869\), and the risk is \(1-\exp(-0.09869)=0.09398\).
  • For \(s=0.80\), \(h=0.04\exp(0.56)=0.07003\) per year. The cumulative hazard is \(2(0.07003)=0.14005\), and the risk is \(1-\exp(-0.14005)=0.13069\).

Weight the displayed risks by their corresponding probabilities:

$$ 0.20(0.06719)+0.50(0.09398)+0.30(0.13069) =0.013438+0.046990+0.039207 =0.099635\approx0.09964. $$

The slope-averaged two-year risk is therefore about 9.964%. This is the risk averaged over the stated three-point distribution, not the risk at a slope selected as the single best estimate.

Worked Example: Updating Weights for Survival to the Landmark

Continue with the three slopes in the preceding calculation, but suppose the weights \(0.20,0.50,0.30\) describe uncertainty after the biomarker history and before using survival through a one-year landmark. Under the same constant hazards, compute the updated weights and the future two-year risk.

The one-year survival probabilities at the three slopes are \(\exp(-h)\). Using the hazards already calculated, these are \(0.96582\), \(0.95185\), and \(0.93237\), respectively. Multiplying each by its prior weight gives unnormalized weights:

$$ 0.20(0.96582)=0.193164,\qquad 0.50(0.95185)=0.475925,\qquad 0.30(0.93237)=0.279711. $$

Their sum is \(0.948800\). Dividing each mass by this sum gives updated weights of approximately \(0.2036\), \(0.5016\), and \(0.2948\). The higher slope has lost some weight because its hazard is higher and survival through the landmark is less likely. Averaging the two-year risks using these rounded updated weights gives

$$ 0.2036(0.06719)+0.5016(0.09398)+0.2948(0.13069) =0.013680+0.047140+0.038527 =0.099347\approx0.09935. $$

The landmark-conditional future risk is about 9.935%. It is slightly lower than the 9.964% calculation using the original weights because survival to the landmark shifts weight away from the largest slope. In an actual model, the weights would be determined by the fitted longitudinal and survival components, not chosen for illustration.

Why a Plug-In Slope Can Give a Different Answer

A common shortcut is to average the plausible slopes and calculate risk at that mean. In the three-point example, the mean slope is \(0.20(-0.20)+0.50(0.30)+0.30(0.80)=0.35\) biomarker units per year. At this slope the two-year risk is

$$ 1-\exp\{-2[0.04\exp(0.70(0.35))]\} = 1-\exp\{-2(0.05110)\} \approx0.09716. $$

That plug-in result, about 9.716%, differs from the 9.964% risk averaged over the original three-point distribution. The reason is that the exponential hazard and the survival-to-risk transformation are nonlinear: in general, the risk evaluated at a mean slope is not the mean of the risks. The discrepancy may be small or substantial depending on the spread of slope uncertainty and the size of \(\alpha\). It is not evidence that either calculation is automatically correct: the correct target determines the calculation, and a patient-specific conditional prediction must use the relevant distribution of slopes rather than silently treating its mean as known.

Assumptions, Diagnostics, and Alternatives

The calculation is meaningful only under a coherent joint model. The longitudinal component must represent the biomarker trajectory and measurement error adequately enough to estimate its derivative. The survival component must correctly specify how the latent slope enters the hazard, including the baseline hazard and any included covariates. The slope must be defined on the time scale used by the model, and the model must specify its behavior over the prediction interval. Conditional on the latent effects and modeled covariates, the assumed event and longitudinal processes must have the dependence structure specified by the joint model. Censoring must also be handled under the model’s censoring assumptions.

A practical diagnostic is to check whether the patient’s measurement times and values plausibly support slope estimation. A few measurements close together, substantial measurement noise, or long gaps can leave the posterior slope distribution broad. Inspect the distribution of slopes or their implied hazards, not just a single point estimate. Also check that the numerical integration uses normalized, nonnegative weights, that each integrated survival probability lies between zero and one, and that the final risk is in the interval from zero to one. For a positive \(\alpha\), larger slopes should produce larger hazards when the other terms are held fixed.

The main alternative is a plug-in prediction using one slope estimate, such as a posterior mean or mode. It is easier to compute and can serve as a rough summary, but it discards slope uncertainty and can produce a different risk because of nonlinearity. A model based on the current biomarker value instead answers a different association question; it should not be substituted for a slope association merely because the current value is easier to estimate. The slope-based model is also limited: it relies on the chosen trajectory form and can be unstable when measurements provide little information about the derivative. This calculation conditions on fitted model parameters; uncertainty in those parameters is a separate source of uncertainty.

Common pitfall: “The estimated slope is \(0.35\), so I will use the hazard at \(0.35\) as the patient’s risk.” This treats an uncertain latent quantity as known and generally does not equal the risk averaged over its conditional distribution. Instead, calculate the risk at each plausible slope and average using weights conditioned on the biomarker history and survival to the landmark.

Check Your Understanding

Use the model and definitions above. Solutions are included after the questions so that each calculation can be checked.

  1. If \(\alpha=0.70\) and two latent slopes differ by \(0.40\) biomarker units per year, what is the hazard ratio for the higher slope relative to the lower slope, holding other terms fixed?
  2. Why does knowing that a patient survived to the landmark generally change the weights assigned to plausible slopes?
  3. In the three-slope example, what risk would result from averaging the slopes first and then calculating risk? Why need it not equal the weighted average of risks?
  4. Name two conditions that should be checked before interpreting a slope-based dynamic prediction.

Solutions. (1) The hazard ratio is \(\exp\{0.70(0.40)\}=\exp(0.28)=1.323\). Under the model, the higher slope corresponds to a hazard about 1.323 times as large, conditional on the other terms. (2) Survival to the landmark is less likely for latent effects that imply larger hazards, so Bayes’ rule reweights their probabilities downward relative to lower-hazard values. (3) The weighted mean slope is \(0.35\); the plug-in risk is \(1-\exp\{-2[0.04\exp(0.245)]\}\approx0.09716\), or 9.716%. It need not match the average risk because the mapping from slope to hazard and risk is nonlinear. (4) Examples include adequate information in the measurements to estimate the latent derivative, a suitable longitudinal trajectory and measurement-error model, a correctly specified slope association and baseline hazard, and appropriate handling of censoring. Any two of these address distinct requirements.

Clinical Biostats