Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Diagnosing Local Maxima in Mixture Estimation

Latent Class Joint Models · Tutorial 458 of 697

Diagnosing Local Maxima in Mixture Estimation

You will learn a systematic way to compare repeated fits, account for label switching, and decide when a reported solution needs further investigation.

Advanced 10 min read

What You'll Learn

  • Define the observed-data log-likelihood used to compare fits of the same latent class joint model.
  • Plan repeated starts that explore different initial parameter values.
  • Distinguish label-switched versions of the same solution from genuinely different fitted solutions.
  • Check likelihoods, parameter admissibility, convergence indicators, and local curvature together.
  • Recognize why the highest likelihood found is not proof of a global maximum.

Why Local Maxima Need to Be Diagnosed

Latent class joint models are fitted by maximizing an observed-data likelihood that combines class-specific contributions. That likelihood is generally not a simple surface: different starting values can lead an optimizer to different stationary solutions. A program can report convergence for a solution that is not the best one found, or can stop at a point that has not actually converged. Repeating a fit and comparing its results is therefore part of checking the computation, not just a way to obtain more output.

A key distinction is between repeated fits that reach the same solution and fits that reach different solutions. In a latent class model, the class labels can be permuted without changing the model's likelihood. Thus, different-looking parameter tables do not necessarily represent different solutions. Conversely, equal or nearly equal likelihoods do not by themselves establish that two parameter estimates are the same.

Likelihood and Conditions for a Meaningful Comparison

For independent subjects \(i=1,\ldots,n\), let \(Y_i\) denote subject \(i\)'s observed longitudinal and event data, and let \(C_i\) be the latent class. Write \(\pi_{ig}(\theta)\) for the probability of class \(g\) given the model's specified covariates, and \(f_{ig}(Y_i\mid\theta)\) for the class-specific joint-data contribution. The observed-data likelihood sums over the unobserved class:

$$ L(\theta)=\prod_{i=1}^{n}\left\{\sum_{g=1}^{G}\pi_{ig}(\theta)f_{ig}(Y_i\mid\theta)\right\}, \qquad \ell(\theta)=\log L(\theta). $$

Here \(\theta\) contains the membership, longitudinal, event-risk, and any other parameters of the specified model. The diagnostic target is a maximizer of this same observed-data log-likelihood under the same constraints and using the same data and likelihood implementation. If fits use different observations, model specifications, or likelihood calculations, their log-likelihoods are not a direct comparison of optimization solutions.

Definition: A local maximum is a parameter value whose likelihood is at least as large as that at all sufficiently nearby admissible parameter values. A global maximum has likelihood at least as large as at every admissible parameter value. Repeated starts can find evidence of competing local maxima, but finding the largest likelihood among a finite set of runs does not prove it is the global maximum.

The likelihood comparison assumes the optimization runs evaluate the same objective function and use compatible parameter constraints. It also assumes the reported values are finite and that convergence diagnostics are available. If the likelihood is numerically unstable, or a run terminates before approaching a stationary point, its likelihood alone is not enough to label the result a local maximum.

Repeated Starts and a Practical Comparison

A repeated-start analysis fits the same model many times, changing initial values while keeping the data, likelihood, and constraints fixed. Starts should be varied enough to explore different plausible regions of the parameter space rather than merely adding tiny perturbations to one initial value. Where appropriate, initial values should respect the model's constraints—for example, class probabilities should be valid probabilities and variance parameters should be positive.

For each run, record at least the final observed-data log-likelihood, the optimizer's convergence status, a measure of the final gradient or other stopping criterion, the parameter estimates, and any warnings. The log-likelihood should be computed at the final reported estimates. Compare the largest likelihood with the other converged fits, and then inspect whether parameter estimates agree after allowing for class-label permutations.

For a smooth likelihood at an interior local maximum, the gradient is zero and the Hessian is negative semidefinite. In computation, the gradient will rarely be exactly zero, so its size must be judged against the optimizer's scaling and tolerance. A negative-definite Hessian is evidence of a strict local maximum in unconstrained coordinates, but near-boundary solutions require care: the relevant maximum may be constrained, and ordinary unconstrained derivative checks need not apply directly.

$$ \nabla\ell(\hat{\theta})\approx 0, \qquad \ell(\hat{\theta})\geq \ell(\hat{\theta}+h) \quad\text{for sufficiently small admissible }h. $$

