Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › A Worked Comparison of Class-Specific Risks

Latent Class Joint Models · Tutorial 465 of 697

A Worked Comparison of Class-Specific Risks

Learn to combine class-specific survival predictions using baseline prevalences, and to update class weights when comparing risks among people who have already survived.

Advanced 11 min read

What You'll Learn

  • Convert fitted class-specific hazards into risks over a specified time horizon.
  • Combine class-specific risks using the population class prevalences.
  • Quantify how much each class contributes to the total predicted risk.
  • Update class weights when calculating risk conditional on survival to a later time.
  • Identify why an average hazard generally does not reproduce a mixture risk.
  • Recognize assumptions and diagnostic concerns when comparing fitted class-specific risks.

Why Compare Risks Across Classes?

A latent class joint model can describe groups with different longitudinal trajectories and different event hazards. A fitted hazard is not itself an event risk: it describes an instantaneous rate, whereas risk is the probability of an event by a stated time. To answer questions about event probability, the hazards must be translated into risks and then combined in a way that respects the class structure.

This distinction matters especially when a class is small but has a much higher hazard than the others. Its contribution to population-level risk can be much larger than its prevalence suggests. Conversely, the risk among people who have survived for some time is not generally obtained using the original class proportions, because survival changes the mix of classes in the remaining population.

Definition: Let \(G\) be a latent class taking values \(1,\ldots,K\), with baseline class prevalences \(\pi_g=P(G=g)\), where \(\sum_{g=1}^K\pi_g=1\). For a specified covariate profile, let \(S_g(t)\) be the class-specific probability of remaining event-free through time \(t\), and let \(R_g(t)=1-S_g(t)\) be the class-specific risk by time \(t\). The population-level risk is \(R(t)=\sum_{g=1}^K\pi_gR_g(t)\), provided the prevalences refer to the population at the time origin.

The comparison below assumes a single event type and a common time origin. Class membership is treated as fixed, even though it is unobserved; the class-specific survival predictions are conditional on membership in each class. If prevalences depend on covariates, the relevant prevalences are those for the covariate profile being predicted. The calculations are model-based predictions, not proof that the latent classes are naturally distinct populations.

The earlier material on marginal survival from a mixture of classes gives the central mixture idea: population survival is a prevalence-weighted average of class-specific survival. We use the equivalent risk scale here, with particular attention to comparing conditional and population-level quantities.

From Hazards to Class-Specific and Population Risks

For class \(g\), the hazard \(\lambda_g(t)\) is the instantaneous event rate among members of that class who have remained event-free until \(t\). Its cumulative hazard is \(\Lambda_g(t)=\int_0^t\lambda_g(u)\,du\). Under the usual continuous-time survival model, \(S_g(t)=\exp\{-\Lambda_g(t)\}\), so the risk is \(R_g(t)=1-\exp\{-\Lambda_g(t)\}\). If the hazard is constant at \(\lambda_g\), then \(\Lambda_g(t)=\lambda_gt\).

The population risk is a weighted average of class-specific risks, not a weighted average of hazards. The weights are the class prevalences at the time origin. The same calculation can be written using survival probabilities:

$$ S(t)=\sum_{g=1}^K\pi_gS_g(t), \qquad R(t)=1-S(t)=\sum_{g=1}^K\pi_g\{1-S_g(t)\}. $$

This identity follows because the event by time \(t\) occurs in exactly one class, and the class-specific event probabilities are conditional on \(G=g\). In symbols, \(P(T\le t)=\sum_g P(T\le t\mid G=g)P(G=g)\). Each term \(\pi_gR_g(t)\) is that class’s contribution to the overall risk. Dividing this contribution by \(R(t)\), when \(R(t)>0\), gives the proportion of the predicted risk total attributable to that class; it is not the class’s share of all events in an observed data set unless the model and population are appropriate for that comparison.

Worked Example: A Small High-Risk Class at Two Years

Suppose a hypothetical fitted two-class model gives baseline prevalences \(\pi_1=0.85\) and \(\pi_2=0.15\), with constant hazards of \(0.02\) and \(0.18\) events per person-year, respectively. Calculate each two-year risk, the population risk, and the share of the predicted risk total contributed by class 2.

The constant-hazard assumption gives cumulative hazards \(0.02(2)=0.04\) and \(0.18(2)=0.36\). Thus, \(R_1(2)=1-\exp(-0.04)\approx0.03921\), or \(3.921\%\), and \(R_2(2)=1-\exp(-0.36)\approx0.30232\), or \(30.23\%\).

