Normal-gamma distribution

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
normal-gamma
Parameters μ location (real)
λ>0 (real)
α>0 (real)
β>0 (real)
Support x(,),τ(0,)
PDF f(x,τμ,λ,α,β)=βαλΓ(α)2πτα12eβτeλτ(xμ)22
Mean [1] E(X)=μ,E(T)=αβ1
Mode (μ,α12β)
Variance [1] var(X)=(βλ(α1)),var(T)=αβ2

In probability theory and statistics, the normal-gamma distribution (or Gaussian-gamma distribution) is a bivariate four-parameter family of continuous probability distributions. It is the conjugate prior of a normal distribution with unknown mean and precision.[2]

Definition

[edit | edit source]

For a pair of random variables, (X,T), suppose that the conditional distribution of X given T is given by

XTN(μ,1/(λT)),

meaning that the conditional distribution is a normal distribution with mean μ and precision λT — equivalently, with variance 1/(λT).

Suppose also that the marginal distribution of T is given by

Tα,βGamma(α,β),

where this means that T has a gamma distribution. Here λ, α and β are parameters of the joint distribution.

Then (X,T) has a normal-gamma distribution, and this is denoted by

(X,T)NormalGamma(μ,λ,α,β).

Properties

[edit | edit source]

Probability density function

[edit | edit source]

The joint probability density function of (X,T) is

f(x,τμ,λ,α,β)=βαλΓ(α)2πτα12eβτexp(λτ(xμ)22),

where the conditional probability for f(x,τμ,λ,α,β)=f(xτ,μ,λ,α,β)f(τμ,λ,α,β) was used.

Marginal distributions

[edit | edit source]

By construction, the marginal distribution of τ is a gamma distribution, and the conditional distribution of x given τ is a Gaussian distribution. The marginal distribution of x is a three-parameter non-standardized Student's t-distribution with parameters (ν,μ,σ2)=(2α,μ,β/(λα)).[citation needed]

Exponential family

[edit | edit source]

The normal-gamma distribution is a four-parameter exponential family with natural parameters α1/2,βλμ2/2,λμ,λ/2 and natural statistics lnτ,τ,τx,τx2.[citation needed]

Moments of the natural statistics

[edit | edit source]

The following moments can be easily computed using the moment generating function of the sufficient statistic:[3]

E(lnT)=ψ(α)lnβ,

where ψ(α) is the digamma function,

E(T)=αβ,E(TX)=μαβ,E(TX2)=1λ+μ2αβ.

Scaling

[edit | edit source]

If (X,T)NormalGamma(μ,λ,α,β), then for any b>0,(bX,bT) is distributed as[citation needed] NormalGamma(bμ,λ/b3,α,β/b).

Posterior distribution of the parameters

[edit | edit source]

Assume that x is distributed according to a normal distribution with unknown mean μ and precision τ.

x𝒩(μ,τ1)

and that the prior distribution on μ and τ, (μ,τ), has a normal-gamma distribution

(μ,τ)NormalGamma(μ0,λ0,α0,β0),

for which the density π satisfies

π(μ,τ)τα012exp[β0τ]exp[λ0τ(μμ0)22].

Suppose

x1,,xnμ,τi.i.d.N(μ,τ1),

i.e. the components of 𝐗=(x1,,xn) are conditionally independent given μ,τ and the conditional distribution of each of them given μ,τ is normal with expected value μ and variance 1/τ. The posterior distribution of μ and τ given this dataset 𝕏 can be analytically determined by Bayes' theorem[4] explicitly,

𝐏(τ,μ𝐗)𝐋(𝐗τ,μ)π(τ,μ),

where 𝐋 is the likelihood of the parameters given the data.

Since the data are i.i.d, the likelihood of the entire dataset is equal to the product of the likelihoods of the individual data samples:

𝐋(𝐗τ,μ)=i=1n𝐋(xiτ,μ).

This expression can be simplified as follows:

𝐋(𝐗τ,μ)i=1nτ1/2exp[τ2(xiμ)2]τn/2exp[τ2i=1n(xiμ)2]τn/2exp[τ2i=1n(xix¯+x¯μ)2]τn/2exp[τ2i=1n((xix¯)2+(x¯μ)2)]τn/2exp[τ2(ns+n(x¯μ)2)],

