Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Latent Marker Trajectories as Hazard Covariates

Association Structures · Tutorial 170 of 697

Latent Marker Trajectories as Hazard Covariates

See how fixed and subject-specific random effects combine to form a marker trajectory that can enter a conditional event hazard over time.

Advanced 10 min read

What You'll Learn

  • Write a longitudinal marker trajectory as fixed-effects and random-effects components.
  • Substitute the trajectory into a conditional hazard model at a specified time.
  • Separate population-level trajectory terms from subject-specific deviations.
  • Check assumptions about time, covariates, random effects, and measurement error.
  • Recognize when observed measurements or a misspecified trajectory can distort the hazard model.

From Marker Measurements to a Time-Varying Hazard Covariate

A longitudinal marker is measured at selected times, but an event can occur between measurements. A joint model represents the underlying marker course with a subject-specific latent trajectory, then uses that trajectory to describe how the event hazard changes over follow-up. The hazard covariate is therefore not simply the most recently recorded measurement: it is a model-based quantity defined at the event time.

The trajectory has two components. Fixed effects describe the average pattern associated with covariates and time; random effects allow each subject to depart from that pattern. Including the trajectory in the hazard means that both components can contribute to the hazard predictor. This tutorial concentrates on that construction and its mechanics. The specific current-value association and its hazard-ratio interpretation are treated separately.

Definition: For subject \(i\), let the latent marker trajectory at time \(t\) be $$ m_i(t)=\boldsymbol{x}_i(t)^\mathsf{T}\boldsymbol{\beta} +\boldsymbol{z}_i(t)^\mathsf{T}\boldsymbol{b}_i. $$ Here \(\boldsymbol{x}_i(t)\) and \(\boldsymbol{z}_i(t)\) are design vectors, \(\boldsymbol{\beta}\) is a vector of fixed-effects coefficients, and \(\boldsymbol{b}_i\) is subject \(i\)'s vector of random effects. A common longitudinal measurement model is \(Y_{ij}=m_i(t_{ij})+\epsilon_{ij}\), where \(Y_{ij}\) is the observed marker at time \(t_{ij}\) and \(\epsilon_{ij}\) is measurement error.

The value \(m_i(t)\) is the model's latent marker level at time \(t\), rather than the noisy observation \(Y_{ij}\). In a standard linear mixed model, one commonly assumes \(\boldsymbol{b}_i\sim N(\boldsymbol{0},D)\), for a covariance matrix \(D\), and measurement errors that are independent of the random effects and have mean zero and variance \(\sigma^2\). The exact trajectory design can be linear in time, include nonlinear basis functions, or depend on measured covariates.

Definition: A conditional hazard given the random effects is the instantaneous event rate among subjects still event-free at time \(t\), conditional on their random effects and the modeled covariate history. One common model with a single marker trajectory is $$ h_i(t\mid \boldsymbol{b}_i) =h_0(t)\exp\left\{\boldsymbol{w}_i(t)^\mathsf{T}\boldsymbol{\gamma} +\alpha m_i(t)\right\}. $$ Here \(h_0(t)\) is the baseline hazard, \(\boldsymbol{w}_i(t)\) is a vector of survival-model covariates, \(\boldsymbol{\gamma}\) is its coefficient vector, and \(\alpha\) scales the marker contribution. Conditional on \(\boldsymbol{b}_i\), the marker contribution can vary over time through \(m_i(t)\).

This formula is a convenient way to see the role of both trajectory components. Substitution gives

$$ \log h_i(t\mid \boldsymbol{b}_i) =\log h_0(t)+\boldsymbol{w}_i(t)^\mathsf{T}\boldsymbol{\gamma} +\alpha\boldsymbol{x}_i(t)^\mathsf{T}\boldsymbol{\beta} +\alpha\boldsymbol{z}_i(t)^\mathsf{T}\boldsymbol{b}_i. $$

The fixed-effects part contributes the modeled average trajectory at that time; the random-effects part shifts or reshapes it for subject \(i\). If the design vectors depend on time, either part can change over follow-up. The hazard model is conditional on the subject's random effects. It is not obtained by replacing those effects with zero, nor by treating an observed marker measurement as the latent value.

Worked Calculations

Worked Example: A Random Intercept and Slope

Suppose a hypothetical marker is measured in units per deciliter and time is measured in years. Its trajectory model is \(m_i(t)=2.0+0.40t+b_{0i}+b_{1i}t\). For one hypothetical subject, let \(b_{0i}=-0.30\) marker units and \(b_{1i}=0.10\) marker units per year. In the hazard model, let \(\alpha=0.25\) per marker unit, take the other covariate contribution as zero, and suppose \(h_0(2)=0.040\) per year. Find the trajectory and conditional hazard at year 2.

