Bayesian posteriors and prior sensitivity
Update explicitly declared probability distributions over parameters and distinguish posterior uncertainty from repeated-sample variance.
On this page
The question for today
What you’ll understand
- Normalize a posterior and state its conditioning information.
- Apply beta-binomial and gamma-Poisson conjugacy with explicit conventions.
- Assess reasonable prior alternatives without calling a prior uniquely ignorant.
A Bayesian analysis combines a sampling model with a probability distribution describing uncertainty about its parameters. Once the data are observed, the posterior answers questions conditional on both ingredients. It is therefore essential to distinguish uncertainty about a fixed efficiency from fluctuations of future detected events. We will use simple conjugate models so every normalization and moment can be calculated by hand. Their convenience will also make prior sensitivity visible, particularly when the data set is small or a parameter approaches a physical boundary.
Condition on a model as well as data
Write the likelihood as the probability of observed data given a parameter, then multiply by a prior density and normalize over the allowed parameter domain. The likelihood alone is not a density over the parameter. Its dimensions, normalization and transformation law serve a different role. A posterior mean, median or mode summarizes different features of the resulting distribution; none is automatically the answer to every loss function or scientific question. Reporting the full distribution or useful quantiles often preserves more information.
A prior must be specified before inspecting the information it is meant to precede. Earlier calibration data can inform it, provided those same data are not included again as an independent likelihood factor. A density uniform in one coordinate generally becomes nonuniform after a nonlinear reparameterization because of its Jacobian. An improper prior requires checking that the posterior is normalizable and can create additional difficulties for model probabilities. Prior sensitivity is part of the analysis rather than a test of personal confidence.
An efficiency has a bounded parameter space
Let k successes occur in n independent trials sharing efficiency p. A beta prior with positive shape parameters a and b has support between zero and one, with density proportional to p to power a minus one times one minus p to power b minus one. Multiplication by the binomial likelihood updates the two exponents. The result is another beta distribution. The prior parameters can encode assumptions or previous evidence, but should not be described literally as extra observed trials without stating that interpretation.
For a small calibration sample the posterior can change appreciably under plausible alternative shape parameters. Compare posterior summaries relevant to the scientific use, such as an efficiency correction or a tail probability, rather than only comparing the modes. A bounded posterior is not generally symmetric, and replacing it with an unbounded Gaussian may assign impossible efficiencies. A concentrated posterior can also be misleading if the trials have different efficiencies, dependence, misclassified outcomes or unmodeled selection.
Specify rate versus scale for continuous priors
For a nonnegative Poisson rate r, choose a gamma prior with shape alpha and rate beta, not scale beta. Its density is proportional to r to power alpha minus one times the exponential of minus beta times r. If exposure has time units, beta also has time units, so its product with r is dimensionless. An observed count over known exposure increases the shape by the count and increases the prior rate by the exposure. Confusing rate and scale conventions reverses the relevant denominator.
A credible interval contains a declared posterior probability under the chosen model. It does not by its definition have that same frequentist coverage for every fixed true parameter. Future-data prediction additionally integrates the sampling distribution against the posterior, which generally adds predictive variation. Prior checks and posterior model checks address different questions, and neither is replaced by obtaining an analytic posterior. The examples assume exactly known trials or exposure and no background; uncertainty in these quantities requires a larger joint model.
Work it through
A four-trial efficiency calibration
Observe k = 3 successes in n = 4 independent trials. Starting with a uniform Beta(1,1) prior, find the posterior mean and variance. Compare the mean obtained with a Beta(2,2) prior.
The uniform prior updates to Beta(4,2), since three successes add to the first shape and one failure to the second. Its support remains the physical interval from zero to one.
Its posterior mean is and variance . The posterior mode is three quarters, illustrating that a mean and a mode need not coincide.
The alternative prior gives Beta(5,3) and mean . The shift from two thirds is prior sensitivity with sparse data, not a disagreement about the observed success fraction.
The uniform-prior posterior is Beta(4,2), with mean 2/3 and variance 2/63; the alternative-prior mean is 5/8.
The living notebook
Explore the model
Interactive lab · probability
Count variance is different from parameter uncertainty
Reset and set BOTH Success probability p = 0.5 and Trials n = 4; predict mean 2 and count variance 1. For a fresh comparison, Reset and set p = 0.75 and n = 4; predict mean 3 and variance 0.75.
- Mean · np
- 5
- Variance · np(1−p)
- 2.5
- Total probability
- 1
These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forThis is a binomial count distribution at fixed p. It does not update p, display a beta posterior, choose a prior or generate random observations.
Pause & reason
Check your understanding
Your turn
Try it yourself
Use a gamma prior for rate r with shape and rate . Observe N = 3 Poisson events over T = 2 s with no background and unit efficiency. Find the posterior shape, rate, mean and variance.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Gamma rate has time units here; add exposure to it rather than inverting it.
Compare with the solution
The posterior is gamma with shape and rate . Its mean is and variance . These are posterior moments of the physical rate. They differ conceptually from the count variance or the repeated-sample variance of a particular rate estimator. A gamma scale parameter would instead be one third of an inverse second, so declaring the rate convention is essential.
Keep the idea
Take it with you
- Posterior probabilities condition on a likelihood, prior and observed data.
- Parameter uncertainty differs from future count fluctuations.
- Prior sensitivity and parameterization conventions should be explicit.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.