Distributions#
normix implements the Generalized Hyperbolic (GH) family and its relatives as a single, consistent set of exponential-family distributions. This guide is a map of what is available and how to choose.
The family at a glance#
Every multivariate distribution here is a normal variance-mean mixture,
and the choice of positive subordinator \(Y\) names the member:
Distribution |
Subordinator |
Subordinator parameters |
|---|---|---|
|
Gamma |
|
|
Inverse Gamma |
|
|
Inverse Gaussian |
|
|
GIG |
|
The shared location/shape parameters are always \(\mu\) (mu), \(\gamma\)
(gamma), and the covariance \(\Sigma\) given through its Cholesky factor
L_Sigma. Because the GIG nests the Gamma, Inverse Gamma, and Inverse
Gaussian as limits, GeneralizedHyperbolic nests all the others — see
A tour of the GH family.
Subordinators and the Gaussian core#
The building blocks are exponential families in their own right:
Distribution |
Parameters |
Notes |
|---|---|---|
|
|
closed-form moments and MLE |
|
|
closed-form moments and MLE |
|
|
closed-form moments and MLE |
|
|
Bessel-valued log-partition |
|
|
the Gaussian core |
See Univariate positive distributions, The Generalized Inverse Gaussian, and The multivariate normal.
Three layers per mixture#
Each mixture comes in several layers; reach for the one that matches your task:
Marginal (e.g.
NormalInverseGaussian) — the distribution of \(X\). This is what you usually fit and evaluate:pdf,log_prob,mean,cov,rvs.Joint (e.g.
JointNormalInverseGaussian, viamodel.joint) — the pair \((X, Y)\) with the latent subordinator, used by the EM E-step and accessible forjoint.rvsandjoint.conditional_expectations.Univariate (e.g.
UnivariateNormalInverseGaussian) — the \(d = 1\) case, which adds a scipy-stylecdfandppffor tail calculations.Factor (e.g.
FactorNormalInverseGaussian) — a high-dimensional variant with a low-rank-plus-diagonal covariance \(\Sigma = F F^\top + \operatorname{diag}(D)\); see Factor mixtures for high dimensions.
Choosing a distribution#
Light-to-moderate tails, symmetric or skewed:
VarianceGammaorNormalInverseGamma.Heavy tails (financial returns):
NormalInverseGaussianis a robust default;GeneralizedHyperbolicadds a third shape parameter for the heaviest cases.Unsure / want the most flexible model:
GeneralizedHyperbolic— it contains the others as special cases.Many assets / dimensions: the corresponding
Factor*variant.One-dimensional with CDF/quantile needs: the
Univariate*variant.
A common interface#
Whatever you pick, the API is the same:
from normix import NormalInverseGaussian
model = NormalInverseGaussian.from_classical(
mu=mu, gamma=gamma, sigma=Sigma, mu_ig=1.0, lam=1.5)
model.pdf(x) # density at one point (vmap to batch)
model.mean(); model.cov()
model.rvs(1000, seed=0)
result = model.fit(X) # EM; result.model is the fit
Construction also works from natural parameters (from_natural) and from
expectation parameters (from_expectation) — the three parametrizations are
explained in Exponential-family structure.