advanced29 min studyLesson 964 in Physics

Bayesian posteriors and prior sensitivity

Update explicitly declared probability distributions over parameters and distinguish posterior uncertainty from repeated-sample variance.

On this page

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.

p(θ∣d)=L(θ;d)π(θ)∫L(ϑ;d)π(ϑ) dϑ,E⁡[θ∣d]=∫θ p(θ∣d) dθp(\theta\mid d)=\frac{L(\theta;d)\pi(\theta)}{\int L(\vartheta;d)\pi(\vartheta)\,d\vartheta},\qquad \operatorname E[\theta\mid d]=\int\theta\,p(\theta\mid d)\,d\theta
The integration domain and prior must be declared. Posterior expectations average parameter uncertainty conditional on the observed data and model.↔ Scroll wide equations horizontally.

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.

p∣k,n∼Beta⁡(a+k,b+n−k),E⁡[p∣k,n]=a+ka+b+n,Var⁡(p∣k,n)=(a+k)(b+n−k)(a+b+n)2(a+b+n+1)p\mid k,n\sim\operatorname{Beta}(a+k,b+n-k),\qquad \operatorname E[p\mid k,n]=\frac{a+k}{a+b+n},\qquad \operatorname{Var}(p\mid k,n)=\frac{(a+k)(b+n-k)}{(a+b+n)^2(a+b+n+1)}
The variance is posterior uncertainty about p, not the variance np(1-p) of a future count with a fixed known efficiency. Shape parameters are dimensionless.↔ Scroll wide equations horizontally.

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.

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.

  1. 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.

  2. Its posterior mean is 4/6=2/34/6=2/3 and variance 4×2/(62×7)=2/63≈0.031754\times2/(6^2\times7)=2/63\approx0.03175. The posterior mode is three quarters, illustrating that a mean and a mode need not coincide.

  3. The alternative prior gives Beta(5,3) and mean 5/8=0.6255/8=0.625. The shift from two thirds is prior sensitivity with sparse data, not a disagreement about the observed success fraction.

The result

The uniform-prior posterior is Beta(4,2), with mean 2/3 and variance 2/63; the alternative-prior mean is 5/8.

Explore the model

Interactive lab

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.

Count variance is different from parameter uncertaintyThese are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Current readings: Mean · np: 5; Variance · np(1−p): 2.5; Total probability: 1. All parameters are adjustable with the labeled controls below.03581000.070.150.220.3Successes kP(X = k)k = 0 · P = 9.77e-4
Exact probabilityHighlighted outcomeMean np
Mean · np
5
Variance · np(1−p)
2.5
Total probability
1
t = 0 s

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.

Check your understanding

What does a 95% Bayesian credible interval mean in this lesson?

Try it yourself

Use a gamma prior for rate r with shape α=2\alpha=2 and rate β=1 s\beta=1\,\mathrm{s}. 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 2+3=52+3=5 and rate 1+2=3 s1+2=3\,\mathrm{s}. Its mean is 5/3 s−15/3\,\mathrm{s^{-1}} and variance 5/9 s−25/9\,\mathrm{s^{-2}}. 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.

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.