The fixed-effects trajectory at year 2 is \(2.0+0.40(2)=2.80\) marker units. The random-effects contribution is \(-0.30+0.10(2)=-0.10\) marker units. Thus

$$ m_i(2)=2.80-0.10=2.70\ \text{marker units}. $$

The marker contribution to the log hazard is \(\alpha m_i(2)=0.25(2.70)=0.675\). Therefore the conditional hazard is

$$ h_i(2\mid\boldsymbol{b}_i) =0.040\exp(0.675) =0.040(1.964) =0.07856\ \text{per year}. $$

This calculation evaluates the model's conditional hazard for this subject at this time. The exponentiated marker contribution, \(1.964\), is the multiplicative factor applied to the baseline hazard when the other covariate contribution is zero. It is not, by itself, a comparison between two specified subjects or exposure conditions.

Worked Example: Different Subject-Specific Trajectories

Consider the same trajectory form, \(m_i(t)=2.0+0.40t+b_{0i}+b_{1i}t\), and let \(\alpha=0.20\) per marker unit. Two hypothetical subjects have random effects \((b_{0A},b_{1A})=(0.20,-0.10)\) and \((b_{0B},b_{1B})=(-0.20,0.10)\), with slope units of marker units per year. Compute their marker contributions to the log hazard at years 0 and 2.

At year 0, the fixed part is \(2.0\). Subject A's random part is \(0.20\), giving \(m_A(0)=2.20\); subject B's random part is \(-0.20\), giving \(m_B(0)=1.80\). Their marker contributions are \(0.20(2.20)=0.440\) and \(0.20(1.80)=0.360\).

At year 2, the fixed part is \(2.0+0.40(2)=2.80\). Subject A's random part is \(0.20-0.10(2)=0\), so \(m_A(2)=2.80\). Subject B's random part is \(-0.20+0.10(2)=0\), so \(m_B(2)=2.80\). Each marker contribution is \(0.20(2.80)=0.560\).

The subjects' random slopes make their trajectories differ early in follow-up, while their marker contributions coincide at year 2 in this example. This is why a subject-specific trajectory cannot generally be represented by a single baseline marker value or a random intercept alone.

Worked Example: A Curved Trajectory at an Event Time

Suppose a hypothetical marker trajectory is \(m_i(t)=1.5+0.30t-0.04t^2+b_{0i}+b_{1i}t\), with time in years and marker values in units per liter. For a subject with \(b_{0i}=0.10\) marker units and \(b_{1i}=-0.05\) marker units per year, calculate the marker contribution to the log hazard at year 3 if \(\alpha=-0.30\) per marker unit.

The fixed-effects contribution is \(1.5+0.30(3)-0.04(3^2)=1.5+0.90-0.36=2.04\) marker units. The random-effects contribution is \(0.10-0.05(3)=-0.05\) marker units. Consequently, \(m_i(3)=2.04-0.05=1.99\) marker units, and the marker contribution is

$$ \alpha m_i(3)=(-0.30)(1.99)=-0.597. $$

The marker term therefore contributes \(-0.597\) to the log hazard at year 3. A negative value here means that this term lowers the log hazard relative to the same predictor with the marker term set to zero; the complete hazard also depends on the baseline hazard and other covariates.

Why the Trajectory Form Matters

The substitution can be justified directly. Begin with the specified conditional hazard and replace \(m_i(t)\) by its fixed- and random-effects representation:

$$ \begin{aligned} h_i(t\mid \boldsymbol{b}_i) &=h_0(t)\exp\left\{\boldsymbol{w}_i(t)^\mathsf{T}\boldsymbol{\gamma} +\alpha\left[ \boldsymbol{x}_i(t)^\mathsf{T}\boldsymbol{\beta} +\boldsymbol{z}_i(t)^\mathsf{T}\boldsymbol{b}_i \right]\right\}\\ &=h_0(t)\exp\left\{\boldsymbol{w}_i(t)^\mathsf{T}\boldsymbol{\gamma} +\alpha\boldsymbol{x}_i(t)^\mathsf{T}\boldsymbol{\beta} +\alpha\boldsymbol{z}_i(t)^\mathsf{T}\boldsymbol{b}_i\right\}. \end{aligned} $$

Thus, the trajectory-covariate construction carries the subject's random effects into the conditional hazard through the trajectory design \(\boldsymbol{z}_i(t)\). If the trajectory is differentiable in time, this also makes explicit how it can change the log-hazard predictor. Holding other time-varying terms fixed, the marker part has derivative \(\alpha\{ \boldsymbol{x}'_i(t)^\mathsf{T}\boldsymbol{\beta}+\boldsymbol{z}'_i(t)^\mathsf{T}\boldsymbol{b}_i\}\). This is a statement about the changing predictor, not a new hazard model or an interpretation of a hazard ratio.

