From Population Prevalence to Individual Class Probability
A two-class model describes both how common each class is in the population and how well each class explains a particular subject’s data. These are different quantities. The class prevalence is a population-level probability, while a subject’s posterior class probability combines that prevalence with the evidence in the subject’s observations. A subject can therefore have a high posterior probability of belonging to a class that is relatively uncommon in the population, if that subject’s data fit that class much better.
The fast- and slow-clearance classes are treated as latent: each subject belongs to one class, but the class label is not directly observed. The class-specific model supplies a probability density for the subject’s data under each possible class. The likelihood must account for uncertainty about which class generated the data, rather than treating an unobserved label as known.
The class-conditional density is the probability model for the subject’s observed data given a class. In an NLME model, it generally accounts for the subject-level random effects as well as the observation model. In schematic form, if \(\eta_i\) denotes the random effects, then
Thus, \(f_k(y_i)\) is not generally just the observation density at an estimated individual parameter value. It is the class-conditional likelihood contribution under the specified population model. For continuous data, \(f_k(y_i)\) is a density, not the probability of observing one exact value.
Likelihood Contributions for Class Prevalence
Assume that subjects’ class assignments are independent draws from the same population prevalence, and that subjects’ data are conditionally independent given their class and the model parameters. For a subject whose class is unobserved, there are two mutually exclusive ways to generate the data: the subject is fast with probability \(\pi_F\), or slow with probability \(1-\pi_F\). The law of total probability therefore gives the marginal density for that subject’s data:
This sum is the individual’s likelihood contribution. It is a weighted sum of class-conditional densities, not a choice of whichever class gives the larger density. Under independence across subjects, the likelihood for \(N\) subjects is the product of these contributions:
When the class-conditional model parameters are also estimated, the densities depend on those parameters as well, and the full likelihood is maximized over both prevalence and class-specific parameters. The expression above makes the prevalence contribution explicit while holding the class-conditional densities fixed.
Worked Example: Likelihood When Class Labels Are Observed
Suppose, hypothetically, that class labels are known for 10 subjects: 4 are in the fast class and 6 are in the slow class. Under independent class assignments with fast prevalence \(\pi_F\), write the class-label likelihood and find its maximum-likelihood estimate.
Each fast label contributes \(\pi_F\), and each slow label contributes \(1-\pi_F\). Thus
The log-likelihood is \(\ell(\pi_F)=4\log(\pi_F)+6\log(1-\pi_F)\). Differentiating and setting the derivative to zero gives
The estimated prevalence is 40%, and the slow-class prevalence is \(1-0.400=0.600\), or 60%. This calculation applies because the labels were observed. When labels are latent, simply counting subjects assigned to their most likely class does not give this observed-label likelihood.
With latent labels, each subject contributes a mixture term instead. Taking logs gives a sum of log mixture contributions, which is convenient for expressing the objective being maximized:
A short derivative illustrates why latent membership does not reduce to a simple count. Holding the class-conditional densities fixed, the score for \(\pi_F\) is
Each subject influences the prevalence estimate according to the relative support their data provide for the two classes. If \(f_F(y_i)=f_S(y_i)\), that subject’s contribution to this derivative is zero: their data do not distinguish the classes. In contrast, a strong difference between the two densities can make that subject informative about prevalence. The derivative also shows that the latent-class likelihood is not the observed-label likelihood with guessed labels substituted in.
Worked Example: Evaluating a Latent-Class Likelihood
Consider two hypothetical subjects and suppose the fitted class-conditional densities, in the same units, are \(f_F(y_1)=0.120\), \(f_S(y_1)=0.040\), \(f_F(y_2)=0.030\), and \(f_S(y_2)=0.090\). Evaluate their joint likelihood contribution at a proposed fast-class prevalence of \(\pi_F=0.400\).
For subject 1, the mixture contribution is
For subject 2, it is
By conditional independence across subjects, the joint likelihood contribution is their product:
This is the likelihood value at the proposed prevalence, not a probability that \(\pi_F=0.400\). Estimating prevalence requires evaluating the likelihood over candidate prevalence values (and, in a fitted NLME model, jointly considering the class-conditional model parameters).
Bayes’ Rule for an Individual Subject
The prior probability that a subject belongs to the fast class is \(\pi_F\). After observing \(y_i\), Bayes’ rule updates that prior using the class-conditional density. The denominator is the marginal density of the data, which sums the contributions from both possible classes:
Likewise, the posterior probability of the slow class is
The two posterior probabilities sum to one because the model allows exactly these two classes. The posterior odds make the roles of prevalence and data particularly clear:
The first ratio is the prior odds of fast versus slow class membership. The second is the likelihood ratio contributed by the subject’s data. When the data fit both classes equally well, the likelihood ratio is one and the posterior odds equal the prior odds. When the fast-class density is larger, the data shift the odds toward fast membership; they do not, by themselves, prove that the subject belongs to that class.
Worked Example: Updating a Subject’s Class Probability
Suppose, hypothetically, the estimated fast-class prevalence is \(\pi_F=0.300\). For one subject, the class-conditional densities evaluated at the observed data are \(f_F(y_i)=0.080\) and \(f_S(y_i)=0.020\). Calculate the posterior probability of fast-class membership.
The fast-class part of the marginal density is \(0.300(0.080)=0.024\), and the slow-class part is \(0.700(0.020)=0.014\). The total marginal density is therefore \(0.024+0.014=0.038\). Bayes’ rule gives
The posterior probability of the slow class is \(1-0.6316=0.3684\). The subject’s data shift the probability toward the fast class: the prior fast probability was 0.300, and the observed data are four times as dense under the fast model as under the slow model, since \(0.080/0.020=4\). The result is still an uncertain assignment, not a definitive classification.
Assumptions, Diagnostics, and Common Pitfalls
The formulas rely on a defined two-class model. In particular, the prevalence is common across subjects in this formulation, class assignments are independent draws with probabilities \(\pi_F\) and \(1-\pi_F\), and each class-conditional density is correctly specified for the data being evaluated. The class-conditional densities must be comparable evaluations of the same subject’s data under the two alternatives. If observations are dependent across subjects or class prevalence varies with subject characteristics, this simple likelihood needs a different structure.
A posterior probability is only as reliable as the prevalence and the class-conditional models used to calculate it. Useful checks include verifying that the two class-conditional densities are evaluated on the same data and scale, confirming that each posterior probability lies between zero and one and the two sum to one, and examining whether assignments are driven by genuine differences between class fits or by numerical instability. If the class-conditional densities are nearly equal for most subjects, posterior probabilities will remain near the population prevalence: the data provide little individual-level separation. Very extreme probabilities warrant attention too, particularly if they arise from a few influential observations or implausibly small densities under one class.
A frequent mistake is to calculate each subject’s posterior probability, assign them to whichever class has the larger probability, and then treat those assignments as observed labels when estimating prevalence. This discards uncertainty. For example, probabilities of 0.51 and 0.99 both yield a fast-class label under that rule, even though the evidence for those labels differs substantially. The likelihood for latent classes retains both possibilities through the weighted sum \(\pi_F f_F(y_i)+(1-\pi_F)f_S(y_i)\).
| Quantity | What it represents | How the data enter |
|---|---|---|
| \(\pi_F\) | Population prevalence of the fast class | Estimated from the likelihood across subjects |
| \(f_F(y_i)\), \(f_S(y_i)\) | Subject \(i\)’s data density under each class | Determined by the class-conditional NLME models |
| \(P(C_i=F\mid y_i)\) | Subject \(i\)’s posterior fast-class probability | Combines prevalence with the subject’s relative class fit |
The main alternative is available when class membership is genuinely observed: use the class-label likelihood, as in the first worked example. That is not interchangeable with latent membership. Another tempting alternative is a hard assignment based on the larger class-conditional density alone. This ignores prevalence; the appropriate comparison is between the weighted terms \(\pi_F f_F(y_i)\) and \((1-\pi_F)f_S(y_i)\), and even choosing the larger weighted term is only a summary of the posterior, not a replacement for the mixture likelihood. Finally, if both class densities are almost identical, the data may contain little information about prevalence. A numerically computed prevalence in that situation should not be mistaken for strong evidence of two distinguishable subpopulations.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions below.
- Suppose \(\pi_F=0.250\), \(f_F(y_i)=0.060\), and \(f_S(y_i)=0.030\). What is \(P(C_i=F\mid y_i)\)?
- For one subject, suppose \(f_F(y_i)=f_S(y_i)\). What is the posterior fast-class probability, and why?
- Three subjects have observed class labels: one fast and two slow. Write the class-label likelihood and its maximum-likelihood estimate of \(\pi_F\).
- Explain why assigning every subject to the class with the larger posterior probability and counting those assignments does not reproduce the latent-class likelihood.
Solutions. (1) The weighted fast contribution is \(0.250(0.060)=0.015\); the weighted slow contribution is \(0.750(0.030)=0.0225\). Thus \(P(C_i=F\mid y_i)=0.015/(0.015+0.0225)=0.400\). (2) Equal densities give a likelihood ratio of one, so the data do not alter the prior odds; the posterior fast probability remains \(\pi_F\). (3) The likelihood is \(L(\pi_F)=\pi_F(1-\pi_F)^2\), maximized at \(\widehat{\pi}_F=1/3\), the observed fast fraction. (4) Hard assignments discard differences in uncertainty, such as the distinction between posterior probabilities 0.51 and 0.99. The latent likelihood instead retains both classes in each subject’s weighted-sum contribution.