Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Dynamic Prediction With Baseline Covariates

Dynamic Prediction · Tutorial 508 of 697

Dynamic Prediction With Baseline Covariates

You will calculate conditional survival by keeping baseline covariates fixed in both model components and integrating over the random-effects distribution updated by the patient’s history and event-free follow-up.

Advanced 12 min read

What You'll Learn

  • Specify how baseline covariates enter the longitudinal model and the event hazard.
  • Derive the conditional future-survival calculation from the landmark posterior of the random effects.
  • Distinguish the effect of baseline covariates on future hazard from their role in weighting latent risk.
  • Work through numerical predictions for a patient with a binary baseline covariate.
  • Identify common implementation errors and assess when a joint-model prediction may be unreliable.

Why Baseline Covariates Matter in Dynamic Prediction

A patient’s baseline characteristics can affect a dynamic survival prediction in two distinct ways. They may shift the expected longitudinal biomarker trajectory, and they may also alter the event hazard directly. Because prediction conditions on the patient’s observed biomarker history and survival to a landmark, baseline covariates can additionally affect how that history and event-free follow-up weight the possible random effects.

These roles should not be collapsed into one. A baseline covariate’s longitudinal coefficient describes how the expected biomarker differs across covariate values, conditional on the model’s other terms. Its hazard coefficient describes how the event hazard differs, conditional on the other hazard terms. Neither coefficient alone is the patient’s conditional future survival probability.

Definition: Let \(s\) be a landmark time, \(t>s\) a future time, \(\mathbf{x}_i\) the baseline covariate vector for patient \(i\), \(b_i\) the patient’s random effects, and \(Y_i(s)\) the biomarker history observed by \(s\). The dynamic prediction is \(P(T_i>t\mid T_i>s,Y_i(s),\mathbf{x}_i)\), the probability that the patient survives past \(t\), conditional on being event-free at \(s\), the observed history through \(s\), and the baseline covariates.

Model Components and Assumptions

A common longitudinal component has a conditional mean such as \(m_i(u)=\mathbf{x}_i^{\mathsf T}\boldsymbol{\beta}+\mathbf{z}_i(u)^{\mathsf T}b_i\). Here, \(\boldsymbol{\beta}\) contains fixed effects, \(\mathbf{z}_i(u)\) describes the time-dependent part of the model, and \(b_i\) captures patient-level departures from the population trajectory. The longitudinal likelihood for measurements through \(s\), given \(b_i\) and \(\mathbf{x}_i\), is denoted \(L_i\{Y_i(s)\mid b_i,\mathbf{x}_i\}\).

Write the event hazard conditional on the random effects and baseline covariates as \(\lambda_i(u\mid b_i,\mathbf{x}_i)\). For example, a proportional-hazards specification may include \(\boldsymbol{\gamma}^{\mathsf T}\mathbf{x}_i\) in its linear predictor, as well as terms involving \(b_i\). The hazard’s exact association structure is a modeling choice; the prediction calculation below applies when that conditional hazard is specified.

The calculation relies on a correctly specified joint model and a coherent random-effects distribution \(p(b_i\mid\mathbf{x}_i)\). It also assumes that, conditional on the modeled random effects and covariates, the longitudinal measurements and event process have the dependence structure specified by the model. Measurement-error assumptions must be appropriate for the biomarker type, and censoring must be handled under the model’s censoring assumptions. Baseline covariates are treated as known and fixed at prediction time. Predictions also require the patient’s covariate pattern to be supported by the data; a fitted equation does not make extrapolation reliable.

The model-based conditional survival given \(b_i\) and \(\mathbf{x}_i\) is \(S_i(t\mid b_i,\mathbf{x}_i)=\exp\{-\int_0^t\lambda_i(u\mid b_i,\mathbf{x}_i)\,du\}\). This expression assumes the stated hazard is the event hazard over the interval of interest. The calculation does not require a constant hazard, but a constant-hazard example makes the arithmetic especially transparent.

