World Library  
Flag as Inappropriate
Email this Article

Normal-gamma distribution

Article Id: WHEBN0010896234
Reproduction Date:

Title: Normal-gamma distribution  
Author: World Heritage Encyclopedia
Language: English
Subject: Normal-inverse-gamma distribution, Normal distribution, Multivariate Pareto distribution, Hyper-Erlang distribution, Chernoff's distribution
Collection:
Publisher: World Heritage Encyclopedia
Publication
Date:
 

Normal-gamma distribution

normal-gamma
Parameters \mu\, location (real)
\lambda > 0\, (real)
\alpha > 0\, (real)
\beta > 0\, (real)
Support x \in (-\infty, \infty)\,\!, \; \tau \in (0,\infty)
pdf f(x,\tau|\mu,\lambda,\alpha,\beta) = \frac{\beta^\alpha \sqrt{\lambda}}{\Gamma(\alpha)\sqrt{2\pi}} \, \tau^{\alpha-\frac{1}{2}}\,e^{-\beta\tau}\,e^{ -\frac{ \lambda \tau (x- \mu)^2}{2}}
Mean [1] \operatorname{E}(X)=\mu\,\! ,\quad \operatorname{E}(\Tau)= \alpha \beta^{-1}
Mode \left(\mu, \frac{\alpha - \frac12}{\beta}\right)
Variance [1] \operatorname{var}(X)= \frac{\beta}{\lambda (\alpha-1)} ,\quad \operatorname{var}(\Tau)=\alpha \beta^{-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

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

X|T \sim N(\mu,1 /(\lambda T)) \,\! ,

meaning that the condition distribution is a normal distribution with mean \mu and precision \lambda T — equivalently, with variance 1 / (\lambda T) .

Suppose also that the marginal distribution of T is given by

T |\alpha, \beta \sim \mathrm{Gamma}(\alpha,\beta) \! ,

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) \sim \mathrm{NormalGamma}(\mu,\lambda,\alpha,\beta) \! .

Properties

Probability density function

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

f(x,\tau|\mu,\lambda,\alpha,\beta) = \frac{\beta^\alpha \sqrt{\lambda}}{\Gamma(\alpha)\sqrt{2\pi}} \, \tau^{\alpha-1}\,e^{-\beta\tau}\,e^{ -\frac{ \lambda \tau (x- \mu)^2}{2}}

Marginal distributions

By construction, the marginal distribution over \tau is a gamma distribution, and the conditional distribution over x given \tau is a Gaussian distribution. The marginal distribution over x is a three-parameter non-standardized Student's t-distribution with parameters (\nu, \mu, \sigma^2)=(2\alpha, \mu, \beta/(\lambda\alpha)).

Exponential family

The normal-gamma distribution is a four-parameter exponential family with natural parameters \alpha-1/2, -\beta-\lambda\mu^2/2, \lambda\mu, -\lambda/2 and natural statistics \ln\tau, \tau, \tau x, \tau x^2.

Moments of the natural statistics

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

\operatorname{E}(\ln T)=\psi\left(\alpha\right) - \ln\beta, where \psi\left(\alpha\right) is the digamma function,
\operatorname{E}(T)=\frac{\alpha}{\beta},
\operatorname{E}(TX)=\mu \frac{\alpha}{\beta},
\operatorname{E}(TX^2)=\frac{1}{\lambda} + \mu^2 \frac{\alpha}{\beta}.

Scaling

If (X,T) \sim \mathrm{NormalGamma}(\mu,\lambda,\alpha,\beta), then for any b > 0, (bX,bT) is distributed as {\rm NormalGamma}(b\mu, \lambda, \alpha, b^2\beta).

Posterior distribution of the parameters

Assume that x is distributed according to a normal distribution with unknown mean \mu and precision \tau.

x \sim \mathcal{N}(\mu, \tau^{-1})

and that the prior distribution on \mu and \tau, (\mu,\tau), has a normal-gamma distribution

