Expectation–maximization fits a latent-variable model by alternating posterior expectations and complete-data likelihood maximization. The general method is due to Dempster, Laird, and Rubin, 1977, Maximum likelihood from incomplete data via the EM algorithm. This GH specialization follows the upstream derivation, which credits Hu (2005), Calibration of multivariate generalized hyperbolic distributions using the EM algorithm.
Read ordinary EM for the likelihood inequality, and GH for the joint density and parameter conventions. We treat independent observations , with positive-definite and interior GIG parameters , unless a boundary case is stated.
Complete and observed data¶
Write the classical parameter tuple as ; reserve for the joint family’s natural coordinates. The model is
For , the conditioning note uses , , and . The observed likelihood uses . The joint GH law is an exponential family, which makes its expected log likelihood easier to optimize.
Conditional distribution of the mixing variable¶
Expanding the normal quadratic in the joint density and collecting powers of gives
Set , , and . All are evaluated at the current iterate when used in an E-step. Then
Interior assumptions guarantee for every observation. The GIG normalizing integral therefore supplies every real posterior power moment:
Differentiating at yields
The three expectations of , , and must be evaluated separately. Replacing by its posterior mean inside nonlinear statistics would give a different algorithm.
E-step in one statistic order¶
Use the joint sufficient-statistic blocks , as in the GIG and GH notes. At iterate let
The E-step averages all six blocks:
The source EM note uses the first three slots in a different order. Here always means the log moment, the inverse moment, and the first moment. This order also governs the mixture architecture.
M-step as an expectation-to-parameter map¶
Holding the old posterior fixed, maximize
In natural coordinates this equals plus a constant. For an attained interior maximum of the full joint family, the new model matches the posterior sufficient-statistic averages. Suppressing on , the normal-block update is
The two vector updates solve and . The covariance formula then follows from the sixth joint moment. The last line is the GIG likelihood problem; it usually requires numerical optimization. Only the normal block is closed form in the general GH case.
These formulas require a nonzero denominator, a positive-definite recovered covariance, and a feasible attained mixing-law optimum. Positive-definiteness can fail with insufficiently varied data. Convexity of the GIG subproblem does not remove its domain constraints or numerical conditioning problems.
With exact posteriors and an M-step that increases , the EM likelihood inequality ensures
This concerns the observed likelihood. It does not guarantee a global MLE, a unique stationary point, convergence of the parameter sequence, or a particular speed. Approximate numerical steps should be checked against their actual objective.
Scale normalization and equivariance¶
The GH scale action is
It represents the same observed law by replacing with . The posterior parameters become . Consequently,
The E-step output transforms as
Substitution in (9), including the rescaled GIG optimum, proves for the exact unconstrained EM map when the maximizers are unique (or selected consistently under scaling).
To impose after an update, choose and transform all coupled parameters:
The observed density and its likelihood are unchanged. This is a choice of scale representative, not a penalty or a guarantee of numerical stability. Fixed bounds, shrinkage, approximate solvers, or inconsistent choices among maximizers can break the exact equivariance argument.
ECM and multiple cycles¶
Meng and Rubin’s 1993 ECM framework replaces one M-step by conditional maximizations of parameter blocks. The upstream note discusses its multi-cycle version (MCECM) for GH, also citing McNeil, Frey, and Embrechts, Quantitative Risk Management (2010). A two-cycle construction in the unconstrained redundant coordinates is:
Compute the posterior moments at , then maximize the normal block with fixed.
Recompute the posterior moments at this intermediate parameter and maximize the GIG block with the new normal block fixed.
Each conditional maximization must increase the corresponding current . A full coupled scale normalization can then be applied without changing the observed law. If instead one imposes a determinant constraint inside a conditional maximization while holding the mixing parameters fixed, that is a constrained optimization problem: simply normalizing the unconstrained covariance is not a justification for its ascent property.
EM and valid MCECM updates share the likelihood-ascent argument. Neither has a general guarantee of reaching the global MLE, and their numerical costs and convergence rates depend on the problem.
Special mixing families¶
Write , , and for the posterior averages at the relevant E-step. Denote the digamma function by and its derivative by , to distinguish them from the log-partition .
Gamma mixing: variance gamma¶
For with rate , and . The mixing-law update solves
A Newton proposal is
Safeguards must keep and verify improvement. The posterior is GIG with , , and . At , ; posterior propriety and required inverse moments then need separate checking. For example, this gamma posterior has finite inverse moment only if . The interior GIG formula does not cover that point without a boundary analysis.
Inverse-Gaussian mixing: NIG¶
For an inverse Gaussian with mean and shape , and . The closed-form mixing update is
It requires ; equality is a constant-mixing limit. Its GIG embedding has , , . The posterior is generally GIG with order , rather than another inverse Gaussian.
Inverse-gamma mixing¶
For , and . Hence
with Newton proposal
This is again a scalar solve, not a general closed-form shape estimate. For the posterior has and is inverse gamma with shape ; a finite posterior first moment requires when that moment is needed. Symmetry-constrained updates can require fewer statistics than the full variance–mean model.
| Marginal family | Mixing statistics to fit its free parameters | Mixing M-step |
|---|---|---|
| General GH | Three-parameter convex problem in natural coordinates | |
| Variance gamma | Scalar shape solve and rate recovery | |
| NIG | Closed form | |
| Normal-inverse gamma | Scalar shape solve and scale recovery |
The normal block still uses inverse and first posterior moments when both location and mean coupling are free. Reducing the mixing-law statistics does not automatically eliminate these normal-block requirements.
Numerical considerations and implementation¶
Large or extreme can overflow or underflow direct Bessel evaluations. Ratios, log-space evaluation, and stable order derivatives matter. The covariance update can suffer cancellation or rank deficiency; determinant normalization does not repair its condition number. Penalties change the optimization objective and need their own ascent analysis.
See why not gradient descent for the optimization comparison and exponential-family core for the expectation-to-natural map. Runnable fitters remain in the upstream EM guide and package API. Continue with online EM, penalized shrinkage, and the mathematical EM framework. The full EM design and Bessel/solver design remain upstream implementation references.
Source and adaptation¶
Adapted from xshi19/normix, docs/theory/em_algorithm.md, at revision
763bb3608920661a012cf089888d349fbf680aad (2026-09-13 import).
Copyright (c) 2020 xshi19. Licensed under MIT.
The pinned source
records the original version. Notation, mathematical qualifications, and links
were adapted for this site; API recipes, executable package cells, and notebook
plots are omitted. No upstream benchmark execution or formal-proof verification
is claimed for this adaptation.
MIT permission notice
MIT License
Copyright (c) 2020 xshi19
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.