Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Specifying Class-Specific Event Risk

Latent Class Joint Models · Tutorial 445 of 697

Specifying Class-Specific Event Risk

Learn to build and compare class-specific event-risk models, and see how baseline hazards and covariate effects shape survival within each trajectory class.

Advanced 10 min read

What You'll Learn

  • Specify class-specific hazards using shared or class-varying baseline hazards and covariate effects.
  • Derive the corresponding class-conditional survival functions from the hazard.
  • Interpret hazard ratios and survival probabilities in context and with units.
  • Calculate event-time and right-censoring likelihood contributions under a specified class.
  • Identify assumptions, diagnostics, and limitations of class-specific event-risk specifications.

Why Specify Event Risk by Class?

A latent trajectory class describes a group with a characteristic longitudinal pattern. Individuals in different classes may also have different event risks, even when their measured covariates are the same. A class-specific event model makes that possibility explicit: it allows the event hazard to depend on latent class membership, on covariates, or on both.

The modeling decision is not simply whether to use “a hazard for each class.” One must decide which parts of the hazard structure differ: the baseline hazard, the covariate effects, or both. These choices determine which survival patterns the model can represent. The earlier material on latent classes and factorizing a latent class joint model supplies the mixture framework; here the focus is the form and meaning of the event-risk component.

Definition: Let \(C_i\in\{1,\ldots,K\}\) denote the latent class of individual \(i\), and let \(T_i\) be that individual’s event time. The class-conditional hazard \(\lambda_k(t\mid x_i)\) is the instantaneous event rate at time \(t\), conditional on being event-free immediately before \(t\), class \(C_i=k\), and covariates \(x_i\). Its units are inverse time. The corresponding class-conditional survival function is \(S_k(t\mid x_i)=P(T_i>t\mid C_i=k,x_i)\).

Hazard, Cumulative Hazard, and Survival

A common specification is a proportional-hazards model within each class:

$$ \lambda_k(t\mid x_i)=\lambda_{0k}(t)\exp(\beta_k^\top x_i). $$

Here \(\lambda_{0k}(t)\) is the baseline hazard for class \(k\), and \(\beta_k\) is a vector of covariate coefficients. The baseline hazard is the hazard when the covariate vector is zero (or at its chosen reference values). The exponential term keeps the hazard nonnegative. If a covariate increases by one unit while other covariates are held fixed, the hazard is multiplied by \(\exp(\beta_{kj})\), under this model.

Define the cumulative baseline hazard by \(\Lambda_{0k}(t)=\int_0^t\lambda_{0k}(u)\,du\). Integrating the hazard gives the class-conditional cumulative hazard \(\Lambda_k(t\mid x_i)=\Lambda_{0k}(t)\exp(\beta_k^\top x_i)\). Since survival is the exponential of minus cumulative hazard, the survival function is:

$$ S_k(t\mid x_i)=\exp\left\{-\Lambda_{0k}(t)\exp(\beta_k^\top x_i)\right\}. $$

This relation clarifies why hazards and survival probabilities should not be interchanged. A hazard is an instantaneous rate, whereas survival is a probability of remaining event-free through time \(t\). A larger hazard over an interval implies lower survival over that interval, but a hazard value is not itself an event probability.

Choosing What Is Shared Across Classes

The baseline hazard and covariate effects can each be shared or allowed to vary by class. A shared baseline means classes have the same baseline event-time pattern; class-varying coefficients allow covariates to modify risk differently across classes. Conversely, class-specific baselines can capture different underlying event-time patterns even when covariate effects are constrained to be common.

SpecificationHazard formWhat may differ across classes?
Shared baseline and effects\(\lambda_k(t\mid x)=\lambda_0(t)\exp(\beta^\top x)\)Neither the baseline hazard nor covariate effects; event risk is the same across classes conditional on \(x\).
Class-specific baselines, shared effects\(\lambda_k(t\mid x)=\lambda_{0k}(t)\exp(\beta^\top x)\)Baseline event-time patterns, but not covariate hazard ratios.
Shared baseline, class-specific effects\(\lambda_k(t\mid x)=\lambda_0(t)\exp(\beta_k^\top x)\)Covariate hazard ratios, but not baseline event-time patterns.
Class-specific baselines and effects\(\lambda_k(t\mid x)=\lambda_{0k}(t)\exp(\beta_k^\top x)\)Both baseline patterns and covariate hazard ratios.

These are modeling constraints, not statements about what the data must show. A fully class-specific model is more flexible, but estimates more parameters and may be unstable when some classes are small or have few events. A more constrained model can improve precision if its restrictions are reasonable, but can obscure genuine differences if they are not.

Worked Example: Different Baseline Hazards Across Classes

Suppose, hypothetically, that two trajectory classes have constant baseline hazards and no covariates: \(\lambda_{01}(t)=0.04\) events per person-year and \(\lambda_{02}(t)=0.10\) events per person-year. Under a constant hazard \(\lambda\), \(S(t)=\exp(-\lambda t)\). Calculate survival through 3 years in each class.