(\mu,\tau) \sim \text{NormalGamma}(\mu_0,\lambda_0,\alpha_0,\beta_0) ,

for which the density π satisfies

\pi(\mu,\tau) \propto \tau^{\alpha_0-\frac{1}{2}}\,\exp\,\exp].

Given a dataset \mathbf{X} , consisting of n independent and identically distributed random variables (i.i.d), \{x_1,...,x_n\}, the posterior distribution of \mu and \tau given this dataset can be analytically determined by Bayes' theorem. Explicitly,

\mathbf{P}(\tau,\mu | \mathbf{X}) \propto \mathbf{L}(\mathbf{X} | \tau,\mu) \pi(\tau,\mu),

where \mathbf{L} is the likelihood of the data given the parameters.

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:

\mathbf{L}(\mathbf{X} | \tau, \mu) = \prod_{i=1}^n \mathbf{L}(x_i | \tau, \mu) .

This expression can be simplified as follows:

\begin{align} \mathbf{L}(\mathbf{X} | \tau, \mu) & \propto \prod_{i=1}^n \tau^{1/2} \exp[\frac{-\tau}{2}(x_i-\mu)^2] \\ & \propto \tau^{n/2} \exp[\frac{-\tau}{2}\sum_{i=1}^n(x_i-\mu)^2] \\ & \propto \tau^{n/2} \exp[\frac{-\tau}{2}\sum_{i=1}^n(x_i-\bar{x} +\bar{x} -\mu)^2] \\ & \propto \tau^{n/2} \exp[\frac{-\tau}{2}\sum_{i=1}^n\left((x_i-\bar{x})^2 + (\bar{x} -\mu)^2\right)] \\ & \propto \tau^{n/2} \exp[\frac{-\tau}{2}\left(n s + n(\bar{x} -\mu)^2\right)] , \end{align}

where \bar{x}= \frac{1}{n}\sum_{i=1}^n x_i, the mean of the data samples, and s= \frac{1}{n} \sum_{i=1}^n(x_i-\bar{x})^2, the sample variance.

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

\begin{align} \mathbf{P}(\tau, \mu | \mathbf{X}) &\propto \mathbf{L}(\mathbf{X} | \tau,\mu) \pi(\tau,\mu) \\ &\propto \tau^{n/2} \exp[\frac{-\tau}{2}\left(n s + n(\bar{x} -\mu)^2\right)] \tau^{\alpha_0-\frac{1}{2}}\,\exp\,\exp] \\ &\propto \tau^{\frac{n}{2} + \alpha_0 - \frac{1}{2}}\exp[-\tau \left( \frac{1}{2} n s + \beta_0 \right) ] \exp\left[- \frac{\tau}{2}\left(\lambda_0(\mu-\mu_0)^2 + n(\bar{x} -\mu)^2\right)\right] \\ \end{align}

The final exponential term is simplified by completing the square.

\begin{align} \lambda_0(\mu-\mu_0)^2 + n(\bar{x} -\mu)^2&=\lambda_0 \mu^2 - 2 \lambda_0 \mu \mu_0 + \lambda_0 \mu_0^2 + n \mu^2 - 2 n \bar{x} \mu + n \bar{x}^2 \\ &= (\lambda_0 + n) \mu^2 - 2(\lambda_0 \mu_0 + n \bar{x}) \mu + \lambda_0 \mu_0^2 +n \bar{x}^2 \\ &= (\lambda_0 + n)( \mu^2 - 2 \frac{\lambda_0 \mu_0 + n \bar{x}}{\lambda_0 + n} \mu ) + \lambda_0 \mu_0^2 +n \bar{x}^2 \\ &= (\lambda_0 + n)\left(\mu - \frac{\lambda_0 \mu_0 + n \bar{x}}{\lambda_0 + n} \right) ^2 + \lambda_0 \mu_0^2 +n \bar{x}^2 - \frac{\left(\lambda_0 \mu_0 +n \bar{x}\right)^2} {\lambda_0 + n} \\ &= (\lambda_0 + n)\left(\mu - \frac{\lambda_0 \mu_0 + n \bar{x}}{\lambda_0 + n} \right) ^2 + \frac{\lambda_0 n (\bar{x} - \mu_0 )^2}{\lambda_0 +n} \end{align}