Landmark Weights and the Prediction Formula

At the landmark, possible random effects receive different weights according to three ingredients: their prior distribution for this baseline covariate pattern, how well they explain the observed biomarker history, and how compatible they are with survival to \(s\). In particular, event-free follow-up is informative whenever the hazard depends on \(b_i\). The baseline covariates appear in the likelihood and survival terms, as well as in the random-effects distribution if that distribution is modeled conditionally on them.

$$ p(b_i\mid T_i>s,Y_i(s),\mathbf{x}_i) = \frac{ L_i\{Y_i(s)\mid b_i,\mathbf{x}_i\} S_i(s\mid b_i,\mathbf{x}_i) p(b_i\mid\mathbf{x}_i) }{ \int L_i\{Y_i(s)\mid b,\mathbf{x}_i\} S_i(s\mid b,\mathbf{x}_i) p(b\mid\mathbf{x}_i)\,db } $$

This expression is the landmark posterior density of the random effects. It uses survival to \(s\) once: in the posterior weights. Given \(b_i\), survival from \(s\) to \(t\) is \(S_i(t\mid b_i,\mathbf{x}_i)/S_i(s\mid b_i,\mathbf{x}_i)\). Averaging that conditional probability over the landmark posterior gives the dynamic prediction.

$$ P(T_i>t\mid T_i>s,Y_i(s),\mathbf{x}_i) = \int \frac{S_i(t\mid b,\mathbf{x}_i)}{S_i(s\mid b,\mathbf{x}_i)} p(b\mid T_i>s,Y_i(s),\mathbf{x}_i)\,db $$

Substituting the posterior formula cancels the survival-to-\(s\) factor in the integrand and yields an equivalent ratio:

$$ P(T_i>t\mid T_i>s,Y_i(s),\mathbf{x}_i) = \frac{ \int L_i\{Y_i(s)\mid b,\mathbf{x}_i\}S_i(t\mid b,\mathbf{x}_i)p(b\mid\mathbf{x}_i)\,db }{ \int L_i\{Y_i(s)\mid b,\mathbf{x}_i\}S_i(s\mid b,\mathbf{x}_i)p(b\mid\mathbf{x}_i)\,db } $$

The ratio also shows why simply predicting from a biomarker history without conditioning on survival to the landmark is not equivalent. The denominator normalizes over the histories and random effects compatible with being event-free at \(s\). In practice, the integrals may be evaluated by numerical quadrature or Monte Carlo integration.

Derivation: Conditional on \(b_i\) and \(\mathbf{x}_i\), the probability of surviving from \(s\) to \(t\) is \(S_i(t\mid b_i,\mathbf{x}_i)/S_i(s\mid b_i,\mathbf{x}_i)\). The law of total probability averages this quantity over \(p(b_i\mid T_i>s,Y_i(s),\mathbf{x}_i)\). Substituting the Bayes formula for that density cancels \(S_i(s\mid b_i,\mathbf{x}_i)\), leaving the displayed ratio of integrals. Thus the baseline covariates must be held at the patient’s values throughout both the posterior weighting and future-survival calculation.

Worked Example: Direct Baseline-Covariate Effect on Future Survival

Suppose a hypothetical joint model has a binary baseline covariate \(x\), a known random effect \(b=0\) for this calculation, and a constant hazard \(\lambda(u\mid b,x)=0.1\exp\{(\log 2)x+(\log 2)b\}\) per year. Compare conditional survival from year 1 to year 3 for otherwise identical patients with \(x=0\) and \(x=1\). Because \(b\) is fixed here, this example isolates the direct hazard contribution of \(x\).

For \(x=0\), the hazard is \(0.1\exp(0)=0.1\) per year. The conditional survival over the two-year interval is \(S(3\mid b=0,x=0)/S(1\mid b=0,x=0)=\exp\{-0.1(3-1)\}=\exp(-0.2)=0.8187\).

