01 / 22

Conjugate
Priors

Master conjugate prior families for common Bayesian models: how choosing the right prior makes the posterior analytically tractable.

Bayesian Statistics

The Bayesian Update in One Equation

At the heart of Bayesian inference lies Bayes' theorem. Given data \(x\) and parameter \(\theta\):

\(p(\theta)\)
Prior: our belief about \(\theta\) before seeing data.
\(p(x \mid \theta)\)
Likelihood: how probable the data is given \(\theta\).
\(p(\theta \mid x)\)
Posterior: updated belief after observing data.

What Makes a Prior Conjugate?

A prior \(p(\theta)\) is conjugate to a likelihood \(p(x \mid \theta)\) if the resulting posterior \(p(\theta \mid x)\) belongs to the same distributional family as the prior.

Why does this matter? It means you can write the posterior in closed form: no integrals to evaluate, no MCMC needed. You simply update the prior's parameters.

Prior × Likelihood = Posterior

The Conjugate Prior Theorem

After observing data \(x_1, \dots, x_n\), the posterior has the same form with updated hyperparameters:

How Hyperparameter Updates Work

Prior
Params: \((\chi_0, \nu_0)\)
+ Data
\(\sum T(x_i), n\)
Posterior
Params: \((\chi_n, \nu_n)\)
Same distributional family

The posterior's hyperparameters are simple additions: the prior pseudo-counts \((\chi_0, \nu_0)\) plus the sufficient statistics from the observed data. The distributional family never changes.

Beta-Binomial Conjugacy

Likelihood
\(X \mid p \sim \text{Binomial}(n, p)\)
Prior
\(p \sim \text{Beta}(\alpha, \beta)\)

Gamma-Poisson Conjugacy

Likelihood
\(X_i \mid \lambda \sim \text{Poisson}(\lambda)\)
Prior
\(\lambda \sim \text{Gamma}(\alpha, \beta)\)

Normal-Normal Conjugacy

When the likelihood is Normal with known variance \(\sigma^2\) and unknown mean \(\mu\):

Likelihood
\(X_i \mid \mu \sim N(\mu, \sigma^2)\)
Prior
\(\mu \sim N(\mu_0, \sigma_0^2)\)

Conjugate vs Non-Conjugate Priors

Conjugate Prior Non-Conjugate Prior
Posterior form Closed-form No closed form
Computation Update hyperparameters MCMC / Variational
Flexibility Limited to conjugate family Any prior shape
Speed Instant Slow (iterative)
Best for Standard models, online learning Complex / multi-modal beliefs

The Precision-Weighted Average

In the Normal-Normal case, the posterior mean is a weighted average of the prior mean and the sample mean, weighted by their respective precisions (inverse variances):

Small \(n\)
Prior dominates: posterior is close to \(\mu_0\).
Large \(n\)
Data dominates: posterior converges to \(\bar{x}\).

Step-by-Step: Applying a Conjugate Prior

1
Identify the likelihood family. Is it Binomial, Poisson, Normal, etc.?
2
Look up the conjugate prior. Use the conjugate pair table (Beta-Binomial, Gamma-Poisson, Normal-Normal, etc.).
3
Choose hyperparameters. Encode your prior beliefs into \((\alpha, \beta)\), \((\mu_0, \sigma_0^2)\), etc. Think in terms of "pseudo-data."
4
Compute sufficient statistics. Sum up \(\sum T(x_i)\) and count \(n\) from the observed data.
5
Update hyperparameters. Add the sufficient statistics to the prior's hyperparameters to get the posterior's hyperparameters.

Example 1: Beta-Binomial

A new drug has an unknown success rate \(p\). Before the trial, we believe \(p\) is around 0.5 with moderate uncertainty: \(p \sim \text{Beta}(2, 2)\). In a trial of \(n = 10\) patients, \(x = 7\) respond.

Example 2: Gamma-Poisson

A call center receives calls at rate \(\lambda\) per hour. Prior belief: \(\lambda \sim \text{Gamma}(10, 2)\), meaning we expect about \(10/2 = 5\) calls/hr. Over \(n = 5\) hours, we observe \(\sum x_i = 35\) total calls.

Example 3: Normal-Normal

Estimating the mean weight \(\mu\) of a species. Known \(\sigma^2 = 4\). Prior: \(\mu \sim N(50, 25)\). We observe \(n = 10\) animals with \(\bar{x} = 53\).

Common Mistakes

✕ Wrong parameterization
The Gamma distribution has two common parameterizations: (shape, rate) vs (shape, scale). Mixing them up flips the posterior update. Always check which your textbook uses.
✕ Forgetting known variance
Normal-Normal conjugacy for the mean requires the variance to be known. If both \(\mu\) and \(\sigma^2\) are unknown, you need a Normal-Inverse-Gamma prior instead.
✕ Over-informative priors
Setting huge pseudo-counts (e.g., \(\text{Beta}(100, 100)\)) makes the prior dominate even large datasets. Choose hyperparameters that reflect genuine prior knowledge, not false certainty.

Conjugate Pair Reference Table

Likelihood Conjugate Prior Posterior
\(\text{Binomial}(n, p)\) \(\text{Beta}(\alpha, \beta)\) \(\text{Beta}(\alpha\!+\!x,\;\beta\!+\!n\!-\!x)\)
\(\text{Poisson}(\lambda)\) \(\text{Gamma}(\alpha, \beta)\) \(\text{Gamma}(\alpha\!+\!\Sigma x_i,\;\beta\!+\!n)\)
\(N(\mu, \sigma^2_{\text{known}})\) \(N(\mu_0, \sigma_0^2)\) \(N(\mu_n, \sigma_n^2)\)
\(N(\mu_{\text{known}}, \sigma^2)\) \(\text{Inv-Gamma}(\alpha, \beta)\) \(\text{Inv-Gamma}(\alpha\!+\!\tfrac{n}{2},\;\beta\!+\!\tfrac{\Sigma(x_i-\mu)^2}{2})\)
\(\text{Exponential}(\lambda)\) \(\text{Gamma}(\alpha, \beta)\) \(\text{Gamma}(\alpha\!+\!n,\;\beta\!+\!\Sigma x_i)\)

Question 1 of 5

What is the conjugate prior for the Binomial likelihood?

Question 2 of 5

You place a \(\text{Gamma}(4, 2)\) prior on a Poisson rate \(\lambda\). After observing \(n = 6\) days with a total count of \(\sum x_i = 30\), what is the posterior distribution?

Question 3 of 5

In Normal-Normal conjugacy (known \(\sigma^2\)), the posterior mean is a weighted average of the prior mean and the sample mean. What determines the weights?

Question 4 of 5

If you start with a \(\text{Beta}(1, 1)\) prior (i.e., \(\text{Uniform}(0,1)\)) and observe 0 successes in 5 Bernoulli trials, what is the posterior mean of \(p\)?

Question 5 of 5

Which of the following is NOT an advantage of using conjugate priors?