When the integral takes care of itself
In the topic The Bayesian approach a coin with a uniform prior on came up heads three times, the posterior became , and the next flip was predicted to be heads with probability . Everything there had a closed form. That was luck, not the rule. Bayes' formula
has an integral in the denominator, and for most pairs of prior and likelihood nobody can take it by hand. A grid is no escape either: with points per axis and parameters it costs evaluations, and points for parameters is already .
This topic is about the pairs where the integral takes care of itself.
Definition. A family of priors with hyperparameters is conjugate to a likelihood if, for any admissible data , the posterior stays in the family:
where the new hyperparameters are computed from and .
Three remarks keep the definition honest.
- The family is shared by the prior and the posterior only. The likelihood is a distribution over the data, often on a different space. As a function of it just has to look like the prior, so that the product keeps the form.
- Bayesian updating turns into arithmetic on a few numbers. The normalizer of the family is known, so the evidence and the predictive often come out in closed form too.
- If the observations are independent given , then . Yesterday's posterior is today's prior, , and neither the order nor the batching of the data changes the result.
How do you find a conjugate prior? Write the likelihood as a function of , drop the factors that do not depend on , and take a prior of the same shape. The next blocks do exactly this four times.