Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Choosing the Number of Trajectory Classes

Latent Class Joint Models · Tutorial 456 of 697

Choosing the Number of Trajectory Classes

Compare candidate numbers of trajectory classes using statistical fit and scientific judgment, and understand why no single selection rule is decisive.

Advanced 10 min read

What You'll Learn

  • Define the observed-data likelihood and parameter count used when comparing class counts.
  • Calculate and interpret AIC and BIC for candidate latent class joint models.
  • Explain why likelihood cannot decrease in a globally optimized, nested class-count comparison.
  • Recognize why a routine chi-square likelihood-ratio test is generally invalid for adding a class.
  • Assess class prevalence, trajectory and risk separation, and substantive interpretability alongside fit statistics.
  • Identify limitations of information criteria and complementary approaches to model choice.

Why Choosing the Class Count Requires More Than a Fit Statistic

A latent class joint model represents the population as a mixture of subpopulations with different longitudinal trajectories and, potentially, different event-risk patterns. The number of classes is not simply a descriptive detail: it determines how many distinct subpopulations the model can represent, and it affects both its fit and the meaning assigned to its components. Too few classes may conceal important heterogeneity; too many may divide the data into poorly supported or scientifically unconvincing groups.

Information criteria help compare candidate class counts, but they do not settle the question on their own. Their rankings depend on how they trade off fit and complexity, and the extra classes must also be supported by the data and interpretable in the scientific setting.

Likelihood and Information Criteria

For subject \(i\), let \(D_i\) denote the observed longitudinal measurements and event-time information, including any censoring indicator. In a \(K\)-class joint model, let \(\pi_{ik}\) be the probability of class \(k\) for subject \(i\), and let \(f_{ik}(D_i)\) be the class-specific contribution to the observed-data density. The observed-data likelihood sums over the unobserved class membership:

$$ L_K(\theta_K)=\prod_{i=1}^n \left\{\sum_{k=1}^K \pi_{ik} f_{ik}(D_i)\right\}, \qquad \ell_K(\widehat{\theta}_K)=\log L_K(\widehat{\theta}_K). $$

Here, \(\theta_K\) contains the parameters for the class-membership model and the class-specific longitudinal and event models, and \(\widehat{\theta}_K\) is an estimate that maximizes the observed-data log likelihood. Let \(q_K\) be the number of freely estimated parameters in that model. Parameter counting must match the fitted specification: for example, adding a class may add trajectory and event-risk parameters as well as membership parameters.

Definition: The Akaike information criterion and Bayesian information criterion for a fitted \(K\)-class model are
$$ \mathrm{AIC}_K=-2\ell_K(\widehat{\theta}_K)+2q_K, \qquad \mathrm{BIC}_K=-2\ell_K(\widehat{\theta}_K)+q_K\log(n). $$

A smaller value indicates preference under that criterion among the models compared. AIC applies a fixed complexity penalty of \(2q_K\); BIC applies a penalty that increases with sample size, \(q_K\log(n)\). Neither value is an absolute measure of whether the model is adequate.

AIC is motivated by estimating predictive information loss, with its penalty accounting approximately for the optimism from fitting parameters. BIC can be motivated by a large-sample approximation to a model’s marginal likelihood. Under regularity conditions, a Laplace approximation to the integral over parameters gives a log marginal likelihood of approximately \(\ell_K(\widehat{\theta}_K)-\frac{q_K}{2}\log(n)\), up to terms that do not grow with \(n\). Multiplying by \(-2\) yields the BIC expression. These are different goals and approximations, so their rankings may differ.

Mixture models are not fully regular when a class can have zero mixing probability or when component parameters become unidentified as that probability approaches zero. Consequently, the usual large-sample justification for BIC is not exact for every mixture-model comparison. AIC and BIC remain widely used summaries, but their results should be treated as evidence to weigh rather than automatic answers.

Worked Example: Comparing AIC and BIC Across Three Class Counts

Suppose three candidate joint models are fitted to the same hypothetical data from \(n=240\) subjects, using the same observed outcomes and likelihood definition. Their maximized log likelihoods and parameter counts are:

Number of classes \(K\)\(\ell_K(\widehat{\theta}_K)\)\(q_K\)
1-18208
2-174817
3-172926

For one class, \(\mathrm{AIC}_1=-2(-1820)+2(8)=3640+16=3656\). Since \(\log(240)\approx5.4806\), \(\mathrm{BIC}_1=3640+8(5.4806)=3683.8\).