where x¯=1ni=1nxi, the mean of the data samples, and s=1ni=1n(xix¯)2, the sample variance.

The posterior distribution of the parameters is proportional to the prior times the likelihood.

𝐏(τ,μ𝐗)𝐋(𝐗τ,μ)π(τ,μ)τn/2exp[τ2(ns+n(x¯μ)2)]τα012exp[β0τ]exp[λ0τ(μμ0)22]τn2+α012exp[τ(12ns+β0)]exp[τ2(λ0(μμ0)2+n(x¯μ)2)]

The final exponential term is simplified by completing the square.

λ0(μμ0)2+n(x¯μ)2=λ0μ22λ0μμ0+λ0μ02+nμ22nx¯μ+nx¯2=(λ0+n)μ22(λ0μ0+nx¯)μ+λ0μ02+nx¯2=(λ0+n)(μ22λ0μ0+nx¯λ0+nμ)+λ0μ02+nx¯2=(λ0+n)(μλ0μ0+nx¯λ0+n)2+λ0μ02+nx¯2(λ0μ0+nx¯)2λ0+n=(λ0+n)(μλ0μ0+nx¯λ0+n)2+λ0n(x¯μ0)2λ0+n

On inserting this back into the expression above,

𝐏(τ,μ𝐗)τn2+α012exp[τ(12ns+β0)]exp[τ2((λ0+n)(μλ0μ0+nx¯λ0+n)2+λ0n(x¯μ0)2λ0+n)]τn2+α012exp[τ(12ns+β0+λ0n(x¯μ0)22(λ0+n))]exp[τ2(λ0+n)(μλ0μ0+nx¯λ0+n)2]

This final expression is in exactly the same form as a Normal-Gamma distribution, i.e.,

𝐏(τ,μ𝐗)=NormalGamma(λ0μ0+nx¯λ0+n,λ0+n,α0+n2,β0+12(ns+λ0n(x¯μ0)2λ0+n))

Interpretation of parameters

[edit | edit source]

The interpretation of parameters in terms of pseudo-observations is as follows:

  • The new mean takes a weighted average of the old pseudo-mean and the observed mean, weighted by the number of associated (pseudo-)observations.
  • The precision was estimated from 2α pseudo-observations (i.e. possibly a different number of pseudo-observations, to allow the variance of the mean and precision to be controlled separately) with sample mean μ and sample variance βα (i.e. with sum of squared deviations 2β).
  • The posterior updates the number of pseudo-observations (λ0) simply by adding the corresponding number of new observations (n).
  • The new sum of squared deviations is computed by adding the previous respective sums of squared deviations. However, a third "interaction term" is needed because the two sets of squared deviations were computed with respect to different means, and hence the sum of the two underestimates the actual total squared deviation.

As a consequence, if one has a prior mean of μ0 from nμ samples and a prior precision of τ0 from nτ samples, the prior distribution over μ and τ is

𝐏(τ,μ𝐗)=NormalGamma(μ0,nμ,nτ2,nτ2τ0)

and after observing n samples with mean μ and variance s, the posterior probability is

𝐏(τ,μ𝐗)=NormalGamma(nμμ0+nμnμ+n,nμ+n,12(nτ+n),12(nττ0+ns+nμn(μμ0)2nμ+n))

Note that in some programming languages, such as Matlab, the gamma distribution is implemented with the inverse definition of β, so the fourth argument of the Normal-Gamma distribution is 2τ0/nτ.

Generating normal-gamma random variates

[edit | edit source]

Generation of random variates is straightforward:

  1. Sample τ from a gamma distribution with parameters α and β
  2. Sample x from a normal distribution with mean μ and variance 1/(λτ)
[edit | edit source]

Notes

[edit | edit source]
  1. ^ a b Bernardo & Smith (1993, p. 434)
  2. ^ Bernardo & Smith (1993, pages 136, 268, 434)
  3. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  4. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).

References

[edit | edit source]
  • Bernardo, J.M.; Smith, A.F.M. (1993) Bayesian Theory, Wiley. Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  • Dearden et al. "Bayesian Q-learning", Proceedings of the Fifteenth National Conference on Artificial Intelligence (AAAI-98), July 26–30, 1998, Madison, Wisconsin, USA.