Conjugate prior
In Bayesian probability theory, if the posterior distributions p(θ|x) are in the same family as the prior probability distribution p(θ), the prior and posterior are then called conjugate distributions, and the prior is called a conjugate prior for the likelihood function. For example, the Gaussian family is conjugate to itself (or self-conjugate) with respect to a Gaussian likelihood function: if the likelihood function is Gaussian, choosing a Gaussian prior over the mean will ensure that the posterior distribution is also Gaussian. This means that the Gaussian distribution is a conjugate prior for the likelihood that is also Gaussian. The concept, as well as the term "conjugate prior", were introduced by Howard Raiffa and Robert Schlaifer in their work on Bayesian decision theory.[1] A similar concept had been discovered independently by George Alfred Barnard.[2]
Consider the general problem of inferring a distribution for a parameter θ given some datum or data x. From Bayes' theorem, the posterior distribution is equal to the product of the likelihood function and prior , normalized (divided) by the probability of the data :
Let the likelihood function be considered fixed; the likelihood function is usually well-determined from a statement of the data-generating process. It is clear that different choices of the prior distribution p(θ) may make the integral more or less difficult to calculate, and the product p(x|θ) × p(θ) may take one algebraic form or another. For certain choices of the prior, the posterior has the same algebraic form as the prior (generally with different parameter values). Such a choice is a conjugate prior.
A conjugate prior is an algebraic convenience, giving a closed-form expression for the posterior; otherwise numerical integration may be necessary. Further, conjugate priors may give intuition, by more transparently showing how a likelihood function updates a prior distribution.
All members of the exponential family have conjugate priors.[3]
Example
The form of the conjugate prior can generally be determined by inspection of the probability density or probability mass function of a distribution. For example, consider a random variable which consists of the number of successes in Bernoulli trials with unknown probability of success in [0,1]. This random variable will follow the binomial distribution, with a probability mass function of the form
Expressed as a function of , this has the form
for some constants and . Generally, this functional form will have an additional multiplicative factor (the normalizing constant) ensuring that the function is a probability distribution, i.e. the integral over the entire range is 1. This factor will often be a function of and , but never of because the sum of and are the number of trials.
In fact, the usual conjugate prior is the beta distribution with parameters (, ):
where and are chosen to reflect any existing belief or information ( = 1 and = 1 would give a uniform distribution) and Β(, ) is the Beta function acting as a normalising constant.
In this context, and are called hyperparameters (parameters of the prior), to distinguish them from parameters of the underlying model (here q). It is a typical characteristic of conjugate priors that the dimensionality of the hyperparameters is one greater than that of the parameters of the original distribution. If all parameters are scalar values, then this means that there will be one more hyperparameter than parameter; but this also applies to vector-valued and matrix-valued parameters. (See the general article on the exponential family, and consider also the Wishart distribution, conjugate prior of the covariance matrix of a multivariate normal distribution, for an example where a large dimensionality is involved.)
If we then sample this random variable and get s successes and f failures, we have
which is another Beta distribution with parameters ( + s, + f). This posterior distribution could then be used as the prior for more samples, with the hyperparameters simply adding each extra piece of information as it comes.
Pseudo-observations
It is often useful to think of the hyperparameters of a conjugate prior distribution as corresponding to having observed a certain number of pseudo-observations with properties specified by the parameters. For example, the values and of a beta distribution can be thought of as corresponding to successes and failures if the posterior mode is used to choose an optimal parameter setting, or successes and failures if the posterior mean is used to choose an optimal parameter setting. In general, for nearly all conjugate prior distributions, the hyperparameters can be interpreted in terms of pseudo-observations. This can help both in providing an intuition behind the often messy update equations, as well as to help choose reasonable hyperparameters for a prior.
Interpretations
Analogy with eigenfunctions
Conjugate priors are analogous to eigenfunctions in operator theory, in that they are distributions on which the "conditioning operator" acts in a well-understood way, thinking of the process of changing from the prior to the posterior as an operator.
In both eigenfunctions and conjugate priors, there is a finite-dimensional space which is preserved by the operator: the output is of the same form (in the same space) as the input. This greatly simplifies the analysis, as it otherwise considers an infinite-dimensional space (space of all functions, space of all distributions).
However, the processes are only analogous, not identical: conditioning is not linear, as the space of distributions is not closed under linear combination, only convex combination, and the posterior is only of the same form as the prior, not a scalar multiple.
Just as one can easily analyze how a linear combination of eigenfunctions evolves under application of an operator (because, with respect to these functions, the operator is diagonalized), one can easily analyze how a convex combination of conjugate priors evolves under conditioning; this is called using a hyperprior, and corresponds to using a mixture density of conjugate priors, rather than a single conjugate prior.
Dynamical system
One can think of conditioning on conjugate priors as defining a kind of (discrete time) dynamical system: from a given set of hyperparameters, incoming data updates these hyperparameters, so one can see the change in hyperparameters as a kind of "time evolution" of the system, corresponding to "learning". Starting at different points yields different flows over time. This is again analogous with the dynamical system defined by a linear operator, but note that since different samples lead to different inference, this is not simply dependent on time, but rather on data over time. For related approaches, see Recursive Bayesian estimation and Data assimilation.
Table of conjugate distributions
Let n denote the number of observations. In all cases below, the data is assumed to consist of n points (which will be random vectors in the multivariate cases).
If the likelihood function belongs to the exponential family, then a conjugate prior exists, often also in the exponential family; see Exponential family: Conjugate distributions.
Discrete distributions
Likelihood | Model parameters | Conjugate prior distribution | Prior hyperparameters | Posterior hyperparameters | Interpretation of hyperparameters[note 1] | Posterior predictive[note 2] |
---|---|---|---|---|---|---|
Bernoulli | p (probability) | Beta | successes, failures[note 1] | |||
Binomial | p (probability) | Beta | successes, failures[note 1] | (beta-binomial) | ||
Negative binomial with known failure number, r | p (probability) | Beta | total successes, failures[note 1] (i.e., experiments, assuming stays fixed) | |||
Poisson | λ (rate) | Gamma | total occurrences in intervals | (negative binomial) | ||
[note 3] | total occurrences in intervals | (negative binomial) | ||||
Categorical | p (probability vector), k (number of categories; i.e., size of p) | Dirichlet | where is the number of observations in category i | occurrences of category [note 1] | ||
Multinomial | p (probability vector), k (number of categories; i.e., size of p) | Dirichlet | occurrences of category [note 1] | (Dirichlet-multinomial) | ||
Hypergeometric with known total population size, N | M (number of target members) | Beta-binomial[4] | successes, failures[note 1] | |||
Geometric | p0 (probability) | Beta | experiments, total failures[note 1] |
Continuous distributions
Likelihood | Model parameters | Conjugate prior distribution | Prior hyperparameters | Posterior hyperparameters | Interpretation of hyperparameters | Posterior predictive[note 4] |
---|---|---|---|---|---|---|
Normal with known variance σ2 | μ (mean) | Normal | |
mean was estimated from observations with total precision (sum of all individual precisions) and with sample mean | [5] | |
Normal with known precision τ | μ (mean) | Normal | mean was estimated from observations with total precision (sum of all individual precisions) and with sample mean | [5] | ||
Normal with known mean μ | σ2 (variance) | Inverse gamma | [note 5] | variance was estimated from observations with sample variance (i.e. with sum of squared deviations , where deviations are from known mean ) | [5] | |
Normal with known mean μ | σ2 (variance) | Scaled inverse chi-squared | variance was estimated from observations with sample variance | [5] | ||
Normal with known mean μ | τ (precision) | Gamma | [note 3] | precision was estimated from observations with sample variance (i.e. with sum of squared deviations , where deviations are from known mean ) | [5] | |
Normal[note 6] | μ and σ2 Assuming exchangeability | Normal-inverse gamma |
|
mean was estimated from observations with sample mean ; variance was estimated from observations with sample mean and sum of squared deviations | [5] | |
Normal | μ and τ Assuming exchangeability | Normal-gamma |
|
mean was estimated from observations with sample mean , and precision was estimated from observations with sample mean and sum of squared deviations | [5] | |
Multivariate normal with known covariance matrix Σ | μ (mean vector) | Multivariate normal |
|
mean was estimated from observations with total precision (sum of all individual precisions) and with sample mean | [5] | |
Multivariate normal with known precision matrix Λ | μ (mean vector) | Multivariate normal |
|
mean was estimated from observations with total precision (sum of all individual precisions) and with sample mean | [5] | |
Multivariate normal with known mean μ | Σ (covariance matrix) | Inverse-Wishart | covariance matrix was estimated from observations with sum of pairwise deviation products | [5] | ||
Multivariate normal with known mean μ | Λ (precision matrix) | Wishart | covariance matrix was estimated from observations with sum of pairwise deviation products | [5] | ||
Multivariate normal | μ (mean vector) and Σ (covariance matrix) | normal-inverse-Wishart |
|
mean was estimated from observations with sample mean ; covariance matrix was estimated from observations with sample mean and with sum of pairwise deviation products | [5] | |
Multivariate normal | μ (mean vector) and Λ (precision matrix) | normal-Wishart |
|
mean was estimated from observations with sample mean ; covariance matrix was estimated from observations with sample mean and with sum of pairwise deviation products | [5] | |
Uniform | Pareto | observations with maximum value | ||||
Pareto with known minimum xm | k (shape) | Gamma | observations with sum of the order of magnitude of each observation (i.e. the logarithm of the ratio of each observation to the minimum ) | |||
Weibull with known shape β | θ (scale) | Inverse gamma[4] | observations with sum of the β'th power of each observation | |||
Log-normal with known precision τ | μ (mean) | Normal[4] | "mean" was estimated from observations with total precision (sum of all individual precisions) and with sample mean | |||
Log-normal with known mean μ | τ (precision) | Gamma[4] | [note 3] | precision was estimated from observations with sample variance (i.e. with sum of squared log deviations — i.e. deviations between the logs of the data points and the "mean") | ||
Exponential | λ (rate) | Gamma | [note 3] | observations that sum to | (Lomax distribution) | |
Gamma with known shape α | β (rate) | Gamma | observations with sum | [note 7] | ||
Inverse Gamma with known shape α | β (inverse scale) | Gamma | observations with sum | |||
Gamma with known rate β | α (shape) | or observations ( for estimating , for estimating ) with product | ||||
Gamma [4] | α (shape), β (inverse scale) | was estimated from observations with product ; was estimated from observations with sum | ||||
See also
Notes
- 1 2 3 4 5 6 7 8 The exact interpretation of the parameters of a beta distribution in terms of number of successes and failures depends on what function is used to extract a point estimate from the distribution. The mode of a beta distribution is which corresponds to successes and failures; but the mean is which corresponds to successes and failures. The use of and has the advantage that a uniform prior corresponds to 0 successes and 0 failures, but the use of and is somewhat more convenient mathematically and also corresponds well with the fact that Bayesians generally prefer to use the posterior mean rather than the posterior mode as a point estimate. The same issues apply to the Dirichlet distribution.
- ↑ This is the posterior predictive distribution of a new data point given the observed data points, with the parameters marginalized out. Variables with primes indicate the posterior values of the parameters.
- 1 2 3 4 β is rate or inverse scale. In parameterization of gamma distribution,θ = 1/β and k = α.
- ↑ This is the posterior predictive distribution of a new data point given the observed data points, with the parameters marginalized out. Variables with primes indicate the posterior values of the parameters. and refer to the normal distribution and Student's t-distribution, respectively, or to the multivariate normal distribution and multivariate t-distribution in the multivariate cases.
- ↑ In terms of the inverse gamma, is a scale parameter
- ↑ A different conjugate prior for unknown mean and variance, but with a fixed, linear relationship between them, is found in the normal variance-mean mixture, with the generalized inverse Gaussian as conjugate mixing distribution.
- ↑ is a compound gamma distribution; here is a generalized beta prime distribution.
References
- ↑ Howard Raiffa and Robert Schlaifer. Applied Statistical Decision Theory. Division of Research, Graduate School of Business Administration, Harvard University, 1961.
- ↑ Jeff Miller et al. Earliest Known Uses of Some of the Words of Mathematics, "conjugate prior distributions". Electronic document, revision of November 13, 2005, retrieved December 2, 2005.
- ↑ For a catalog, see Gelman, Andrew; Carlin, John B.; Stern, Hal S.; Rubin, Donald B. (2003). Bayesian Data Analysis (2nd ed.). CRC Press. ISBN 1-58488-388-X.
- 1 2 3 4 5 Fink, D. (1997). "A Compendium of Conjugate Priors". DOE contract 95‑831 ((Caution: Unreliable source) In progress report: Beware of some errors in multivariate normal and models and Arethya's prior (see addendum)) . CiteSeerX 10.1.1.157.5540.
- 1 2 3 4 5 6 7 8 9 10 11 12 13 Murphy, Kevin P. (2007). "Conjugate Bayesian analysis of the Gaussian distribution" (PDF).