For two classes, \(\mathrm{AIC}_2=3496+34=3530\), and \(\mathrm{BIC}_2=3496+17(5.4806)=3589.2\). For three classes, \(\mathrm{AIC}_3=3458+52=3510\), and \(\mathrm{BIC}_3=3458+26(5.4806)=3600.5\).

AIC is smallest for the three-class model, whereas BIC is smallest for the two-class model. The three-class fit improves the log likelihood over the two-class fit by \(19\), or \(38\) on the \(-2\log L\) scale. The extra nine parameters add \(18\) to AIC’s penalty, so AIC favors the additional class. They add \(9\log(240)\approx49.3\) to BIC’s penalty, so BIC favors two classes. This disagreement is not an arithmetic error: the criteria impose different complexity penalties. It is a reason to examine the fitted classes and the scientific purpose of the analysis.

What Likelihood Behavior Can and Cannot Tell You

If a \(K+1\)-class model contains the \(K\)-class model as a special case in its closure, its globally maximized likelihood cannot be smaller. One way the smaller model can be represented is to give the extra class a mixing probability of zero, leaving the other class contributions unchanged. Thus, for such a comparison, the best attainable log likelihood satisfies \(\ell_{K+1}(\widehat{\theta}_{K+1})\geq\ell_K(\widehat{\theta}_K)\). The comparison is conditional on compatible model specifications: changing the outcome distribution, covariates, or data can make it no longer a comparison of nested class counts.

This fact does not mean that any observed likelihood increase justifies another class. More parameters can improve fit even when the improvement is too small to offset a complexity penalty or does not represent a credible subpopulation. Also, numerical fitting may fail to find the global maximum. A reported log likelihood that decreases when a class is added should prompt a check that the candidate models and likelihoods are comparable and that estimation was successful; it contradicts the nesting argument if the smaller model really is contained in the larger one.

The tempting likelihood-ratio statistic for comparing \(K\) and \(K+1\) classes is

$$ 2\{\ell_{K+1}(\widehat{\theta}_{K+1})-\ell_K(\widehat{\theta}_K)\}. $$

Under ordinary regular nested-model conditions, a likelihood-ratio statistic can have an approximate chi-square reference distribution with degrees of freedom equal to the parameter-count difference. Adding a mixture class generally violates those conditions: under the smaller model, the extra class can have zero mixing probability, which is a boundary value, and the parameters describing that absent class are not identified. Therefore, using a routine chi-square test with \(q_{K+1}-q_K\) degrees of freedom is generally not justified. A parametric bootstrap likelihood-ratio comparison or information criteria may be considered instead, with the method and its assumptions stated.

Worked Example: Why a Large Likelihood Gain Is Not a Routine Chi-Square Test

In a hypothetical comparison, a two-class model has maximized log likelihood \(-1748\) and 17 parameters; a three-class model has maximized log likelihood \(-1729\) and 26 parameters. The observed likelihood-ratio statistic is

$$ 2\{(-1729)-(-1748)\}=2(19)=38. $$

The parameter-count difference is \(26-17=9\). A mechanical chi-square calculation would compare 38 with a chi-square distribution on 9 degrees of freedom. But that reference distribution relies on regularity conditions that are not met by the usual test of an added mixture class: at the two-class null, the third class can have probability zero, and its component parameters then have no identified values. The value 38 is a valid description of the observed likelihood gain, but this calculation alone does not provide a justified chi-square p-value. The information criteria in the preceding example give a defined comparison without making that particular reference-distribution claim.

Class Size, Separation, and Scientific Meaning

Fit statistics should be considered alongside what the proposed classes represent. For a model with class probabilities that vary by baseline covariates, the fitted class probability for subject \(i\) is \(\widehat{\pi}_{ik}\). A useful summary of the model-implied expected number of subjects in class \(k\) is

$$ \widehat{N}_k=\sum_{i=1}^n \widehat{\pi}_{ik}. $$

This is an expected count under the fitted membership model, not a count obtained by declaring each subject to belong with certainty to the class with the largest probability. A very small expected class count can signal that its trajectory and event-risk estimates are weakly supported. It is not, by itself, proof that the class should be removed: whether a small group is credible depends on the data, model complexity, and scientific question.

Assess separation using the fitted quantities that give classes their meaning. Compare their predicted longitudinal mean trajectories across the observed follow-up period and, when relevant, their class-specific event-risk patterns. A difference only at times with little or no data support is less persuasive than a difference across well-observed times. Conversely, a class distinction may be scientifically meaningful even if its main difference is in event risk rather than in the longitudinal mean. The interpretation should follow the model and the observed support, not a label such as “high” or “low” assigned without qualification.

