Fit the finite Gaussian mixture with a common variance for candidate values , using several initializations of the expectation-maximization algorithm for each, and retain the best likelihood value found. Maximized likelihood alone cannot select the number of components: a smaller mixture embeds in a larger one by giving an added component zero weight, so its likelihood cannot decrease.
There are free mixture weights, means and one common variance, hence
A standard working choice is the Bayesian information criterion:
The penalty balances fit against parameter count. The Akaike information criterion instead uses and is another possible comparison, particularly when predictive fit is the goal. The parameter count would differ if component variances were separate, but that is not this model.
Likelihood fitting must first be made well posed. Even a shared variance does not prevent all degeneracy: if , choose , and let the common variance tend to zero. Each observed density is at least , so the full log-likelihood function tends to . The same construction works when reaches the number of distinct observed values. Thus one must not feed infinite fitted likelihoods into an information criterion. Restrict candidate sizes to a sensible range below that degeneracy, or impose a fixed positive variance floor and use that same constrained model in every comparison. Under a variance floor , the M-step variance becomes .
There is also nonregular mixture model selection: at a missing component its weight is on a boundary and its mean is unidentified, while permuting labels leaves the distribution unchanged. Consequently an ordinary chi-squared calibration for a likelihood-ratio test between successive component counts is not generally justified. Information criteria are practical comparisons, not an automatic universal proof that the true number has been recovered. Predictive cross-validation or a suitably constructed parametric bootstrap comparison can supplement them. Select the component count by a penalized, well-defined mixture fit, rather than by unpenalized likelihood increase.
The expectation-maximization algorithm alternates conditional averaging over missing data with maximization over the parameter. Start at a parameter value for which the observed likelihood function is positive. At iteration , its E-step forms
using the current conditional law of but treating as the candidate parameter. Its M-step takes
Repeat until the parameter or observed log-likelihood stabilizes. An increase of implies an increase of the observed log-likelihood: if , then
where Kullback-Leibler divergence is nonnegative. In general this monotonicity does not guarantee a global maximum; distinct initializations may approach different stationary points. The particular observed log-likelihood below is concave, which makes a stronger conclusion possible there.
Within the merged third observed cell, the probability of belonging to the original fourth cell is
The allocation therefore has the conditional binomial distribution
Its conditional expectation and the filled-in missing counts are
with and .
Taking the conditional expectation of the complete log-likelihood gives the EM for merged multinomial cells E-step:
This is the parameter-dependent part of . More precisely, , where the constant is independent of the candidate , interpreting factorials of noninteger filled counts through the gamma function. The expected log-factorials are not generally the log-factorials of expected counts, so literal equality including the normalization would be false. Equality up to this constant is exactly what the M-step needs. Filling in conditional means works here because the candidate-parameter terms are linear in the missing counts; it is not a universal rule for the expectation-maximization algorithm.
Under the independent-gene version of the model, integrating both component labels and effects gives
This product uses independence of the gene effects and observation errors conditional on the shared parameters. Maximize its logarithm over , for example with a one-dimensional bounded optimizer or a grid followed by refinement. Its derivatives are
Thus the log likelihood function is concave. An interior maximum-likelihood estimate solves the score equation; otherwise it is at zero or one, determined by the endpoint score signs. An alternative expectation-maximization algorithm iterates
For , the components coincide and is not identifiable; for the full observation values carry information about the mixing fraction.
For the expectation-maximization algorithm, let . At iteration , the E-step forms the conditional distribution of the missing data at the current parameter and the function
The M-step is
In this maximization the conditional distribution defining the expectation is held at the old parameter; it is not recomputed as varies. The Jensen inequality gives
by writing the likelihood function ratio as a conditional expectation of . Hence an exact M-step does not decrease the observed-data likelihood function. The algorithm does not in general guarantee convergence to its global maximum; initialization and the likelihood function's geometry matter.
For the specified diagonal bivariate normal distribution, use . The two coordinates are independent, as are the four observations. Therefore the known second coordinate of the fourth observation gives no information about its first coordinate conditional on the parameters. The E-step is
These two moments suffice for the complete Gaussian log-likelihood. Discarding terms independent of the proposed parameters, its conditional expectation is
Differentiating with respect to each mean gives four times that mean minus the corresponding expected sum of observations. Thus the updates in EM for an independent missing normal coordinate are
For either variance the remaining criterion is ; its derivative vanishes at , which is its maximum when . Evaluate the expected residual sum at the new means to obtain
The missing contribution is
Its first term is essential. Substituting only the imputed mean for would omit its uncertainty and would not maximize the required expected complete log-likelihood.
As a check, the observed-data likelihood function integrates out the missing first coordinate, leaving three first-coordinate and four second-coordinate normal densities. Put and . The first-coordinate recurrence implies
Thus the iterates converge to the three-observation mean and maximum-likelihood variance, while the second-coordinate estimates are reached after one update. If the observed values in a coordinate are all equal, its likelihood function instead has a zero-variance boundary degeneracy, and there is no positive-variance maximizer; the variance formulas then describe that boundary limit. For nonzero empirical spreads the displayed updates give the ordinary nonsingular EM iteration.
This is an EM algorithm for a censored lognormal competing-risks mixture. Write and suppose , with mixing weights , . The missing data are and for censored patients; neither is missing for recorded deaths or recoveries. The complete-data log-likelihood, apart from terms independent of the parameters, is
The lognormal Jacobian is also parameter-independent and therefore does not affect the maximization.
At iteration , set for each censored patient and let . Bayes' rule gives the E-step class weights
Given that class, has a truncated normal distribution above . With the Inverse Mills ratio , compute both moments needed for the E-step:
Thus , , and the corresponding second moment is . For an observed outcome at time , use , , and . These specify the full conditional expectation of .
Put and let be the total number of patients. Maximizing that expected complete-data log-likelihood gives the M-step
All moments on the right are evaluated at the old parameters. Repeat the E-step and M-step until the observed log-likelihood stabilizes, using positive initial variances and mixing weights. The expectation-maximization algorithm increases that likelihood at each exact iteration, but need not find its global maximum; multiple starts help distinguish local optima. The resulting estimates give the case fatality probability and
These are conditional event-time distributions, distinct from the cumulative incidence functions and .
For the moment approach, write and let be a positive-definite working covariance constructed from the proposed moment formulas. For identifiable mean coefficients , let . Generalized estimating equations take the form
Across independent students, correct mean specification and standard regularity conditions give consistent identifiable mean coefficients even if the working covariance is wrong. Sandwich covariance matrix standard errors use
Residual second-moment estimating equations can estimate identifiable dispersion and association parameters. The marginal mean only identifies , not and separately. Moment restrictions beyond the mean would be needed to separate them; as shown below, the printed restrictions do not generally recover the intended latent parameters.
For the hierarchical approach, maximize the observed-data likelihood after integrating out the random effect. Set , , and . The joint likelihood contribution is
The integral comes from multiplying three conditional Poisson mass functions by the Gamma density and integrating over . Independent students give . Direct numerical maximum likelihood or an expectation-maximization algorithm can be used; in an EM algorithm an all-zero profile has an uncertain latent component membership. Information-based likelihood standard errors apply under regular interior conditions, with special care for parameter boundaries.
Introduce a latent indicator for a structural zero. In this parametrization , and conditional on the response has a Poisson distribution with mean . The zero-inflated Poisson regression uses
Its observed probability mass function is at zero and at a positive count. The zero-mixing probability here is explicitly ; it is distinct from the weight of the count component.
For the expectation-maximization algorithm, start with positive and . At iteration , the E-step computes
This distinguishes structural zeros from Poisson-generated zeros. Up to terms independent of the new parameters, the expected complete-data log-likelihood is
It separates into a fractional-response logistic fit and a weighted Poisson fit. Because treatment is binary, each component is saturated over its two treatment groups, so the M-step has closed forms.
For , let , , , and . The M-step score equations give
Here , since every positive count has . The explicit coefficient updates are
Iterate the E- and M-steps until the observed log-likelihood and parameter estimates stabilize. This is the EM algorithm for zero-inflated Poisson regression with explicit binary-group updates; merely naming two regression routines would not supply these expressions. Both treatment groups must be represented for both contrasts to be identifiable. Zero fitted group means or endpoint mixing probabilities are boundary solutions, interpreted through limits of the log or logit coefficients. As with other mixture models, multiple starts help distinguish competing stationary solutions; EM increases the likelihood but does not guarantee a global maximum from an arbitrary start.
For a finite Gaussian mixture with a common variance, introduce independent latent labels with probabilities , , and conditional responses , with common . The observed density and log-likelihood are
The expectation-maximization algorithm replaces the difficult log of sums by an expected complete-data objective. Choose positive initial weights and variance and separated initial means. At iteration , the E-step computes the mixture responsibilities
The common normalizing factor cancels. For numerical stability the probabilities can be evaluated by subtracting the largest log weight before exponentiating.
With the old responsibilities held fixed, the expected complete-data log-likelihood, up to irrelevant constants, is
Let . A Lagrange multiplier for , weighted least squares for the means, and differentiation in the common variance give the M-step:
The variance update uses the new means and old responsibilities, with denominator , not a residual degrees-of-freedom adjustment: this is maximum likelihood estimation. Repeat the E- and M-steps until the observed log-likelihood and parameters stabilize.
By EM likelihood monotonicity, exact updates do not decrease the observed likelihood. They need not reach its global maximum, so use several starting configurations and keep the best converged fit, checking for empty or nearly empty components and vanishing variance. The labels are interchangeable; sorting means after fitting supplies an interpretable labeling. Distinct starting means do not guarantee that all fitted components remain distinct. With a common variance and the usual fixed small relative to distinct observations the model avoids the individual-component variance-collapse pathology of unrestricted Gaussian mixtures, but degenerate data or too many components still require attention.
The statistician first models the age- and gender-dependent mean by linear regression. Its fitted value is . At fixed gender, a year of age is associated with a decrease of BMI units; the group coded gender has a fitted mean units above the group coded at the same age. This question does not state which gender receives which code. The intercept refers to age zero in the reference group, outside a typical adult-patient range, so its substantive interpretation is limited. Both slope Student t-tests have small p-values, and the overall F-test supports an age/gender-dependent mean. The coefficient of determination is only , leaving considerable individual variation to investigate.
The residual diagnostics check whether mean adjustment is plausible and whether a single normal error law is adequate. The residual-versus-fitted plot has no strong curved mean trend, although its smooth curve is not perfectly flat. The scale-location plot suggests some decline in spread as fitted BMI increases, so common residual variance is a working approximation rather than an established fact. The normal Q-Q plot has systematic departures, notably shorter tails than the normal reference, suggesting the residual law is not exactly normal. The regression leverage plot does not display an obviously extreme leverage point, but the marked observations and Cook's distance should still be checked for influence. Independence between patients cannot be diagnosed from these four plots alone.
Next the statistician extracts the regression residuals and fits an intercept-only normal model as a baseline residual distribution. With an intercept in the original ordinary least squares model, the residuals sum to zero by the normal equation; the near-zero fitted residual mean and its are therefore automatic, not new evidence of good fit. The standard error in this refit uses degrees of freedom, whereas the original uses after estimating three regression coefficients. The reported log-likelihood for the single-normal residual model is .
The histogram suggests a shape worth exploring beyond one normal density, with broad shoulders and some asymmetry, without showing unambiguous separated clusters. The statistician fits two- and three-component finite Gaussian mixtures with a common variance by the expectation-maximization algorithm, starting from separated means and positive weights. Successive likelihoods increase and the displayed final iterations stabilize, as expected from EM likelihood monotonicity. This is evidence of numerical convergence from those starts, not proof of a global maximum.
The two-component fit assigns weights , residual means and common variance . The three-component fit assigns weights , residual means and common variance . The code correctly passes the square roots of those variances to dnorm and overlays the resulting weighted densities. Both curves broadly follow the histogram and are very similar. In particular, a two-component mixture need not have two distinct visible modes.
These fits explore residual mixture clustering: groups differ in BMI relative to the same age/gender-adjusted mean, rather than simply in raw BMI. Membership can be summarized by the fitted mixture responsibilities, retaining uncertainty instead of asserting a certain label for each patient. The common-variance assumption is economical, but should be checked; the common regression slope assumption and constancy of mixture proportions across age and gender are also substantive. A residual mixture alone does not establish genuine biological subpopulations; a flexible continuous distribution, missing predictors, nonlinear mean effects or heteroscedasticity could explain a similar marginal shape.
There is also a two-stage residual mixture fitting limitation. Fitted regression residuals are not exactly independent identically distributed observations: even under a normal regression, their covariance matrix is , and estimating the mean adjustment introduces uncertainty. With subjects and three initial regression coefficients, treating them as independent is a useful approximation for exploring shape, but ordinary mixture likelihoods omit the first-stage uncertainty. A joint mixture regression with shared slopes, or a suitable bootstrap of the whole analysis, would give a firmer basis for parameter uncertainty and cluster selection. Examine component membership versus age/gender and repeat the algorithm from multiple starts before making substantive clustering claims.
Let and . Under the proposed zero-inflated negative binomial model, independence gives the likelihood function
The positive-count factor uses the ordinary, untruncated negative binomial distribution. With , the log-likelihood is
For latent indicators , the complete-data log-likelihood is
where is allowed only when . This separation is what makes the expectation-maximization algorithm convenient.
For EM for zero-inflated negative binomial regression, at iteration apply Bayes' theorem to each zero in the zero-inflated negative binomial model. The E step computes the conditional expectation of its latent indicator:
Treating these values as fixed, the M step maximizes the expected complete-data log-likelihood. Its two parameter blocks separate:
The second block is a weighted negative binomial regression with fixed size . Writing and , its parameter-dependent objective is
Its score function and negative Hessian matrix are
The objective is concave, so a finite maximizer, when it exists, can be found by Newton method or iteratively reweighted least squares. The latter uses working response and weights . This is not an unweighted regression on only the positive counts: zeros retain fractional weight in the count component.
Start with and finite coefficients, alternate the two steps, and monitor the observed log-likelihood. Exact maximization makes the expectation-maximization algorithm nondecreasing in that likelihood, although the mixture may have multiple stationary points. All-zero data can lead to boundary fits and poor identification; multiple initializations and explicit checks for boundary parameters are useful.
Write for the directed edges from parent to child and for the state at site . The global Markov property for an undirected graph on this tree, together with the specified parent transitions, gives the complete-data likelihood function
One can obtain the factorization by successively removing terminal subtrees: after conditioning on their parent, each subtree is independent of the rest. The root factor and transition products also show that different sites are independent. Only ancestral states are latent variables.
At the current Markov kernel , define expected transition counts
The E-step of the expectation-maximization algorithm is
Maximize separately for each row under and . For , the Lagrange multiplier equation is , with zero-count entries set to zero at a boundary maximum. Thus the EM transition-count update on a tree is
If , that row does not occur in ; any row probability distribution, including its previous value, maximizes the objective.
The expected counts can be computed exactly by the Felsenstein pruning algorithm and an outward belief propagation pass. For one site, let be the conditional probability of observations in the subtree below , given state . For a leaf with observed state , . For an internal vertex,
Define as the joint mass of state at and all observations outside its subtree. The root has . For a child of , put
The edge posterior probability required above is
Multiply the inside and outside factors to obtain the joint mass of the observations and endpoint states; division by the site likelihood function proves this expression. Sum over edges and sites to form . The two passes take operations on a binary tree. Scaling messages or computing them logarithmically avoids underflow.
A strictly positive initial Markov kernel ensures for every observed leaf pattern, so every E-step is defined. At a later boundary iterate, require positive likelihood for the actual data and restrict the conditional distribution to its support. EM likelihood monotonicity proves that the update cannot decrease observed-data likelihood function. It is a maximum-likelihood iteration, not a guarantee of finding the global maximum-likelihood estimate; different initial kernels may lead to different stationary points.
For one factor, write for the loading vector and . Let be its current value and . The E-step of the expectation-maximization algorithm uses the conditional multivariate normal distribution to obtain
Thus . The terms of the expected complete-data log-likelihood that depend on a candidate are
This is a strictly concave quadratic in , since . Its unique maximizer is
For an explicit expression involving only the current loading and data, put . Substitution gives the EM update for a single-factor Gaussian model
No empirical centering is applied because the model fixes the mean to zero. If initialized at zero, this update remains at zero; monotonicity alone does not guarantee that such a stationary point is a global maximum. This part is present in the PDF but missing from the TeX transcription.
Fix the observed , let , and let . The E-step forms
For finite expected log-likelihoods and , the Jensen inequality gives
The first inequality allows additional mass outside the old complete-data support; it is equality when the relevant supports coincide. Ratios are taken on the support of . If a candidate assigns zero density on positive -mass, its is minus infinity and it cannot be an improving finite M-step.
An M-step of the expectation-maximization algorithm chooses with , so
This EM likelihood monotonicity also holds for a generalized M-step that merely increases , rather than maximizing it exactly. It is a statement about the observed-data likelihood function.
Apply EM for a missing observation in a Gaussian AR1 process, starting from in the stationary parameter space. The Gaussian AR1 bridge gives the E-step quantities
Thus , , and , .
Let and otherwise. Keeping fixed throughout the M-step, define
The last term comes from the missing observation's conditional variance in the two adjacent innovation squares. The expected complete-data log-likelihood is
For fixed , differentiating the quadratic in gives
Also the maximizing variance is . The M-step is therefore a one-dimensional profile likelihood maximization:
Repeat the E- and M-steps until the observed-data likelihood and parameters stabilize. Exact M-steps make that likelihood nondecreasing; different initializations help detect different local optima, and convergence alone is not a guarantee of a global maximum. At an interior local maximum, impute the missing temperature by its conditional mean evaluated at the fitted parameters, retaining as its conditional uncertainty. Replacing by and discarding would not implement the expectation-maximization algorithm.
Let and regard as the latent variable. At iteration , the E-step forms
The M-step updates
This is the expectation-maximization algorithm for the posterior objective: including in the complete-data log density makes the maximizer a maximum a posteriori estimate rather than a maximum-likelihood estimate.
For fixed statistical parameters and , Bayes' theorem gives the mixture responsibility
It is the conditional expectation of the mixture allocation indicator. This posterior probability concerns the hidden label, with held fixed; it does not require a prior distribution over . For a continuous , use the density ratio to define this conditional distribution, rather than dividing probabilities of the zero-probability event .[ref]
For the Two-Gaussian mixture example, the component density ratio is , so the posterior probability ratio and the mixture responsibilities are
At the two unweighted component densities are equal, so the mixture responsibilities equal the mixture weights: , . At , the second component density is twice the first and its mixture responsibility is . Equal mixture responsibilities instead occur at : the more frequent second mixture component is favored even slightly to the left of the midpoint.
Figure 1.
Posterior responsibilities change with x while the stipulated mixture weights stay fixed
. Original analytic responsibilities for the same two-Gaussian mixture, with prior label probabilities shown as dotted horizontal lines. Both responsibilities remain strictly between zero and one at every finite x; the vertical marker denotes equal posterior probabilities, not disjoint component supports. Details.
The mixture weights describe membership before learning ; mixture responsibilities describe membership after learning . The law of total expectation gives under this statistical model, although varies across individual values. In fitting by the expectation-maximization algorithm, evaluate mixture responsibilities at the current statistical parameters and recompute them after an update.