Weighting the risks by baseline prevalence gives \(R(2)=0.85\{1-\exp(-0.04)\}+0.15\{1-\exp(-0.36)\}\approx0.07868\). The predicted population risk by two years is therefore about \(7.868\%\). Class 2 contributes \(0.15\{1-\exp(-0.36)\}\approx0.04535\) to this total. Its share is approximately \(0.04535/0.07868=0.5764\), or \(57.64\%\). Although this class represents only \(15\%\) of the baseline population, it contributes more than half of the model-implied risk total.

This is a comparison of expected risk contributions under the fitted model. It does not mean that class membership causes the higher risk, nor does it reveal a person’s true class with certainty.

Why the Risk Among Survivors Uses New Weights

Suppose the target is not risk from baseline, but the chance of an event between times \(s\) and \(t\), given that the person has remained event-free through \(s\), where \(t>s\). Two ingredients change: each class has a conditional interval risk, and the class mixture among survivors at \(s\) differs from the baseline mixture.

By Bayes’ rule, the probability of belonging to class \(g\) among people who have survived to \(s\) is proportional to the baseline prevalence times the probability of surviving to \(s\) in that class. Normalizing across classes yields the survivor-specific weights. Within class \(g\), the interval risk conditional on survival to \(s\) is \(1-S_g(t)/S_g(s)\). Combining these gives:

$$ P(s<T\le t\mid T>s) = \sum_{g=1}^K \underbrace{\frac{\pi_gS_g(s)}{\sum_{h=1}^K\pi_hS_h(s)}}_{\text{class weight among survivors at }s} \left\{1-\frac{S_g(t)}{S_g(s)}\right\}. $$

The formula assumes \(S_g(s)>0\) for classes receiving positive survivor weight, and that the class-specific survival functions refer to the same covariate profile and event definition. To verify it directly, the numerator of the conditional probability is \(\sum_g \pi_g\{S_g(s)-S_g(t)\}\): in class \(g\), this is the baseline probability of being in that class and surviving to \(s\), but experiencing the event by \(t\). The denominator is \(P(T>s)=\sum_g\pi_gS_g(s)\). Dividing numerator by denominator produces the displayed weighted interval risks.

Worked Example: Risk From Year One to Year Three

Continue with the hypothetical two-class model above. Calculate the probability of an event from year 1 through year 3, conditional on being event-free at year 1. The baseline prevalences are \(0.85\) and \(0.15\), and the constant hazards are \(0.02\) and \(0.18\) per person-year.

First calculate the class weights among year-one survivors. Their unnormalized weights are \(0.85\exp(-0.02)\approx0.83317\) and \(0.15\exp(-0.18)\approx0.12529\). The total probability of surviving to year 1 is approximately \(0.95846\), so the survivor weights are approximately \(0.83317/0.95846=0.86928\) and \(0.12529/0.95846=0.13072\).

The interval lasts two years. The class-specific conditional risks over it are \(1-\exp\{-0.02(3-1)\}=1-\exp(-0.04)\approx0.03921\) and \(1-\exp\{-0.18(3-1)\}=1-\exp(-0.36)\approx0.30232\). Therefore, the conditional mixture risk is approximately \(0.86928(0.03921)+0.13072(0.30232)=0.07360\), or \(7.360\%\), using unrounded values in the calculation.

The survivor weight for class 2 has fallen from \(15\%\) at baseline to about \(13.07\%\), because its higher hazard means fewer of its members remain event-free at year 1. It remains important to use the updated weights: retaining the original \(0.85\) and \(0.15\) weights would answer a different, incorrectly conditioned question.

Comparing With an Average-Hazard Shortcut

A common shortcut is to average the class-specific hazards using baseline prevalences, then treat that average as a constant population hazard. This generally does not give the correct population risk. The population hazard at time \(t\), when it is defined, weights each class by its share among those still at risk at \(t\), not by its baseline prevalence:

$$ \lambda_{\mathrm{pop}}(t) = \frac{\sum_{g=1}^K \pi_gS_g(t)\lambda_g(t)} {\sum_{g=1}^K \pi_gS_g(t)}. $$

Even this time-varying marginal hazard must be integrated over time to recover population risk. When class hazards differ, the risk-set composition changes, so the marginal hazard will generally change even if every class-specific hazard is constant.

Worked Example: A Three-Class Risk Calculation

Consider a hypothetical model with baseline prevalences \(0.70\), \(0.25\), and \(0.05\), and constant hazards \(0.03\), \(0.10\), and \(0.40\) events per person-year. Calculate the population risk by year 3 and compare it with the result from the average-hazard shortcut.