For \(x=1\), the hazard is \(0.1\exp(\log 2)=0.2\) per year. The corresponding calculation is \(S(3\mid b=0,x=1)/S(1\mid b=0,x=1)=\exp\{-0.2(3-1)\}=\exp(-0.4)=0.6703\).

Under this hypothetical model, the patient with \(x=1\) has lower model-based conditional survival over these two years, holding \(b\) fixed. This comparison describes the model’s conditional association, not a causal effect of changing \(x\).

Worked Example: Updating Random-Effects Weights With Baseline Covariates

Consider a hypothetical patient with \(x=1\), observed at landmark \(s=1\) year. Let \(b\) take values 0 and 1, with \(P(b=1\mid x)=0.4\) and \(P(b=0\mid x)=0.6\). The single observed biomarker value has model \(Y\mid b,x\sim N(2+0.3x+0.5b,0.25)\), where the second argument is the variance. The observed value is \(y=2.8\). Let the hazard be constant, \(\lambda(u\mid b,x)=0.1\exp\{(\log 2)x+(\log 2)b\}\) per year.

For \(x=1,b=0\), the biomarker mean is \(2.3\); for \(x=1,b=1\), it is \(2.8\). With standard deviation \(0.5\), the normal densities at the observed value are \(L(y\mid b=0,x=1)=0.4839\) and \(L(y\mid b=1,x=1)=0.7979\). The hazards are \(0.2\) and \(0.4\) per year, so survival to year 1 is \(e^{-0.2}=0.8187\) and \(e^{-0.4}=0.6703\), respectively.

The unnormalized landmark weights are \(w_0=0.6(0.4839)(0.8187)=0.2377\) and \(w_1=0.4(0.7979)(0.6703)=0.2139\). Therefore, \(P(b=1\mid T>1,y=2.8,x=1)=0.2139/(0.2377+0.2139)=0.4737\); the corresponding weight for \(b=0\) is \(0.5263\).

For survival from year 1 to year 3, the conditional survival factors are \(e^{-0.2(2)}=0.6703\) for \(b=0\) and \(e^{-0.4(2)}=0.4493\) for \(b=1\). Averaging over the landmark weights gives \(0.5263(0.6703)+0.4737(0.4493)=0.5656\). Thus the model-based probability of surviving through year 3, given the biomarker observation and event-free status at year 1, is approximately \(0.5656\).

Worked Example: Comparing Covariate Patterns With Matched Biomarker Residuals

Use the same hypothetical model and random-effects prior as in the previous example. Compare a patient with \(x=0\) and observed \(y=2.5\) at year 1 with the \(x=1,y=2.8\) patient above. Each observation is \(0.5\) above the \(b=0\) mean and exactly at the \(b=1\) mean. Thus the two histories have the same relative likelihoods for \(b\); nevertheless, their survival-to-landmark weights differ because \(x\) affects the hazard.

For \(x=0\), the hazards for \(b=0\) and \(b=1\) are \(0.1\) and \(0.2\) per year. The unnormalized landmark weights are \(w_0=0.6(0.4839)e^{-0.1}=0.2627\) and \(w_1=0.4(0.7979)e^{-0.2}=0.2613\). After normalization, \(P(b=1\mid T>1,y=2.5,x=0)=0.2613/(0.2627+0.2613)=0.4986\).

Over the next two years, the survival factors for \(b=0\) and \(b=1\) are \(e^{-0.2}=0.8187\) and \(e^{-0.4}=0.6703\). The prediction is \((1-0.4986)(0.8187)+0.4986(0.6703)=0.7447\). For the \(x=1\) patient, the previous example gave \(0.5656\). The difference reflects both the direct hazard change and its effect on the random-effects weights at the landmark. It is not a causal comparison between patients.

Implementation Checks and Common Pitfalls