The construction relies on several modeling conditions. The latent trajectory must be defined over the relevant risk period, including times when no marker was observed. The survival model must specify a valid baseline hazard and covariates available in the modeled history. The random-effects distribution and longitudinal measurement model must be appropriate for the intended analysis. For likelihood-based joint inference, assumptions about event and censoring processes must also be specified; in the usual setup, censoring is conditionally noninformative given the modeled information. If trajectory values after the last measurement are needed, they are model-based extrapolations, not additional observations.

Model Checks, Alternatives, and Limitations

A trajectory can appear numerically well behaved while being scientifically or statistically inadequate. Check whether the chosen time basis captures the observed marker pattern, whether random-effect estimates imply plausible individual courses, and whether the hazard contribution is sensitive to trajectory assumptions. In particular, inspect the fit near the beginning and end of follow-up, where sparse measurements can make the latent trajectory uncertain. A poor trajectory model can distort the time-varying covariate and, in turn, the fitted hazard association.

ApproachWhat enters the hazardKey distinction
Latent trajectory covariateA model-based marker value that can vary with time and subjectUses both fixed- and random-effects components to represent the marker course
Direct shared-random-effects termOne or more random effects themselvesLinks the hazard to selected subject deviations, rather than necessarily to the marker level at each time
Observed marker covariateA recorded measurement, often the latest availableCan incorporate measurement error and may be undefined between measurement times
Baseline marker covariateA marker value recorded at baselineDoes not represent subsequent within-subject change

These approaches answer different modeling questions and make different assumptions. The trajectory approach uses the longitudinal model to define a time-varying latent covariate; it does not make the resulting association causal. Its accuracy depends on the trajectory form, random-effects distribution, and adequacy of the joint model. It can also be difficult to estimate when there are few marker measurements per subject, little variation in trajectories, or limited event information.

  • Pitfall: substituting the latest observed marker. The reasoning is that the last available measurement is the subject's marker value until another measurement is taken. That treats a noisy observation as the latent trajectory, and can leave the covariate undefined or artificially constant between visits. The correction is to evaluate the fitted latent trajectory at the time in question.
  • Pitfall: omitting the random-effects contribution. Using only \(\boldsymbol{x}_i(t)^\mathsf{T}\boldsymbol{\beta}\) assigns the same modeled trajectory to subjects with the same fixed covariates, even when the longitudinal model allows individual departures. Include \(\boldsymbol{z}_i(t)^\mathsf{T}\boldsymbol{b}_i\) in the subject-specific trajectory.
  • Pitfall: treating a conditional hazard as a marginal hazard. The displayed hazard conditions on \(\boldsymbol{b}_i\). Averaging conditional hazards over a random-effects distribution does not in general produce the same hazard expression with random effects set to their mean.

Practical Workflow

1
Specify the longitudinal trajectory.
Choose the time and covariate design vectors, and state the fixed-effects and random-effects components and their units.
2
Specify the conditional hazard.
State the baseline hazard, survival covariates, marker contribution, and that the hazard is conditional on the subject's random effects.
3
Evaluate the trajectory at the time of interest.
Substitute that time and the subject's random effects into the trajectory, then use the resulting latent value in the hazard predictor.
4
Assess adequacy and uncertainty.
Check the trajectory fit, coverage of follow-up by marker measurements, and the sensitivity of hazard results to modeling choices.

Check Your Understanding

Answer each question using the trajectory and hazard definitions above. Solutions are included for checking your reasoning.

  1. If \(m_i(t)=3+0.5t+b_{0i}\), where \(b_{0i}=-0.4\), what is \(m_i(2)\)?
  2. For a marker contribution \(\alpha m_i(t)\), with \(\alpha=0.2\) per marker unit and \(m_i(t)=4\) marker units, what is the contribution to the log-hazard predictor?
  3. Why can the latest observed measurement differ from the trajectory value used at an event time between visits?
  4. In \(m_i(t)=\boldsymbol{x}_i(t)^\mathsf{T}\boldsymbol{\beta}+\boldsymbol{z}_i(t)^\mathsf{T}\boldsymbol{b}_i\), which component represents subject-specific departures from the fixed-effects trajectory?

Solutions. 1. \(m_i(2)=3+0.5(2)-0.4=3.6\) marker units. 2. The contribution is \(0.2(4)=0.8\) on the log-hazard scale. 3. The observed measurement includes measurement error and is recorded only at its visit time; the latent trajectory is a model-based value evaluated at the event time. 4. The random-effects component \(\boldsymbol{z}_i(t)^\mathsf{T}\boldsymbol{b}_i\) represents the subject-specific departure.

Clinical Biostats