The first condition is a stationarity check; the second expresses local maximality. Neither a small gradient nor a convergence flag alone proves that a run found a good maximum. They are useful alongside likelihood comparisons and parameter checks.

Worked Example: Comparing Repeated Fits

Suppose a hypothetical two-class joint model is fitted to the same data from six different starting values. All fits use the same model and constraints. Three runs report converged estimates, with log-likelihoods \(-821.74\), \(-821.75\), and \(-824.31\). After aligning class labels, the first two runs' parameter estimates differ by at most \(0.003\) on their prespecified comparison scales. The third run differs substantially in its class-specific trajectory and event-risk estimates.

The largest observed log-likelihood is \(-821.74\). The second fit is lower by \( -821.75-(-821.74)=-0.01\), while the third is lower by \( -824.31-(-821.74)=-2.57\). The relative likelihood of the third fit compared with the largest is \( \exp(-2.57)\approx 0.0765\). This is a comparison of likelihood values for the same data and model, not the probability that either solution is correct.

The first two runs have nearly identical likelihoods and, after label alignment, closely matching parameter estimates; this is evidence that they reached the same solution. The third converged run has a noticeably lower likelihood and different estimates, so it is a candidate for a competing local maximum or another inferior stationary solution. Its convergence status and local diagnostics still need review before calling it a local maximum. The largest likelihood found is the best of these runs, not proof of a global maximum.

Allowing for Label Switching

Class labels are arbitrary: permuting class-specific parameters and the corresponding membership probabilities leaves the observed-data likelihood unchanged. Therefore, comparisons must first align labels. For two classes, a simple check is to compare the estimates both in their original order and after swapping all class-specific quantities consistently. With more classes, the same idea applies to possible permutations; the matching should use a prespecified, interpretable set of parameter summaries rather than one parameter chosen after seeing the results.

After alignment, examine parameter estimates and, where helpful, fitted class probabilities or other model-implied quantities. Exact equality of log-likelihoods is expected under a pure relabeling, apart from numerical rounding. A matching likelihood without matching aligned estimates may instead reflect a flat or weakly determined direction, or two distinct solutions with similar fit; it is not enough to conclude that the runs found the same parameter solution.

Worked Example: Recognizing a Label-Switched Fit

Two hypothetical fits of the same two-class model have log-likelihoods \(-436.208\) and \(-436.2082\). In the first fit, the class proportions are \(0.70\) and \(0.30\), the class-specific trajectory intercepts are \(5.1\) and \(2.0\), and the event-risk coefficients are \(0.25\) and \(0.80\). In the second fit, the corresponding values are \(0.30\) and \(0.70\), \(2.0\) and \(5.1\), and \(0.80\) and \(0.25\).

The second fit has swapped the two classes consistently. The log-likelihood difference is \( |-436.2082-(-436.208)|=0.0002\), a negligible numerical difference in this hypothetical output. Swapping the second fit's class order gives proportions \(0.70,0.30\), intercepts \(5.1,2.0\), and event-risk coefficients \(0.25,0.80\), matching the first fit. This is evidence that the runs reached the same solution up to label switching, not two competing maxima.

If only the intercepts matched after a swap but the class probabilities or event-risk coefficients did not, the match would be incomplete. Every class-specific quantity and the corresponding membership structure must be permuted together.

Parameter and Convergence Checks

A credible candidate solution should satisfy the model's parameter constraints and should not carry unresolved numerical warnings. Check that class probabilities are in the permitted range and sum to one for each relevant covariate pattern; that variance and other constrained parameters are admissible; and that estimates are finite. Check the optimizer's termination reason, gradient or score size, iteration limits, and any warnings about singular calculations. A parameter value on a boundary is not automatically invalid, but it calls for explicit scrutiny and interpretation under the fitted model's constraints.

Parameter checks can expose a run that appears to have a competitive likelihood but has not produced a usable estimate. For example, an invalid probability, nonpositive variance where positivity is required, or non-finite estimate indicates that the result must not be treated as an acceptable fit. Similarly, reaching a maximum iteration limit is not evidence of convergence merely because the likelihood changed little in the final iteration.

Worked Example: A High Likelihood Is Not Enough