A useful computational check is to calculate predictions both by averaging conditional survival ratios over normalized landmark weights and by using the ratio-of-integrals formula. The results should agree up to numerical integration error. Check that the posterior weights sum to one, that each conditional survival is between zero and one, and that survival over a longer future interval is no greater than survival over a shorter interval from the same landmark.

Also inspect whether baseline covariates are encoded and scaled consistently in both model components. A binary variable coded as 0/1 in the longitudinal fit but as 1/2 in prediction software changes the linear predictor. For a continuous covariate, an incorrect centering value can shift predicted hazards or biomarker means. Calibration and prediction error should be examined across clinically relevant baseline-covariate groups, not only averaged over all patients; sparse groups can reveal poor fit or extrapolation.

  • Common mistake: omit \(x\) from the future hazard after using it in the biomarker model. The biomarker history does not replace the hazard’s baseline-covariate term. Keep \(x\) in \(\lambda(u\mid b,x)\) wherever the fitted model specifies it.
  • Common mistake: condition on survival to \(s\) twice. If the landmark posterior already includes \(S(s\mid b,x)\), average \(S(t\mid b,x)/S(s\mid b,x)\), not \(S(t\mid b,x)\) alone. The latter would incorrectly ask for survival from time zero while using weights conditional on survival to \(s\).
  • Common mistake: plug in a single estimated random effect and call the result integrated prediction. A plug-in calculation ignores uncertainty about \(b\). Unless the posterior is concentrated or a plug-in approximation is explicitly intended, integrate conditional survival over the landmark posterior.

A joint-model prediction uses a specified trajectory and event process, which can be useful when their dependence through random effects matters. A prediction model built directly from landmark covariates and history is an alternative that does not require the same latent-trajectory structure, but it targets prediction through its own fitted conditional model. A simple baseline-only survival prediction is another alternative, but it does not use the patient’s biomarker history to update latent risk. These approaches answer related but not identical modeling questions; their predictive performance should be assessed on appropriate validation data.

The joint-model result is conditional on its assumptions and estimated parameters. It can be unstable when there are few events, limited observations near the landmark, weak information about the random-effects distribution, or little overlap in baseline-covariate patterns. Uncertainty in fitted parameters can also matter; a calculation using fixed parameter estimates alone does not fully represent that uncertainty. Good numerical integration cannot compensate for a misspecified model or unsupported extrapolation.

Key takeaway: For dynamic prediction with baseline covariates, use the patient’s covariate values in the longitudinal likelihood, the hazard and the random-effects distribution as specified. Update random-effects weights using both biomarker history and survival to the landmark, then average conditional future survival over those weights.

Check Your Understanding

Answer each question before reading the solution that follows it.

  1. In the landmark posterior, why does survival to \(s\) affect the weight assigned to \(b\)?
  2. Under a constant hazard of \(0.15\) per year, what is conditional survival over the next 2 years for a patient with known \(b\) and baseline covariates already included in that hazard?
  3. What is the error in averaging \(S(t\mid b,x)\) over a posterior that is already conditional on \(T>s\), rather than averaging \(S(t\mid b,x)/S(s\mid b,x)\)?
  4. Suppose a baseline covariate enters the longitudinal model but not the hazard model. Does it still have to be used in prediction?
  5. Why can a plug-in prediction based on one random-effects estimate differ from an integrated prediction?

Solutions. (1) If the hazard depends on \(b\), some random-effects values imply a greater chance of having experienced the event by \(s\); among patients known to be event-free, those values receive less weight through \(S(s\mid b,x)\). (2) The survival probability is \(e^{-0.15(2)}=e^{-0.3}=0.7408\). (3) It uses survival from time zero rather than conditional survival after \(s\), effectively failing to divide out survival through the landmark. (4) Yes. It affects the longitudinal likelihood and therefore may affect the posterior random-effects weights, even though it has no direct hazard term in that specified model. (5) Integration averages survival probabilities over the full posterior uncertainty in \(b\); evaluating survival at one estimate generally does not equal that average because survival is a nonlinear function of \(b\).

Clinical Biostats