For class 1, \(S_1(3)=\exp\{-(0.04\text{ per year})(3\text{ years})\}=\exp(-0.12)=0.8869\). Thus the model-implied probability of remaining event-free beyond 3 years in this class is about 88.69%.

For class 2, \(S_2(3)=\exp\{-(0.10\text{ per year})(3\text{ years})\}=\exp(-0.30)=0.7408\). The corresponding probability is about 74.08%. The class 2 hazard is \(0.10/0.04=2.5\) times the class 1 hazard at every time, but the 3-year event risks are \(1-0.7408=0.2592\) and \(1-0.8869=0.1131\), not in a ratio of 2.5. Hazard ratios are not generally risk ratios.

The constant-hazard assumption is essential to these calculations: the cumulative hazard is \(\lambda t\). If the baseline hazard varied with time, survival would instead be calculated from its integrated cumulative hazard.

Worked Example: Class-Specific Covariate Effects With a Shared Baseline

Consider a hypothetical binary covariate \(x\), with \(x=0\) as the reference, and a shared constant baseline hazard of \(0.03\) per year. Suppose the coefficient is \(0.5\) in class 1 and \(-0.2\) in class 2. Calculate the hazards for \(x=1\), and the survival probabilities through 2 years for that covariate value.

For class 1, \(\lambda_1(t\mid x=1)=0.03\exp(0.5)=0.04946\) per year. Its hazard ratio comparing \(x=1\) with \(x=0\) is \(\exp(0.5)=1.649\). For class 2, \(\lambda_2(t\mid x=1)=0.03\exp(-0.2)=0.02456\) per year, with hazard ratio \(\exp(-0.2)=0.8187\).

Because the hazards are constant here, \(S_k(2\mid x=1)=\exp\{-2\lambda_k(t\mid x=1)\}\). In class 1 this is \(\exp\{-(2)(0.04946)\}=\exp(-0.09892)=0.9058\). In class 2 it is \(\exp\{-(2)(0.02456)\}=\exp(-0.04912)=0.9521\). Under this hypothetical model, the covariate is associated with a higher hazard in class 1 and a lower hazard in class 2, relative to \(x=0\) within the respective classes. This is a model-based association, not a causal conclusion.

The shared-baseline assumption is reflected in the fact that both classes use \(0.03\) per year before applying their class-specific covariate multipliers. Allowing class-specific baselines instead would let their hazards differ even at \(x=0\).

Likelihood Contributions Under Right Censoring

For an observed follow-up time \(Y_i=\min(T_i,D_i)\), where \(D_i\) is a censoring time, let \(\delta_i=1\) indicate that the event was observed and \(\delta_i=0\) indicate right censoring. Conditional on class \(k\) and covariates, the event-time contribution is the density \(f_k(Y_i\mid x_i)=\lambda_k(Y_i\mid x_i)S_k(Y_i\mid x_i)\) when the event is observed. For a right-censored observation, the contribution is \(S_k(Y_i\mid x_i)\): the individual is known to have remained event-free through \(Y_i\).

$$ L_{ik}= \left\{\lambda_k(Y_i\mid x_i)\right\}^{\delta_i} S_k(Y_i\mid x_i). $$

This expression assumes that censoring is noninformative for the event time conditional on the modeled information, so the censoring mechanism does not add an event-time factor to this likelihood contribution. It is also conditional on a specified class; it does not mean that an individual’s latent class is observed. In the latent-class model, this component is combined with the class-membership and longitudinal components according to the model’s mixture structure.

Worked Example: Event and Censoring Contributions

Suppose, hypothetically, that class A has a constant hazard of \(0.04\) per year and class B has a constant hazard of \(0.07\) per year. For an individual followed for 2 years, calculate the conditional event-time contribution if an event occurs exactly at year 2, and the survival contribution if instead the individual is censored at year 2.

For class A, survival to year 2 is \(S_A(2)=\exp\{-(0.04)(2)\}=\exp(-0.08)=0.9231\). With an event at year 2, the contribution is the event density, \(\lambda_A(2)S_A(2)=(0.04)(0.9231)=0.03692\) per year. Using the unrounded survival value gives \(0.04e^{-0.08}=0.03692465\) per year.

If the class A individual is instead censored at year 2, the contribution is \(S_A(2)=0.9231\), with no event-density factor. For comparison, class B has \(S_B(2)=e^{-(0.07)(2)}=e^{-0.14}=0.8694\). Its event contribution at year 2 is \((0.07)(0.8694)=0.06086\) per year, while its censoring contribution is \(0.8694\). The event density has units of inverse years; the survival contribution is a dimensionless probability.

These are class-conditional contributions. They do not justify assigning an individual to class A or B based on the observed event alone. The model accounts for uncertainty in class membership through its mixture structure.

Derivation and Assumptions

The survival formula follows directly from the definition of the hazard. For a continuous event time, the hazard satisfies \(\lambda_k(t\mid x)=-\frac{d}{dt}\log S_k(t\mid x)\), with \(S_k(0\mid x)=1\). Integrating from 0 to \(t\) gives:

$$ \log S_k(t\mid x)=-\int_0^t\lambda_k(u\mid x)\,du =-\exp(\beta_k^\top x)\int_0^t\lambda_{0k}(u)\,du. $$