Consider two hypothetical runs of the same model. Run A reports \(\ell=-508.63\), a convergence flag, a scaled gradient norm of \(0.00008\), class probabilities \(0.62\) and \(0.38\), and positive variance estimates \(0.44\) and \(0.91\). Run B reports \(\ell=-510.20\), a nonconvergence warning after reaching its iteration limit, a scaled gradient norm of \(0.42\), and one reported class probability of \(1.03\).

Run A is the better candidate: its likelihood exceeds Run B's by \( -508.63-(-510.20)=1.57\), and its listed probability values sum to \(0.62+0.38=1.00\) and are each between zero and one. Its variance estimates are positive, and its gradient norm is small under the hypothetical software's stated scaling. These checks support, but do not prove, that it has reached a local maximum.

Run B's probability of \(1.03\) violates the probability constraint, and its large gradient norm and iteration-limit warning indicate that it has not met the stated convergence checks. Its lower log-likelihood is not enough to call it a competing local maximum. The fit should be investigated or rerun with suitable initialization and constraints; it should not be reported as an acceptable solution.

How to Interpret Differences and Choose Follow-Up Checks

When two valid converged runs differ, first verify that the data, model, constraints, and likelihood implementation are identical. Then align class labels and compare log-likelihoods, parameter estimates, and relevant fitted quantities. A materially lower likelihood from a valid converged fit is evidence that the optimizer found an inferior solution relative to the best run observed. Similar likelihoods but substantially different estimates warrant further investigation: the runs may be distinct solutions, or the likelihood may be relatively flat in some direction.

A useful follow-up is to start additional runs near each distinct candidate and perturb their parameter values modestly, while continuing to record convergence and likelihood. If nearby starts repeatedly return to the same candidate, that supports its numerical stability. It does not establish global optimality, since other regions may remain unexplored. If runs keep ending at different points, or if estimates change markedly while the likelihood hardly changes, report that instability rather than presenting a single fit as unambiguous.

These checks diagnose optimization; they do not settle whether the chosen number of classes is appropriate, whether classes are well separated, or whether the model fits the data adequately. Those are different questions. Likewise, information criteria compare model fit with a complexity penalty; they are not a substitute for checking whether each model's likelihood was successfully optimized.

Common Pitfalls and Limitations

  • Treating a convergence flag as proof. A flag reports that software met its own stopping rule. Check the likelihood, gradient or score, parameter constraints, and warnings as well.
  • Comparing class labels literally. A consistent permutation can make equivalent fits look different. Align labels before judging parameter differences.
  • Declaring the largest observed likelihood global. Repeated starts explore only a finite set of initial values. The largest found is the best among those runs, not a guarantee about all admissible values.
  • Calling every different estimate a local maximum. A run that stopped early or violates constraints is not an acceptable converged candidate. A distinct but valid estimate still needs local convergence checks.
  • Using likelihood alone to decide sameness. Similar likelihoods can accompany different parameter values. Compare aligned estimates and fitted quantities, too.

The number and quality of starts cannot be reduced to a universal rule. A model with a complicated likelihood surface may require substantial exploration, and no finite multi-start procedure certifies that every mode has been found. The practical conclusion should therefore be calibrated: state how many starts were used, how many converged, the range of likelihoods among acceptable fits, and whether competing estimates remained.

Check Your Understanding

Answer each question, then compare with the brief solutions below.

  1. Why must two log-likelihoods be computed from the same data and model before they can be used to diagnose competing optimization solutions?
  2. Two fits have the same likelihood, and every class-specific parameter in Fit B is the corresponding parameter in Fit A with class labels swapped. What is the most direct interpretation?
  3. A run has a higher log-likelihood than all other runs but stopped at its iteration limit with a large gradient norm. Should it be declared the best converged solution?
  4. Why does finding the largest likelihood in 50 starts not prove that the global maximum has been found?

Solutions. (1) Otherwise, a likelihood difference can reflect different observations, assumptions, constraints, or objective functions rather than different optimization outcomes. (2) The fits are consistent with the same solution up to label switching, provided the swap is consistent across all class-specific quantities. (3) No. The iteration-limit warning and large gradient indicate that convergence has not been established; investigate or rerun it before treating it as an acceptable candidate. (4) The starts explore only selected initial values and may miss other regions of the parameter space, so the largest found is only the best among those runs.

Clinical Biostats