Conjugate Prior
   HOME

TheInfoList



OR:

In
Bayesian probability Bayesian probability is an interpretation of the concept of probability, in which, instead of frequency or propensity of some phenomenon, probability is interpreted as reasonable expectation representing a state of knowledge or as quantification o ...
theory, if the posterior distribution p(\theta \mid x) is in the same probability distribution family as the
prior probability distribution In Bayesian statistical inference, a prior probability distribution, often simply called the prior, of an uncertain quantity is the probability distribution that would express one's beliefs about this quantity before some evidence is taken int ...
p(\theta), the prior and posterior are then called conjugate distributions, and the prior is called a conjugate prior for the
likelihood function The likelihood function (often simply called the likelihood) represents the probability of random variable realizations conditional on particular values of the statistical parameters. Thus, when evaluated on a given sample, the likelihood funct ...
p(x \mid \theta). A conjugate prior is an algebraic convenience, giving a
closed-form expression In mathematics, a closed-form expression is a mathematical expression that uses a finite number of standard operations. It may contain constants, variables, certain well-known operations (e.g., + − × ÷), and functions (e.g., ''n''th ro ...
for the posterior; otherwise,
numerical integration In analysis, numerical integration comprises a broad family of algorithms for calculating the numerical value of a definite integral, and by extension, the term is also sometimes used to describe the numerical solution of differential equations ...
may be necessary. Further, conjugate priors may give intuition by more transparently showing how a likelihood function updates a prior distribution. The concept, as well as the term "conjugate prior", were introduced by Howard Raiffa and Robert Schlaifer in their work on Bayesian decision theory. Howard Raiffa and Robert Schlaifer. ''Applied Statistical Decision Theory''. Division of Research, Graduate School of Business Administration, Harvard University, 1961. A similar concept had been discovered independently by
George Alfred Barnard George Alfred Barnard (23 September 1915 – 9 August 2002) was a British statistician known particularly for his work on the foundations of statistics and on quality control. Biography George Barnard was born in Walthamstow, Lond ...
.Jeff Miller et al
Earliest Known Uses of Some of the Words of Mathematics
Electronic document, revision of November 13, 2005, retrieved December 2, 2005.


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 A random variable (also called random quantity, aleatory variable, or stochastic variable) is a mathematical formalization of a quantity or object which depends on random events. It is a mapping or a function from possible outcomes (e.g., the p ...
which consists of the number of successes s in n
Bernoulli trial In the theory of probability and statistics, a Bernoulli trial (or binomial trial) is a random experiment with exactly two possible outcomes, "success" and "failure", in which the probability of success is the same every time the experiment is ...
s with unknown probability of success q in ,1 This random variable will follow the
binomial distribution In probability theory and statistics, the binomial distribution with parameters ''n'' and ''p'' is the discrete probability distribution of the number of successes in a sequence of ''n'' independent experiments, each asking a yes–no qu ...
, with a probability mass function of the form :p(s) = q^s (1-q)^ The usual conjugate prior is the beta distribution with parameters (\alpha, \beta): :p(q) = where \alpha and \beta are chosen to reflect any existing belief or information (\alpha=1 and \beta=1 would give a
uniform distribution Uniform distribution may refer to: * Continuous uniform distribution * Discrete uniform distribution * Uniform distribution (ecology) * Equidistributed sequence In mathematics, a sequence (''s''1, ''s''2, ''s''3, ...) of real numbers is said to be ...
) and \Beta(\alpha,\beta) is the Beta function acting as a
normalising constant The concept of a normalizing constant arises in probability theory and a variety of other areas of mathematics. The normalizing constant is used to reduce any probability function to a probability density function with total probability of one. ...
. In this context, \alpha and \beta are called '' hyperparameters'' (parameters of the prior), to distinguish them from parameters of the underlying model (here q). A typical characteristic of conjugate priors is 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 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 also consider the Wishart distribution, conjugate prior of the covariance matrix of a
multivariate normal distribution In probability theory and statistics, the multivariate normal distribution, multivariate Gaussian distribution, or joint normal distribution is a generalization of the one-dimensional ( univariate) normal distribution to higher dimensions. One ...
, for an example where a large dimensionality is involved.) If we sample this random variable and get s successes and f = n - s failures, then we have :\begin P(s, f \mid q=x) &= x^s(1-x)^f,\\ P(q=x) &= ,\\ P(q=x \mid s,f) &= \frac\\ & = \\ & = , \end which is another Beta distribution with parameters (\alpha + s, \beta + 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.


Interpretations


Pseudo-observations

It is often useful to think of the hyperparameters of a conjugate prior distribution corresponding to having observed a certain number of ''pseudo-observations'' with properties specified by the parameters. For example, the values \alpha and \beta of a beta distribution can be thought of as corresponding to \alpha-1 successes and \beta-1 failures if the posterior mode is used to choose an optimal parameter setting, or \alpha successes and \beta 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 provide intuition behind the often messy update equations and help choose reasonable hyperparameters for a prior.


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, the operator preserves a ''finite-dimensional'' space: 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 In convex geometry and vector algebra, a convex combination is a linear combination of points (which can be vectors, scalars, or more generally points in an affine space) where all coefficients are non-negative and sum to 1. In other ...
, 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 the application of an operator (because, for 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 In probability and statistics, a mixture distribution is the probability distribution of a random variable that is derived from a collection of other random variables as follows: first, a random variable is selected by chance from the collection ...
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 In mathematics, a dynamical system is a system in which a function describes the time dependence of a point in an ambient space. Examples include the mathematical models that describe the swinging of a clock pendulum, the flow of water i ...
: 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 inferences, this is not simply dependent on time but rather on data over time. For related approaches, see Recursive Bayesian estimation and Data assimilation.


Practical example

Suppose a rental car service operates in your city. Drivers can drop off and pick up cars anywhere inside the city limits. You can find and rent cars using an app. Suppose you wish to find the probability that you can find a rental car within a short distance of your home address at any time of day. Over three days you look at the app and find the following number of cars within a short distance of your home address: \mathbf = ,4,1/math> Suppose we assume the data comes from a
Poisson distribution In probability theory and statistics, the Poisson distribution is a discrete probability distribution that expresses the probability of a given number of events occurring in a fixed interval of time or space if these events occur with a known ...
. In that case, we can compute the
maximum likelihood In statistics, maximum likelihood estimation (MLE) is a method of estimating the parameters of an assumed probability distribution, given some observed data. This is achieved by maximizing a likelihood function so that, under the assumed sta ...
estimate of the parameters of the model, which is \lambda = \frac \approx 2.67. Using this maximum likelihood estimate, we can compute the probability that there will be at least one car available on a given day: p(x>0 , \lambda \approx 2.67) = 1 - p(x=0 , \lambda \approx 2.67) = 1-\frac \approx 0.93 This is the Poisson distribution that is ''the'' most likely to have generated the observed data \mathbf. But the data could also have come from another Poisson distribution, e.g., one with \lambda = 3, or \lambda = 2, etc. In fact, there is an infinite number of Poisson distributions that ''could'' have generated the observed data. With relatively few data points, we should be quite uncertain about which exact Poisson distribution generated this data. Intuitively we should instead take a weighted average of the probability of p(x>0, \lambda) for each of those Poisson distributions, weighted by how likely they each are, given the data we've observed \mathbf. Generally, this quantity is known as the
posterior predictive distribution Posterior may refer to: * Posterior (anatomy), the end of an organism opposite to its head ** Buttocks, as a euphemism * Posterior horn (disambiguation) * Posterior probability, the conditional probability that is assigned when the relevant evi ...
p(x, \mathbf) = \int_\theta p(x, \theta)p(\theta, \mathbf)d\theta\,, where x is a new data point, \mathbf is the observed data and \theta are the parameters of the model. Using Bayes' theorem we can expand p(\theta, \mathbf) = \frac\,, therefore p(x, \mathbf) = \int_\theta p(x, \theta)\fracd\theta\,. Generally, this integral is hard to compute. However, if you choose a conjugate prior distribution p(\theta), a closed-form expression can be derived. This is the posterior predictive column in the tables below. Returning to our example, if we pick the
Gamma distribution In probability theory and statistics, the gamma distribution is a two- parameter family of continuous probability distributions. The exponential distribution, Erlang distribution, and chi-square distribution are special cases of the gamma dis ...
as our prior distribution over the rate of the Poisson distributions, then the posterior predictive is the
negative binomial distribution In probability theory Probability theory is the branch of mathematics concerned with probability. Although there are several different probability interpretations, probability theory treats the concept in a rigorous mathematical manner by expr ...
, as can be seen from the table below. The Gamma distribution is parameterized by two hyperparameters \alpha, \beta, which we have to choose. By looking at plots of the gamma distribution, we pick \alpha = \beta = 2, which seems to be a reasonable prior for the average number of cars. The choice of prior hyperparameters is inherently subjective and based on prior knowledge. Given the prior hyperparameters \alpha and \beta we can compute the posterior hyperparameters \alpha' = \alpha + \sum_i x_i = 2 + 3+4+1 = 10 and \beta' = \beta + n = 2+3 = 5 Given the posterior hyperparameters, we can finally compute the posterior predictive of p(x>0, \mathbf) = 1-p(x=0, \mathbf) = 1 - NB\left(0\, , \, 10, \frac\right) \approx 0.84 This much more conservative estimate reflects the uncertainty in the model parameters, which the posterior predictive takes into account.


Table of conjugate distributions

Let ''n'' denote the number of observations. In all cases below, the data is assumed to consist of ''n'' points x_1,\ldots,x_n (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.


When the likelihood function is a discrete distribution


When likelihood function is a continuous distribution

{, class="wikitable" ! Likelihood !! Model parameters !! Conjugate prior distribution !! Prior hyperparameters !! Posterior hyperparameters!!Interpretation of hyperparameters!!Posterior predictive , - , Normal
with known variance ''σ''2 , , ''μ'' (mean) , , Normal , , \mu_0,\, \sigma_0^2\! , , \frac{1}{\frac{1}{\sigma_0^2} + \frac{n}{\sigma^2\left(\frac{\mu_0}{\sigma_0^2} + \frac{\sum_{i=1}^n x_i}{\sigma^2}\right), \left(\frac{1}{\sigma_0^2} + \frac{n}{\sigma^2}\right)^{-1} , mean was estimated from observations with total precision (sum of all individual precisions) 1/\sigma_0^2 and with sample mean \mu_0 , \mathcal{N}(\tilde{x}, \mu_0', {\sigma_0^2}' +\sigma^2) , - , Normal
with known precision ''τ'' , , ''μ'' (mean) , , Normal , , \mu_0,\, \tau_0^{-1}\! , , \frac{\tau_0 \mu_0 + \tau \sum_{i=1}^n x_i}{\tau_0 + n \tau},\, \left(\tau_0 + n \tau\right)^{-1} , mean was estimated from observations with total precision (sum of all individual precisions)\tau_0 and with sample mean \mu_0 , \mathcal{N}\left(\tilde{x}\mid\mu_0', \frac{1}{\tau_0'} +\frac{1}{\tau}\right) , - , Normal
with known mean ''μ'' , , ''σ''2 (variance) , , Inverse gamma , , \mathbf{\alpha,\, \beta} , , \mathbf{\alpha}+\frac{n}{2},\, \mathbf{\beta} + \frac{\sum_{i=1}^n{(x_i-\mu)^2{2} , variance was estimated from 2\alpha observations with sample variance \beta/\alpha (i.e. with sum of squared deviations 2\beta, where deviations are from known mean \mu) , t_{2\alpha'}(\tilde{x}, \mu,\sigma^2 = \beta'/\alpha') , - , Normal
with known mean ''μ'' , , ''σ''2 (variance) , , Scaled inverse chi-squared , , \nu,\, \sigma_0^2\! , , \nu+n,\, \frac{\nu\sigma_0^2 + \sum_{i=1}^n (x_i-\mu)^2}{\nu+n}\! , variance was estimated from \nu observations with sample variance \sigma_0^2 , t_{\nu'}(\tilde{x}, \mu,{\sigma_0^2}') , - , Normal
with known mean ''μ'' , , ''τ'' (precision) , , Gamma , , \alpha,\, \beta\! , , \alpha + \frac{n}{2},\, \beta + \frac{\sum_{i=1}^n (x_i-\mu)^2}{2}\! , precision was estimated from 2\alpha observations with sample variance \beta/\alpha (i.e. with sum of squared deviations 2\beta, where deviations are from known mean \mu) , t_{2\alpha'}(\tilde{x}\mid\mu,\sigma^2 = \beta'/\alpha') , - , NormalA different conjugate prior for unknown mean and variance, but with a fixed, linear relationship between them, is found in the
normal variance-mean mixture In probability theory and statistics, a normal variance-mean mixture with mixing probability density g is the continuous probability distribution of a random variable Y of the form :Y=\alpha + \beta V+\sigma \sqrtX, where \alpha, \beta and \sigma ...
, with the generalized inverse Gaussian as conjugate mixing distribution.
, , ''μ'' and ''σ2''
Assuming exchangeability, , Normal-inverse gamma , \mu_0 ,\, \nu ,\, \alpha ,\, \beta , , \frac{\nu\mu_0+n\bar{x{\nu+n} ,\, \nu+n,\, \alpha+\frac{n}{2} ,\,
\beta + \tfrac{1}{2} \sum_{i=1}^n (x_i - \bar{x})^2 + \frac{n\nu}{\nu+n}\frac{(\bar{x}-\mu_0)^2}{2} * \bar{x} is the sample mean , mean was estimated from \nu observations with sample mean \mu_0; variance was estimated from 2\alpha observations with sample mean \mu_0 and sum of squared deviations 2\beta , t_{2\alpha'}\left(\tilde{x}\mid\mu',\frac{\beta'(\nu'+1)}{\nu' \alpha'}\right) , - , Normal , , ''μ'' and ''τ''
Assuming exchangeability, , Normal-gamma , \mu_0 ,\, \nu ,\, \alpha ,\, \beta , , \frac{\nu\mu_0+n\bar{x{\nu+n} ,\, \nu+n,\, \alpha+\frac{n}{2} ,\,
\beta + \tfrac{1}{2} \sum_{i=1}^n (x_i - \bar{x})^2 + \frac{n\nu}{\nu+n}\frac{(\bar{x}-\mu_0)^2}{2} * \bar{x} is the sample mean , mean was estimated from \nu observations with sample mean \mu_0, and precision was estimated from 2\alpha observations with sample mean \mu_0 and sum of squared deviations 2\beta , t_{2\alpha'}\left(\tilde{x}\mid\mu',\frac{\beta'(\nu'+1)}{\alpha'\nu'}\right) , - , Multivariate normal with known covariance matrix ''Σ'' , , ''μ'' (mean vector) , , Multivariate normal , , \boldsymbol{\boldsymbol\mu}_0,\, \boldsymbol\Sigma_0 , , \left(\boldsymbol\Sigma_0^{-1} + n\boldsymbol\Sigma^{-1}\right)^{-1}\left( \boldsymbol\Sigma_0^{-1}\boldsymbol\mu_0 + n \boldsymbol\Sigma^{-1} \mathbf{\bar{x \right),
\left(\boldsymbol\Sigma_0^{-1} + n\boldsymbol\Sigma^{-1}\right)^{-1} *\mathbf{\bar{x is the sample mean , mean was estimated from observations with total precision (sum of all individual precisions)\boldsymbol\Sigma_0^{-1} and with sample mean \boldsymbol\mu_0 , \mathcal{N}(\tilde{\mathbf{x\mid{\boldsymbol\mu_0}', {\boldsymbol\Sigma_0}' +\boldsymbol\Sigma) , - , Multivariate normal with known precision matrix ''Λ'' , , ''μ'' (mean vector) , , Multivariate normal , , \mathbf{\boldsymbol\mu}_0,\, \boldsymbol\Lambda_0 , , \left(\boldsymbol\Lambda_0 + n\boldsymbol\Lambda\right)^{-1}\left( \boldsymbol\Lambda_0\boldsymbol\mu_0 + n \boldsymbol\Lambda \mathbf{\bar{x \right),\, \left(\boldsymbol\Lambda_0 + n\boldsymbol\Lambda\right) *\mathbf{\bar{x is the sample mean , mean was estimated from observations with total precision (sum of all individual precisions)\boldsymbol\Lambda_0 and with sample mean \boldsymbol\mu_0 , \mathcal{N}\left(\tilde{\mathbf{x\mid{\boldsymbol\mu_0}', , \boldsymbol\mu,\frac{1}{\nu'-p+1}\boldsymbol\Psi'\right) , - , Multivariate normal with known mean ''μ'' , , ''Λ'' (precision matrix) , , Wishart , , \nu ,\, \mathbf{V} , , n+\nu ,\, \left(\mathbf{V}^{-1} + \sum_{i=1}^n (\mathbf{x_i} - \boldsymbol\mu) (\mathbf{x_i} - \boldsymbol\mu)^T\right)^{-1} , covariance matrix was estimated from \nu observations with sum of pairwise deviation products \mathbf{V}^{-1} , t_{\nu'-p+1}\left(\tilde{\mathbf{x\mid\boldsymbol\mu,\frac{1}{\nu'-p+1}{\mathbf{V}'}^{-1}\right) , - , Multivariate normal , , ''μ'' (mean vector) and ''Σ'' (covariance matrix) , , normal-inverse-Wishart , , \boldsymbol\mu_0 ,\, \kappa_0 ,\, \nu_0 ,\, \boldsymbol\Psi , , \frac{\kappa_0\boldsymbol\mu_0+n\mathbf{\bar{x}{\kappa_0+n} ,\, \kappa_0+n,\, \nu_0+n ,\,
\boldsymbol\Psi + \mathbf{C} + \frac{\kappa_0 n}{\kappa_0+n}(\mathbf{\bar{x-\boldsymbol\mu_0)(\mathbf{\bar{x-\boldsymbol\mu_0)^T * \mathbf{\bar{x is the sample mean *\mathbf{C} = \sum_{i=1}^n (\mathbf{x_i} - \mathbf{\bar{x) (\mathbf{x_i} - \mathbf{\bar{x)^T , mean was estimated from \kappa_0 observations with sample mean \boldsymbol\mu_0; covariance matrix was estimated from \nu_0 observations with sample mean \boldsymbol\mu_0 and with sum of pairwise deviation products \boldsymbol\Psi=\nu_0\boldsymbol\Sigma_0 , t_, {\boldsymbol\mu_0}',\frac{\kappa_0+n} ,\, \kappa_0+n,\, \nu_0+n ,\,
\left(\mathbf{V}^{-1} + \mathbf{C} + \frac{\kappa_0 n}{\kappa_0+n}(\mathbf{\bar{x-\boldsymbol\mu_0)(\mathbf{\bar{x-\boldsymbol\mu_0)^T\right)^{-1} * \mathbf{\bar{x is the sample mean *\mathbf{C} = \sum_{i=1}^n (\mathbf{x_i} - \mathbf{\bar{x) (\mathbf{x_i} - \mathbf{\bar{x)^T , mean was estimated from \kappa_0 observations with sample mean \boldsymbol\mu_0; covariance matrix was estimated from \nu_0 observations with sample mean \boldsymbol\mu_0 and with sum of pairwise deviation products \mathbf{V}^{-1} , t_\mid {\boldsymbol\mu_0}', \frac\! , \alpha observations with sum \beta of the order of magnitude of each observation (i.e. the logarithm of the ratio of each observation to the minimum x_m) , , - , Weibull
with known shape ''β'' , , ''θ'' (scale) , , Inverse gamma , , a, b\! , , a+n,\, b+\sum_{i=1}^n x_i^{\beta}\! , a observations with sum b of the ''βth power of each observation , , - , Log-normal , colspan="6" , Same as for the normal distribution after applying the natural logarithm to the data for the posterior hyperparameters. Please refer to to see the details. , , - , Exponential , , ''λ'' (rate) , , Gamma , , \alpha,\, \beta\! , , \alpha+n,\, \beta+\sum_{i=1}^n x_i\! , \alpha-1 observations that sum to \beta , \operatorname{Lomax}(\tilde{x}\mid\beta',\alpha')
( Lomax distribution) , - , Gamma
with known shape ''α'', , ''β'' (rate) , , Gamma , , \alpha_0,\, \beta_0\!, , \alpha_0+n\alpha,\, \beta_0+\sum_{i=1}^n x_i\! , \alpha_0/\alpha observations with sum \beta_0 , \operatorname{CG}(\tilde{\mathbf{x\mid\alpha,{\alpha_0}',{\beta_0}')=\operatorname{\beta'}(\tilde{\mathbf{x, \alpha,{\alpha_0}',1,{\beta_0}') , - , Inverse Gamma
with known shape ''α'', , ''β'' (inverse scale) , , Gamma , , \alpha_0,\, \beta_0\!, , \alpha_0+n\alpha,\, \beta_0+\sum_{i=1}^n \frac{1}{x_i}\! , \alpha_0/\alpha observations with sum \beta_0 , , - , Gamma
with known rate ''β'', , ''α'' (shape) , \propto \frac{a^{\alpha-1} \beta^{\alpha c{\Gamma(\alpha)^b} , a,\, b,\, c\!, , a \prod_{i=1}^n x_i,\, b + n,\, c + n\! , b or c observations (b for estimating \alpha, c for estimating \beta) with product a , , - , Gamma, , ''α'' (shape), ''β'' (inverse scale) , , \propto \frac{p^{\alpha-1} e^{-\beta q{\Gamma(\alpha)^r \beta^{-\alpha s , , p,\, q,\, r,\, s \! , , p \prod_{i=1}^n x_i,\, q + \sum_{i=1}^n x_i,\, r + n,\, s + n \! , \alpha was estimated from r observations with product p; \beta was estimated from s observations with sum q , , - ,
Beta Beta (, ; uppercase , lowercase , or cursive ; grc, βῆτα, bē̂ta or ell, βήτα, víta) is the second letter of the Greek alphabet. In the system of Greek numerals, it has a value of 2. In Modern Greek, it represents the voiced labi ...
, , ''α'', ''β'' , , \propto \frac{\Gamma(\alpha+\beta)^k \, p^\alpha \, q^\beta}{\Gamma(\alpha)^k\,\Gamma(\beta)^k} , , p,\, q,\, k \! , , p \prod_{i=1}^n x_i,\, q \prod_{i=1}^n (1-x_i),\, k + n \! , \alpha and \beta were estimated from k observations with product p and product of the complements q , , -


See also

* Beta-binomial distribution


Notes


References

{{Reflist , refs = {{cite web , last = Fink , first = Daniel , date = 1997 , title = A Compendium of Conjugate Priors , url=https://courses.physics.ucsd.edu/2018/Fall/physics210b/REFERENCES/conjugate_priors.pdf , citeseerx = 10.1.1.157.5540 , archive-url=https://web.archive.org/web/20090529203101/http://www.people.cornell.edu/pages/df36/CONJINTRnew%20TEX.pdf , archive-date=May 29, 2009 Bayesian statistics