Algorithm Search⌘K

Definitioncore

Bayes estimator

Also called posterior mean estimator.

The estimator that minimizes posterior expected loss: the posterior mean for squared loss, the median for absolute loss. It minimizes the Bayes risk.

A Bayes estimator for a prior π\pi and a loss function LL is an estimator that minimizes the Bayes risk, the risk averaged over the prior. It can be found one data set at a time: for each observed xx, take the value aa that minimizes the posterior expected loss ∫L(θ,a) π(dθ∣x)\int L(\theta, a)\, \pi(d\theta \mid x). Under squared error this is the posterior mean, under absolute error a posterior median, and the posterior mode is the limit under 0-1 losses with a shrinking window. The prior and the loss together decide the estimator; the data enter only through the posterior.

Definition

Use the notation of statistical decision theory. Data XX have density f(x∣θ)f(x \mid \theta), θ∈Θ\theta \in \Theta has a prior π\pi, the posterior is π(dθ∣x)\pi(d\theta \mid x) and the marginal law of XX is mm. A rule δ\delta has risk R(θ,δ)=E[L(θ,δ(X))∣θ]R(\theta, \delta) = E[L(\theta, \delta(X)) \mid \theta] and Bayes risk r(π,δ)=∫R(θ,δ) π(dθ)r(\pi, \delta) = \int R(\theta, \delta)\, \pi(d\theta).

  • The posterior expected loss of an action aa is ρ(a∣x)=∫L(θ,a) π(dθ∣x)\rho(a \mid x) = \int L(\theta, a)\, \pi(d\theta \mid x).
  • A Bayes estimator (Bayes rule) for π\pi is a rule δπ\delta_\pi with r(π,δπ)=inf⁡δr(π,δ)<∞r(\pi, \delta_\pi) = \inf_\delta r(\pi, \delta) < \infty.
  • By Fubini's theorem r(π,δ)=∫ρ(δ(x)∣x) m(dx)r(\pi, \delta) = \int \rho(\delta(x) \mid x)\, m(dx). So a rule with δ(x)\delta(x) a minimizer of ρ(⋅∣x)\rho(\cdot \mid x) for mm-almost every xx is a Bayes estimator. Its values on a set of xx with mm-probability 0 do not matter.
  • A generalized Bayes estimator minimizes ρ(a∣x)\rho(a \mid x) when π\pi is an improper prior with a proper posterior. It need not be a Bayes rule, because its Bayes risk against an infinite measure is usually infinite.

Squared error: the posterior mean. Let L(θ,a)=(θ−a)2L(\theta, a) = (\theta - a)^2 and let the posterior have a finite second moment. Then

ρ(a∣x)=Var(θ∣x)+(E[θ∣x]−a)2,\rho(a \mid x) = \mathrm{Var}(\theta \mid x) + \big(E[\theta \mid x] - a\big)^2,

which is smallest at a=E[θ∣x]a = E[\theta \mid x], with value Var(θ∣x)\mathrm{Var}(\theta \mid x). So δπ(x)=E[θ∣x]\delta_\pi(x) = E[\theta \mid x], and its Bayes risk is r(π,δπ)=E[Var(θ∣X)]r(\pi, \delta_\pi) = E[\mathrm{Var}(\theta \mid X)], the expected posterior variance. For a vector θ\theta and the loss ∥θ−a∥2\lVert \theta - a \rVert^2 the Bayes estimator is the vector of posterior means. For the weighted loss w(θ)(θ−a)2w(\theta)(\theta - a)^2 it is E[w(θ)θ∣x]/E[w(θ)∣x]E[w(\theta)\theta \mid x]/E[w(\theta) \mid x].

