To install click the Add extension button. That's it.

The source code for the WIKI 2 extension is being checked by specialists of the Mozilla Foundation, Google, and Apple. You could also do it yourself at any point in time.

Kelly Slayton
Congratulations on this excellent venture… what a great idea!
Alexander Grigorievskiy
I use WIKI 2 every day and almost forgot how the original Wikipedia looks like.
Live Statistics
English Articles
Improved in 24 Hours
Added in 24 Hours
Show all languages
What we do. Every page goes through several hundred of perfecting techniques; in live mode. Quite the same Wikipedia. Just better.

Normal-gamma distribution

From Wikipedia, the free encyclopedia

Parameters location (real)
Mean [1]
Variance [1]

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]


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

meaning that the conditional distribution is a normal distribution with mean and precision — equivalently, with variance

Suppose also that the marginal distribution of T is given by

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


Probability density function

The joint probability density function of (X,T) is[citation needed]

Marginal distributions

By construction, the marginal distribution of is a gamma distribution, and the conditional distribution of given is a Gaussian distribution. The marginal distribution of is a three-parameter non-standardized Student's t-distribution with parameters .[citation needed]

Exponential family

The normal-gamma distribution is a four-parameter exponential family with natural parameters and natural statistics .[citation needed]

Moments of the natural statistics

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

where is the digamma function,


If then for any b > 0, (bX,bT) is distributed as[citation needed]

Posterior distribution of the parameters

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

and that the prior distribution on and , , has a normal-gamma distribution

for which the density π satisfies


i.e. the components of are conditionally independent given and the conditional distribution of each of them given is normal with expected value and variance The posterior distribution of and given this dataset can be analytically determined by Bayes' theorem.[3] Explicitly,

where 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:

This expression can be simplified as follows:

where , the mean of the data samples, and , the sample variance.

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

The final exponential term is simplified by completing the square.

On inserting this back into the expression above,

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

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 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 ).
  • The posterior updates the number of pseudo-observations () simply by adding up the corresponding number of new observations ().
  • 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 from samples and a prior precision of from samples, the prior distribution over and is

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

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 .

Generating normal-gamma random variates

Generation of random variates is straightforward:

  1. Sample from a gamma distribution with parameters and
  2. Sample from a normal distribution with mean and variance

Related distributions


  1. ^ a b Bernardo & Smith (1993, p. 434)
  2. ^ Bernardo & Smith (1993, pages 136, 268, 434)
  3. ^ "Archived copy". Archived from the original on 2014-08-07. Retrieved 2014-08-05.CS1 maint: archived copy as title (link)


  • 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 page was last edited on 1 April 2021, at 09:44
Basis of this page is in Wikipedia. Text is available under the CC BY-SA 3.0 Unported License. Non-text media are available under their specified licenses. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc. WIKI 2 is an independent company and has no affiliation with Wikimedia Foundation.