Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Sensitivity to the Number and Shape of Classes

Latent Class Joint Models · Tutorial 461 of 697

Sensitivity to the Number and Shape of Classes

You will learn to compare plausible class counts and trajectory shapes, and to identify which scientific conclusions are stable or model-dependent.

Advanced 13 min read

What You'll Learn

  • Distinguish sensitivity to the number of classes from sensitivity to the trajectory specification.
  • Compare fitted trajectories at meaningful times and on the outcome’s measurement scale.
  • Recalculate survival associations on a common, interpretable scale across candidate models.
  • Recognize when class-specific conclusions depend on mixture structure.
  • Use fit summaries and diagnostics without treating one criterion as definitive.
  • Report model-dependent findings alongside conclusions that remain stable.

Why Sensitivity Analysis Matters

A latent-class joint model describes a population as a mixture of unobserved groups, with a longitudinal trajectory and a survival process associated with each group. The resulting classes are features of the fitted model; changing the number of classes or the form of their trajectories can change the estimated groups, their proportions, and their event associations. A conclusion that appears compelling under one specification may therefore be fragile.

Sensitivity analysis asks whether the substantive conclusions are similar across a small set of plausible, adequately fitted candidate models. It is not a search for a specification that produces the preferred result. Nor does agreement across models prove that the latent groups are real. The goal is to distinguish stable findings from those that depend on modeling choices.

Definition: Sensitivity to the number and shape of classes is the extent to which fitted class prevalence, longitudinal trajectories, and survival associations change when a joint model is refitted using alternative plausible class counts or alternative forms for the class-specific trajectories. A comparison is informative only when the candidate models use the same analytic sample, outcome definitions, time scale, covariates, and event and censoring information.

For a subject in class \(c\), write the longitudinal mean as \(m_c(t)\), where \(t\) is time, and let \(\pi_c\) denote the class probability, with \(\sum_c \pi_c=1\). A common survival specification is \(h_i(t\mid C_i=c,b_i,w_i)=h_{0c}(t)\exp\{\gamma_c^\mathsf{T}w_i+\alpha_c m_i(t)\}\), where \(C_i\) is the latent class, \(b_i\) denotes any within-class random effects, \(w_i\) denotes survival covariates, and \(m_i(t)\) is the subject-specific latent marker trajectory. The exact specification can vary, but comparisons must refer to the same quantities and conditioning assumptions.

Candidate fits should be obtained under the model’s stated assumptions: the class probabilities and component distributions define a valid mixture; the longitudinal and survival contributions are combined according to the chosen conditional-independence or shared-random-effects structure; and the event-time and censoring model is appropriate for the observed data. Comparisons also require credible numerical fits. A failed convergence check or a solution that changes substantially across starting values is not a sound candidate for scientific interpretation.

What to Compare

Compare more than a single fit statistic. First, examine overall fit and complexity using criteria such as AIC or BIC, computed on the same data and likelihood scale. Second, compare class-level results that answer the scientific question: prevalence, predicted trajectories at prespecified times, and survival associations on a common scale. Third, inspect whether classes remain meaningfully distinct and sufficiently represented. The material on class separation, posterior classification uncertainty, local maxima, and within-class residual checks is useful for interpreting these diagnostics; none replaces the sensitivity comparison itself.

Align classes by their estimated pattern, not by their numeric labels. A “class 1” in a two-class fit need not correspond to “class 1” in a three-class fit. Compare trajectories over the observed time range and at scientifically meaningful times, rather than comparing polynomial coefficients in isolation: coefficients can change scale or interpretation when the trajectory form changes.

Worked Example: Fit Criteria Disagree About Class Count

Suppose three candidate models are fitted to the same hypothetical sample of \(n=240\) subjects. They have respectively two, three, and four classes. Their maximized log-likelihoods and numbers of estimated parameters are \((-1180,18)\), \((-1165,27)\), and \((-1160,36)\). Assume each fit converged reliably and used the same response, covariates, and observation window.

For this comparison, calculate \(\mathrm{AIC}=-2\ell+2k\) and \(\mathrm{BIC}=-2\ell+k\log(n)\), where \(\ell\) is the maximized log-likelihood and \(k\) is the number of estimated parameters. Smaller values are preferred by each criterion, but the criteria penalize complexity differently.