Absolute error: a posterior median. Let L(θ,a)=∣θ−a∣L(\theta, a) = |\theta - a| and let the posterior have a finite first moment. Then ρ(a∣x)=E[∣θ−a∣∣x]\rho(a \mid x) = E[|\theta - a| \mid x] is convex in aa, with right derivative P(θ≤a∣x)−P(θ>a∣x)P(\theta \le a \mid x) - P(\theta > a \mid x) and left derivative P(θ<a∣x)−P(θ≥a∣x)P(\theta < a \mid x) - P(\theta \ge a \mid x). A convex function is smallest at aa exactly when its left derivative is at most 0 and its right derivative at least 0, that is when P(θ<a∣x)≤1/2≤P(θ≤a∣x)P(\theta < a \mid x) \le 1/2 \le P(\theta \le a \mid x). This is the definition of a posterior median, so every posterior median minimizes ρ\rho. With the asymmetric loss c1(θ−a)++c2(a−θ)+c_1(\theta - a)^+ + c_2(a - \theta)^+ the same argument gives the posterior quantile of order c1/(c1+c2)c_1/(c_1 + c_2).

0-1 loss: the mode as a limit. Let Lε(θ,a)=1{∣θ−a∣>ε}L_\varepsilon(\theta, a) = 1\{|\theta - a| > \varepsilon\}. The Bayes action maximizes the posterior probability of [a−ε,a+ε][a - \varepsilon, a + \varepsilon]. If the posterior density is continuous with a unique maximum, these actions tend to the posterior mode as ε→0\varepsilon \to 0. The mode is the maximum a posteriori estimate; it is a limit of Bayes estimators, and it is not a Bayes estimator for a fixed loss in general.

An unbiased Bayes estimator has Bayes risk 0. Under squared error, let δ\delta be a Bayes estimator for a proper prior π\pi with E[θ2]<∞E[\theta^2] < \infty and r(π,δ)<∞r(\pi, \delta) < \infty. If δ\delta is unbiased, E[δ(X)∣θ]=θE[\delta(X) \mid \theta] = \theta for every θ\theta, then r(π,δ)=0r(\pi, \delta) = 0. Proof: compute E[θ δ(X)]E[\theta\, \delta(X)] in two ways under the joint law of (θ,X)(\theta, X). Given XX, δ(X)=E[θ∣X]\delta(X) = E[\theta \mid X], so E[θ δ(X)]=E[δ(X)2]E[\theta\, \delta(X)] = E[\delta(X)^2]. Given θ\theta, E[δ(X)∣θ]=θE[\delta(X) \mid \theta] = \theta, so E[θ δ(X)]=E[θ2]E[\theta\, \delta(X)] = E[\theta^2]. Then r(π,δ)=E[δ2]−2E[θδ]+E[θ2]=0r(\pi, \delta) = E[\delta^2] - 2E[\theta\delta] + E[\theta^2] = 0. The result is older than the paper of Bickel and Blackwell (1967), who extend it to other losses. A Bayes risk of 0 means the data determine θ\theta with prior probability 1, so in every non-trivial problem a Bayes estimator under squared error is biased (see estimator bias).

Examples and non-examples

Three losses, one posterior. With n=10n = 10 trials, x=3x = 3 successes and the uniform prior, the posterior of pp is Beta(4,8)(4, 8). Its mean is 1/31/3, its median 0.3238 and its mode 3/103/10. The posterior expected squared loss at the mean is the posterior variance 4⋅8/(122⋅13)=2/117=0.0170944 \cdot 8/(12^2 \cdot 13) = 2/117 = 0.017094; the expected absolute loss at the median is 0.10571. A direct search over a=0.0005,0.0010,…,0.9995a = 0.0005, 0.0010, \ldots, 0.9995, with the posterior written as a sum over 20000 equal cells, finds the minimum of the expected squared loss at 0.3335 (the grid point next to 1/31/3) and of the expected absolute loss at 0.3240 (next to 0.3238). The 0-1 loss with window ε=0.1\varepsilon = 0.1, 0.05 and 0.01 gives 0.3065, 0.3015 and 0.3000, which approach the mode.