The three class-specific risks by year 3 are \(1-\exp(-0.09)\approx0.08607\), \(1-\exp(-0.30)\approx0.25918\), and \(1-\exp(-1.20)\approx0.69881\). Weighting the unrounded risks gives \(R(3)=0.70\{1-\exp(-0.09)\}+0.25\{1-\exp(-0.30)\}+0.05\{1-\exp(-1.20)\}\approx0.159984\). Thus the model-implied population risk is about \(16.00\%\).

The prevalence-weighted average of the class hazards is \(0.70(0.03)+0.25(0.10)+0.05(0.40)=0.066\) events per person-year. Treating \(0.066\) as a constant population hazard would give \(1-\exp\{-0.066(3)\}=1-\exp(-0.198)\approx0.1796\), or \(17.96\%\), which overstates the mixture risk here. The shortcut fails because it does not account for the changing composition of the population that remains event-free.

Assumptions, Diagnostics, and Limitations

Before interpreting a comparison, check that the reported prevalences and survival predictions target the same population, time origin, covariate values, and event definition. If the model specifies covariate-dependent class probabilities, use the probabilities for the covariate profile of interest rather than an overall prevalence. If the hazard depends on time, obtain \(S_g(t)\) from the cumulative hazard rather than multiplying one hazard value by elapsed time. If follow-up includes competing event types, a cause-specific hazard alone does not give the cumulative incidence for one event type; that requires accounting for the competing events.

Useful checks include verifying that the prevalences are nonnegative and sum to one; that each class survival curve is nonincreasing and lies between zero and one; that the marginal survival is the prevalence-weighted sum of class survival; and that all calculated risks lie between zero and one. Large changes in marginal risk across plausible class specifications may indicate that predictions depend strongly on class separation, rare-class estimates, or fitted hazard assumptions. A very small class with an extreme hazard can materially affect risk despite contributing little prevalence, so inspect its uncertainty and data support rather than relying only on the point estimate.

These calculations do not account automatically for estimation uncertainty. The displayed values are plug-in predictions using fitted prevalences and hazards. Confidence intervals for marginal or survivor-conditional risks must reflect uncertainty in both sets of fitted quantities and their dependence, for example through an appropriate model-based or resampling procedure. Also, class-specific risks are conditional on a latent classification model, not observed subgroup risks based on known class labels. Posterior classification uncertainty should not be erased by assigning every individual to their most likely class and treating that assignment as certain.

Common Mistakes

  • Calling a hazard a risk. A hazard has units of inverse time and is an instantaneous rate; a risk is a probability over a stated time interval.
  • Using an average hazard as if it were a constant cohort hazard. The class composition of those still at risk changes over time, so calculate class survival and mix the survival probabilities instead.
  • Using baseline prevalences for a survivor-conditional risk. Apply the survival-updated weights among people event-free at the conditioning time.
  • Calling a high class-specific risk a causal class effect. A latent class comparison is an association implied by the model and its assumptions, not evidence that class membership causes the event.
  • Rounding class risks too early. Use unrounded survival calculations for weighted sums and round only the final reported result.
Key takeaway: For risk from baseline, combine class-specific risks using baseline prevalences. For risk after surviving to time \(s\), first update those prevalences by class-specific survival to \(s\), then average the class-specific interval risks using the survivor weights.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. A two-class model has baseline prevalences \(0.80\) and \(0.20\), with constant hazards \(0.04\) and \(0.20\) per year. Write the expression for population risk at year 2.
  2. Why can a class with prevalence \(0.10\) account for more than \(10\%\) of the predicted risk total?
  3. What weights should be used to calculate the risk from year 2 to year 4, conditional on survival to year 2?
  4. For the three-class example, why is the prevalence-weighted average hazard not enough to calculate risk by year 3?

Solutions. (1) The risk is \(0.80\{1-\exp(-0.04\times2)\}+0.20\{1-\exp(-0.20\times2)\}\). (2) Its class-specific risk may be sufficiently high that its prevalence-weighted contribution, \(\pi_gR_g(t)\), is a large share of \(\sum_h\pi_hR_h(t)\). (3) Use \(\pi_gS_g(2)/\sum_h\pi_hS_h(2)\) for each class, then weight that class’s conditional interval risk \(1-S_g(4)/S_g(2)\). (4) Class-specific survival changes the class composition of those still event-free, so the marginal hazard is generally time-varying even when the class hazards are constant.

Clinical Biostats