For two classes, \(\mathrm{AIC}=-2(-1180)+2(18)=2360+36=2396\). Since \(\log(240)\approx5.4806\), \(\mathrm{BIC}=2360+18(5.4806)\approx2458.65\).

For three classes, \(\mathrm{AIC}=2330+54=2384\), and \(\mathrm{BIC}=2330+27(5.4806)\approx2477.98\). For four classes, \(\mathrm{AIC}=2320+72=2392\), and \(\mathrm{BIC}=2320+36(5.4806)\approx2517.30\).

AIC is smallest for three classes, whereas BIC is smallest for two. This disagreement is not a calculation error and does not establish that either count is scientifically correct. It motivates examining whether the third class gives a reproducible, interpretable trajectory or merely divides an existing group, and whether the substantive results change. The example’s likelihood values alone cannot answer those questions.

Comparing Trajectory Shapes

A class count can be held fixed while the trajectory specification changes. For example, a linear mean \(m_c(t)=\beta_{0c}+\beta_{1c}t\) imposes a constant rate of change. A quadratic mean \(m_c(t)=\beta_{0c}+\beta_{1c}t+\beta_{2c}t^2\) allows curvature. These are different assumptions about how the mean evolves, not merely different ways to label the same fitted curve.

Compare fitted means in the outcome’s units at times that have adequate data support. Also compare clinically or scientifically meaningful features, such as the direction of change, whether curves cross, and the size of the contrast between classes. A dramatic difference at the boundary of follow-up may reflect extrapolation rather than reliable evidence. The trajectory model should be assessed alongside residual patterns and the distribution of actual observation times.

Worked Example: A Shape Change Alters the Trajectory Contrast

In a hypothetical two-class fit, consider class A under two specifications. The linear fit gives \(m_A(t)=20+0.8t\); the quadratic fit gives \(m_A(t)=20+0.2t+0.15t^2\). Time is measured in years and the marker in units. Suppose both fits were estimated on the same data, and follow-up from 0 to 6 years is well represented.

At \(t=2\), the linear estimate is \(20+0.8(2)=21.6\) units. The quadratic estimate is \(20+0.2(2)+0.15(2^2)=20+0.4+0.6=21.0\) units, a difference of \(21.0-21.6=-0.6\) units.

At \(t=6\), the linear estimate is \(20+0.8(6)=24.8\) units. The quadratic estimate is \(20+0.2(6)+0.15(6^2)=20+1.2+5.4=26.6\) units, a difference of \(26.6-24.8=1.8\) units. Thus the apparent trajectory contrast depends on time: the fits differ modestly at year 2 and more at year 6.

These calculations do not show which form is correct. The comparison should include class B as well, uncertainty around the fitted means, observed data support near each time, and residual behavior. If the study’s key conclusion concerns late follow-up, the 1.8-unit difference deserves particular attention.

Why Survival Results Can Shift

A change in trajectory shape can affect survival results because the longitudinal trajectory may enter the hazard model. A change in class count can also reassign subjects or split a class, changing the fitted class-specific association. Consequently, report comparable survival quantities, not just the raw association coefficients. For a model with a current-marker association \(\alpha_c\), a five-unit marker contrast at a fixed time, holding the other modeled quantities constant, corresponds to a hazard ratio \(\exp(5\alpha_c)\). This is a conditional association, not a causal effect.