On inserting this back into the expression above,

\begin{align} \mathbf{P}(\tau, \mu | \mathbf{X}) & \propto \tau^{\frac{n}{2} + \alpha_0 - \frac{1}{2}} \exp \left[-\tau \left( \frac{1}{2} n s + \beta_0 \right) \right] \exp \left[- \frac{\tau}{2} \left( \left(\lambda_0 + n \right) \left(\mu- \frac{\lambda_0 \mu_0 + n \bar{x}}{\lambda_0 + n} \right)^2 + \frac{\lambda_0 n (\bar{x} - \mu_0 )^2}{\lambda_0 +n} \right) \right]\\ & \propto \tau^{\frac{n}{2} + \alpha_0 - \frac{1}{2}} \exp \left[-\tau \left( \frac{1}{2} n s + \beta_0 + \frac{\lambda_0 n (x - \mu_0 )^2}{2(\lambda_0 +n)} \right) \right] \exp \left[- \frac{\tau}{2} \left(\lambda_0 + n \right) \left(\mu- \frac{\lambda_0 \mu_0 + n \bar{x}}{\lambda_0 + n} \right)^2 \right] \end{align}

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

\mathbf{P}(\tau, \mu | \mathbf{X}) = \text{NormalGamma}\left(\frac{\lambda_0 \mu_0 + n \bar{x}}{\lambda_0 + n}, \lambda_0 + n, \alpha_0+\frac{n}{2}, \beta_0+ \frac{1}{2}\left(n s + \frac{\lambda_0 n (\bar{x} - \mu_0 )^2}{\lambda_0 +n} \right) \right)

Interpretation of parameters

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\alpha 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 \mu and sample variance \frac{\beta}{\alpha} (i.e. with sum of squared deviations 2\beta).
  • The posterior updates the number of pseudo-observations (\lambda_{0}) simply by adding up 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 \mu_0 from n_\mu samples and a prior precision of \tau_0 from n_\tau samples, the prior distribution over \mu and \tau is

\mathbf{P}(\tau,\mu | \mathbf{X}) = \text{NormalGamma}(\mu_0, n_\mu ,\frac{n_\tau}{2}, \frac{n_\tau}{2 \tau_0})

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

\mathbf{P}(\tau,\mu | \mathbf{X}) = \text{NormalGamma}\left( \frac{n_\mu \mu_0 + n \mu}{n_\mu +n}, n_\mu +n ,\frac{1}{2}(n_\tau+n), \frac{1}{2}\left(\frac{n_\tau}{\tau_0} + n s + \frac{n_\mu n (\mu-\mu_0)^2}{n_\mu+n}\right) \right)

Note that in some programming languages, such as Matlab, the gamma distribution is implemented with the inverse definition of \beta, so the fourth argument of the Normal-Gamma distribution is 2 \tau_0 /n_\tau.

Generating normal-gamma random variates

Generation of random variates is straightforward:

  1. Sample \tau from a gamma distribution with parameters \alpha and \beta
  2. Sample x from a normal distribution with mean \mu and variance 1/(\lambda \tau)

Related distributions

Notes

  1. ^ a b Bernardo & Smith (1993, p.434)
  2. ^ Bernardo & Smith (1993, pages 136, 268, 434)

References

  • Bernardo, J.M.; Smith, A.F.M. (1993) Bayesian Theory, Wiley. ISBN 0-471-49464-X
  • Dearden et al. "Bayesian Q-learning", Proceedings of the Fifteenth National Conference on Artificial Intelligence (AAAI-98), July 26–30, 1998, Madison, Wisconsin, USA.
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 


Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.