Exponentiating both sides yields \(S_k(t\mid x)=\exp\{-\Lambda_{0k}(t)\exp(\beta_k^\top x)\}\). The factorization of the integral uses the assumption that \(\beta_k\) and \(x\) do not vary over follow-up. If a time-varying covariate or time-varying coefficient is used, that factor cannot in general be taken outside the integral.

The proportional-hazards form assumes that, within class \(k\), each covariate has a time-constant multiplicative effect on the hazard. A suitable baseline hazard must be nonnegative and integrable over the time interval of interest. The class-conditional interpretation also relies on the model’s class definition and its assumptions about how longitudinal and event information are related. The formulation here treats the event component conditional on class and covariates; it does not by itself establish that the class model is correct.

1
Choose the restrictions.
Decide whether baseline hazards, covariate effects, or both are shared across classes, guided by the scientific question and available event information.
2
State the conditional hazard.
Write \(\lambda_k(t\mid x)\) explicitly, identify the reference covariate values, and specify how the baseline hazard is represented.
3
Derive survival and observation contributions.
Integrate the hazard to obtain \(S_k(t\mid x)\), then use the event density for an observed event and survival for right censoring.
4
Check adequacy and uncertainty.
Inspect class-specific event counts and survival patterns, assess proportional-hazards fit, and consider whether any class-specific parameters are weakly supported.

Diagnostics, Alternatives, and Limitations

A model can be mathematically valid yet poorly suited to the data. Useful checks include comparing observed and model-implied survival patterns within classes, examining whether estimated hazards or survival curves show systematic time-dependent discrepancies, and checking whether the proportional-hazards restriction is plausible for important covariates. In a latent-class analysis, class-specific diagnostics depend on estimated membership and are therefore uncertain; treating estimated class labels as known can make these checks look more definitive than they are.

Watch especially for sparse event information. A class with few events may not support a flexible baseline hazard and many class-specific coefficients. Estimates may then be unstable, and apparent class differences may reflect uncertainty rather than reliable separation. Shared parameters or a more parsimonious baseline can reduce the number of parameters, but impose restrictions that should be scientifically defensible. Sensitivity to reasonable alternative specifications is informative.

A shared-baseline model with class-varying effects is appropriate when the classes are assumed to share the underlying event-time pattern at reference covariate values, but covariate associations may differ. A class-specific-baseline model with shared effects instead allows different reference survival patterns while constraining covariate hazard ratios to agree. Allowing both components to vary is the most flexible of these four choices, and sharing both is the most restrictive. These models are alternatives within the event component; neither flexibility nor fit alone guarantees meaningful or stable latent classes.

The proportional-hazards structure is not the only possible event model. For example, one could use a parametric event-time distribution or a model with time-varying covariate effects. Those alternatives change the assumptions and interpretation; they should not be adopted simply to make a fitted curve look closer to observed data. All choices remain limited by censoring, measurement quality, event counts, and the adequacy of the latent-class representation.

Common Mistake

Pitfall: “Class 2 has twice the hazard, so twice as many individuals will experience the event by year 3.” A hazard ratio is not generally a ratio of cumulative event probabilities. Under constant hazards of \(0.04\) and \(0.08\) per year, the 3-year event risks are \(1-e^{-0.12}=0.1131\) and \(1-e^{-0.24}=0.2134\), which are not in a ratio of two. Compare the relevant survival or cumulative-risk quantities directly, and state the time horizon.

A related mistake is to interpret a class-specific hazard as a risk for a person whose class is known with certainty. Class membership is latent. The hazard specification describes event risk conditional on class; inference about an individual or the population must account for uncertainty in class membership rather than silently replacing it with a fixed label.

Key takeaway: A class-specific event model is defined by what it permits to vary across classes: baseline hazards, covariate effects, or both. State those constraints, derive survival from the hazard, and interpret class-conditional quantities with their time scale and units.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. Under a shared baseline hazard and class-specific coefficients, which model component is constrained to be equal across classes?
  2. A class has a constant hazard of \(0.05\) per year and no covariates. What is its survival probability through 4 years?
  3. For a right-censored person observed event-free through time \(t\), which class-conditional event-time likelihood contribution is used?
  4. Why does a hazard ratio of 1.5 not imply a 50% increase in event probability by a chosen follow-up time?
  5. Name one diagnostic concern that becomes especially important when allowing both baselines and covariate effects to vary by class.

Solutions. (1) The baseline hazard is shared; the covariate coefficients may differ. (2) \(S(4)=e^{-(0.05)(4)}=e^{-0.2}=0.8187\), so the model-implied survival probability is 81.87%. (3) The contribution is \(S_k(t\mid x)\), conditional on class and covariates. (4) A hazard ratio compares instantaneous rates, whereas event probability accumulates over time through \(1-S(t)\); their relationship depends on the baseline hazard and follow-up duration. (5) Sparse events may leave class-specific parameters unstable, so check class-specific event counts, uncertainty, and sensitivity to simpler shared-parameter specifications.

Clinical Biostats