Mixture survival also explains why a class-specific result need not describe the population-level pattern. For simplicity, suppose class \(c\) has baseline probability \(\pi_c\) and survival function \(S_c(t)\). The marginal survival function is \(S(t)=\sum_c\pi_cS_c(t)\). Differentiating and using \(h_c(t)=-S'_c(t)/S_c(t)\) gives

$$ h(t)=-\frac{S'(t)}{S(t)} =\frac{\sum_c \pi_c S_c(t)h_c(t)} {\sum_c \pi_c S_c(t)} =\sum_c \frac{\pi_c S_c(t)}{S(t)}h_c(t). $$

The final weights are the class proportions among subjects still event-free at time \(t\), not generally the baseline proportions \(\pi_c\). They change over time when class-specific survival differs. Thus a revised class structure can affect both the component hazards and the mixture’s evolving composition. This derivation assumes the stated mixture survival representation; covariate-specific survival requires conditioning on covariates and using the corresponding conditional component functions.

Worked Example: Compare a Class-Specific Hazard Association

Suppose two plausible hypothetical models have the same two classes but different trajectory shapes. In one fit, the estimated current-marker association for a matched class is \(\hat{\alpha}=0.10\) per marker unit, with a 95% confidence interval \((0.02,0.18)\). In the other fit, it is \(\hat{\alpha}=0.03\), with interval \((-0.04,0.10)\). Assume the marker is measured in units and the hazard model includes \(\alpha m_i(t)\) in its log hazard.

For a five-unit contrast, the first model gives \(\exp(5(0.10))=\exp(0.50)\approx1.649\). Its interval on the same scale is \((\exp(5(0.02)),\exp(5(0.18)))=(\exp(0.10),\exp(0.90))\approx(1.105,2.460)\). Under that model, a five-unit higher latent marker value is associated with an estimated hazard 1.649 times as large, conditional on the model’s class and other terms.

The second model gives \(\exp(5(0.03))=\exp(0.15)\approx1.162\), with interval \((\exp(-0.20),\exp(0.50))\approx(0.8187,1.649)\). Its interval includes 1, so these data and this model do not rule out no conditional hazard association at the 5% level using this interval. The estimates differ materially, and the second interval is less conclusive; neither result establishes that the association is causal. The change should be reported as evidence that this survival conclusion is specification-sensitive.

A Practical Comparison and Its Limits

A disciplined comparison separates numerical fit, predictive adequacy, and scientific interpretation. Information criteria summarize fit with a complexity penalty; they do not show that class trajectories are credible. A likelihood-ratio test can be appropriate for certain nested models under regularity conditions, but adding mixture components can put parameters on boundaries or make them unidentified under the null. The usual reference chi-square distribution may then fail. AIC and BIC, predictive assessment, and substantive examination can complement one another, but none turns an ill-fitting candidate into an acceptable model.

Use the same outcome and time scales, covariate definitions, and analysis sample wherever possible. Check convergence from multiple starting values, class prevalence, uncertainty, residual patterns, and whether each fitted trajectory is supported by observations. A tiny estimated class, highly uncertain trajectory, or markedly different solutions across starts weakens the interpretation of that candidate. If models have different analytic samples or likelihood definitions, raw likelihood criteria may not be directly comparable.

A useful report states which model features were varied, which were held fixed, the fit summaries used, and what changed in the quantities central to the scientific question. Present trajectory predictions at selected times with uncertainty, class proportions with appropriate caution, and hazard associations on a common scale. State plainly when an interpretation depends on the chosen class count or shape. Sensitivity analysis does not eliminate uncertainty about the number or meaning of latent classes; it makes that dependence visible.

Common Mistake

Common pitfall: “The three-class model has the best AIC, so its three groups are the true population subgroups.” The reasoning is wrong because AIC is a relative fit-complexity criterion among the candidates considered, not a test that latent groups exist or that this model is true. Instead, report the comparison, inspect whether the added class is stable and interpretable, and show whether the scientific conclusions persist under other plausible specifications.

Check Your Understanding

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

  1. Two candidate models use the same data. AIC favors three classes and BIC favors two. What can you conclude, and what further comparison is needed?
  2. A quadratic trajectory and a linear trajectory give nearly identical fitted means early in follow-up but differ substantially near the end. Name two checks needed before interpreting the late difference.
  3. A fitted association is \(\hat{\alpha}=0.08\) per marker unit. What is the hazard ratio for a three-unit contrast under the stated current-marker model?
  4. Why can the marginal hazard of a mixture change over time even if the class-specific hazards are constant over time?

Solutions. (1) The criteria rank these candidates differently; neither establishes a true class count. Compare trajectories, prevalence, diagnostics, and conclusions on common scales. (2) Check whether observations support late follow-up and examine uncertainty and residual behavior there; a boundary difference may be weakly supported. (3) \(\exp(3(0.08))=\exp(0.24)\approx1.271\), a conditional hazard ratio for a three-unit higher marker value, holding other modeled quantities fixed. (4) The mixture weights among event-free subjects are proportional to \(\pi_cS_c(t)\); they change as classes with different survival contribute different proportions of those still at risk.

Clinical Biostats