Skip to content

NormalInverseGammaDistribution


final class NormalInverseGammaDistribution<Arg1, Arg2, Arg3, Arg4>(ν:Arg1, λ:Arg2, k:Arg3, γ:Arg4) < Distribution<Real>

Normal-inverse-gamma distribution.

This represents the joint distribution:

\sigma^2 \sim \mathrm{Inverse-Gamma}(\alpha, \beta)$$ $$x \mid \sigma^2 \sim \mathrm{N}(\mu, a^2\sigma^2),

which may be denoted:

(x, \sigma^2) \sim \mathrm{Normal-Inverse-Gamma(\mu, a^2, \alpha, \beta),

and is the conjugate prior of a Gaussian distribution with both unknown mean and unknown variance.

In model code, it is not usual to use this class directly. Instead, establish the conjugate relationship via code such as the following:

σ2 ~ InverseGamma(α, β);
x ~ Gaussian(μ, a2*σ2);
y ~ Gaussian(x, σ2);

where the last argument in the distribution of y must appear in the last argument of the distribution of x. The operation of a2 on σ2 may be multiplication on the left (as above) or the right, or division on the right.

Member Variables

Name Description
ν:Arg1 Mean.
λ:Arg2 Precision.
k:Arg3 Degrees of freedom.
γ:Arg4 Accumulator of variance scale.