Bayes risk against the MLE. In the same model, X∼X \sim Binomial(10,p)(10, p) with the uniform prior, the posterior mean is (X+1)/12(X + 1)/12. Its risk is (10p(1−p)+(1−2p)2)/144\big(10p(1 - p) + (1 - 2p)^2\big)/144, and the average over the uniform prior is exactly 1/72=0.013891/72 = 0.01389. This equals E[Var(p∣X)]E[\mathrm{Var}(p \mid X)], which is ∑x=010111⋅(x+1)(11−x)122⋅13=1/72\sum_{x=0}^{10} \frac{1}{11} \cdot \frac{(x + 1)(11 - x)}{12^2 \cdot 13} = 1/72, because XX is uniform on {0,…,10}\{0, \ldots, 10\} under this prior. The MLE X/10X/10 has Bayes risk ∫01p(1−p)/10 dp=1/60=0.01667\int_0^1 p(1 - p)/10\, dp = 1/60 = 0.01667, larger, as it must be. Both values are exact rational numbers.

A normal mean. Let X1,…,Xn∣θX_1, \ldots, X_n \mid \theta be iid N(θ,σ2)N(\theta, \sigma^2) with σ\sigma known and θ∼N(μ0,τ02)\theta \sim N(\mu_0, \tau_0^2). The posterior is normal, so its mean, median and mode agree: δπ=wXˉ+(1−w)μ0\delta_\pi = w\bar X + (1 - w)\mu_0 with w=(n/σ2)/(n/σ2+1/τ02)w = (n/\sigma^2)/(n/\sigma^2 + 1/\tau_0^2). It is biased, E[δπ∣θ]=wθ+(1−w)μ0E[\delta_\pi \mid \theta] = w\theta + (1 - w)\mu_0, as the theorem above requires. For the data 9.8, 10.4, 10.1, 9.6, 10.6 with σ=0.5\sigma = 0.5 and prior N(9,0.42)N(9, 0.4^2), w=20/26.25=0.7619w = 20/26.25 = 0.7619 and δπ=9.8381\delta_\pi = 9.8381.

An unbiased rule that is Bayes. For X∼X \sim Binomial(n,p)(n, p) and a prior that puts mass 1/2 on each of p=0p = 0 and p=1p = 1, the data are all 0 or all 1, and X/nX/n gives the right answer with probability 1. It is unbiased and Bayes, with Bayes risk 0, as the theorem allows.

Non-example: the sample mean of normal data. Xˉ\bar X is unbiased for θ\theta with risk σ2/n>0\sigma^2/n > 0 at every θ\theta, so by the theorem it is not a Bayes estimator under squared error for any proper prior. It is the generalized Bayes estimator for the flat improper prior, and a limit of the Bayes estimators above as τ0→∞\tau_0 \to \infty. In one dimension it is still admissible and minimax.

Non-example: the mode after a change of scale. The posterior median is invariant under strictly monotone maps: the median of log⁡(p/(1−p))\log(p/(1 - p)) is the log-odds of the median of pp. The mode is not. On the log-odds scale the Beta(4,8)(4, 8) posterior has density proportional to p4(1−p)8p^4(1 - p)^8, whose maximum is at p=1/3p = 1/3, not at the mode 3/103/10 on the pp scale. The posterior mean is not invariant either: E[g(θ)∣x]≠g(E[θ∣x])E[g(\theta) \mid x] \ne g(E[\theta \mid x]) for a nonlinear gg.

References

  1. Christian P. Robert, The Bayesian Choice, 2nd edition, Springer, 2007, Chapter 2 (decision-theoretic foundations, Bayes risk and Bayes estimators) and Chapter 4 (Bayesian point estimation under squared, absolute and 0-1 losses)
  2. P. J. Bickel and D. Blackwell, A note on Bayes estimates, Annals of Mathematical Statistics 38(6), 1967, pages 1907 to 1911 (an unbiased Bayes estimate under squared error has Bayes risk 0, and the extension to more general losses)
  3. Andrew Gelman, John B. Carlin, Hal S. Stern, David B. Dunson, Aki Vehtari and Donald B. Rubin, Bayesian Data Analysis, 3rd edition, CRC Press, 2013, Chapter 2 (posterior summaries for the binomial and normal models) and Chapter 9 (decision analysis)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/HC9Z9C/text.yaml