Scientific interpretability is not a substitute for statistical assessment, but neither is it reducible to a numerical threshold. A proposed extra class is more credible when its pattern is coherent with the measurements, event outcomes, and research context, and when its defining features are not merely a complicated description of a few observations. Latent classes summarize heterogeneity under a model; their labels alone do not establish that naturally distinct groups exist.

Worked Example: A Small Class With Little Trajectory Separation

Consider a hypothetical three-class fit to \(n=240\) subjects. The membership model implies expected class counts of 150, 84, and 6. The third class therefore has an estimated expected prevalence of \(6/240=0.025\), or 2.5%. Suppose its predicted longitudinal mean is almost indistinguishable from the second class throughout the observed follow-up, while its estimated event risk differs sharply.

The six-subject expected count is a warning that the third class’s estimates may be fragile, not a universal rule that it is too small to retain. The nearly overlapping longitudinal means make it important to ask whether the event-risk distinction is supported by the observed events and censoring pattern, rather than being an unstable way to fit a few cases. Compare the candidate models’ likelihood and information criteria, inspect the estimated class-specific patterns over the data-supported period, and consider whether a distinct event-risk pattern is scientifically plausible. If the class is weakly supported and has no coherent interpretation, a lower information criterion alone should not settle the choice.

Comparing the Main Approaches and Their Limits

ApproachWhat it contributesImportant limitation
AICBalances likelihood fit against a fixed penalty; often useful when predictive performance is central.May favor more complex models; does not establish that every class is meaningful.
BICPenalizes additional parameters more strongly as the sample size grows; can favor a more parsimonious class count.Its usual approximation rests on regularity conditions that mixture models may violate.
Likelihood-ratio comparisonSummarizes the gain in maximized likelihood between nested candidates.A routine chi-square reference is generally invalid for adding a mixture class.
Predictive validationCan compare how well candidate models predict held-out observations.Requires a suitable validation design and a scoring rule that respects the joint longitudinal and event data structure.
Substantive assessmentEvaluates whether the class-specific trajectories and risks form a useful, coherent account.Judgment is context-dependent and should not replace transparent statistical comparisons.

A defensible choice usually reports the candidate class counts considered, the log likelihoods and parameter counts, the information criteria used, and the resulting class prevalence and fitted patterns. Where AIC and BIC disagree, it is useful to state that disagreement rather than hide it. The preferred model should be justified in relation to the intended use: a more predictive description and a more parsimonious summary need not select the same number of classes.

Common Mistakes and Practical Checks

  • Treating the smallest information criterion as proof. An information criterion ranks the candidates under its penalty; it does not certify adequate fit or scientifically real subpopulations.
  • Assuming a likelihood increase proves the extra class is needed. A larger model can improve maximized likelihood. Ask whether the improvement offsets complexity and whether the additional class is supported and interpretable.
  • Applying a routine chi-square test to an added class. The zero-weight boundary and unidentified added-class parameters invalidate the usual regular reference argument.
  • Calling a class size a hard assignment count. The sum of fitted class probabilities is an expected count; it is not the number of subjects whose membership is known with certainty.
  • Comparing incompatible fits. Information criteria require comparable likelihoods calculated from the same observations and the same observed-data definition. Check the data, model specification, and parameter count before interpreting a ranking.
Key takeaway: Use AIC and BIC to summarize competing fit-complexity trade-offs, then assess likelihood behavior, expected class sizes, trajectory and risk separation, and scientific interpretability. No single criterion determines the class count for every purpose.

Check Your Understanding

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

  1. For the hypothetical models with \(n=240\), which model does AIC favor, and which does BIC favor?
  2. Why is the maximized likelihood expected not to decrease when a class is added to a compatible nested model?
  3. A model implies \(\widehat{N}_k=12\) for one class among 300 subjects. What prevalence does this imply, and what does the count not tell you?
  4. Why is a routine chi-square likelihood-ratio test generally unsuitable for comparing \(K\) with \(K+1\) mixture classes?

Solutions. (1) AIC favors three classes (3510 versus 3530 and 3656); BIC favors two (3589.2 versus 3600.5 and 3683.8). (2) In the larger model’s closure, the added class can have zero mixing probability, reproducing the smaller model’s likelihood; maximizing over a set containing that representation cannot yield a lower global maximum. (3) The implied prevalence is \(12/300=0.04\), or 4%. It is an expected count from fitted probabilities, not a hard count of subjects known to belong to that class or proof that its estimates are reliable. (4) Under the smaller model, the added class may have zero probability and its parameters are unidentified, so the regular chi-square reference conditions do not generally hold.

Clinical Biostats