# Bayes estimator

__: Estimator or decision rule that minimizes the posterior expected value of a loss function__

**Short description**In estimation theory and decision theory, a **Bayes estimator** or a **Bayes action** is an estimator or decision rule that minimizes the posterior expected value of a loss function (i.e., the **posterior expected loss**). Equivalently, it maximizes the posterior expectation of a utility function. An alternative way of formulating an estimator within Bayesian statistics is maximum a posteriori estimation.

## Definition

Suppose an unknown parameter [math]\displaystyle{ \theta }[/math] is known to have a prior distribution [math]\displaystyle{ \pi }[/math]. Let [math]\displaystyle{ \widehat{\theta} = \widehat{\theta}(x) }[/math] be an estimator of [math]\displaystyle{ \theta }[/math] (based on some measurements *x*), and let [math]\displaystyle{ L(\theta,\widehat{\theta}) }[/math] be a loss function, such as squared error. The **Bayes risk** of [math]\displaystyle{ \widehat{\theta} }[/math] is defined as [math]\displaystyle{ E_\pi(L(\theta, \widehat{\theta})) }[/math], where the expectation is taken over the probability distribution of [math]\displaystyle{ \theta }[/math]: this defines the risk function as a function of [math]\displaystyle{ \widehat{\theta} }[/math]. An estimator [math]\displaystyle{ \widehat{\theta} }[/math] is said to be a *Bayes estimator* if it minimizes the Bayes risk among all estimators. Equivalently, the estimator which minimizes the posterior expected loss [math]\displaystyle{ E(L(\theta,\widehat{\theta}) | x) }[/math] *for each [math]\displaystyle{ x }[/math] * also minimizes the Bayes risk and therefore is a Bayes estimator.^{[1]}

If the prior is improper then an estimator which minimizes the posterior expected loss *for each [math]\displaystyle{ x }[/math]* is called a **generalized Bayes estimator**.^{[2]}

## Examples

### Minimum mean square error estimation

The most common risk function used for Bayesian estimation is the mean square error (MSE), also called *squared error risk*. The MSE is defined by

- [math]\displaystyle{ \mathrm{MSE} = E\left[ (\widehat{\theta}(x) - \theta)^2 \right], }[/math]

where the expectation is taken over the joint distribution of [math]\displaystyle{ \theta }[/math] and [math]\displaystyle{ x }[/math].

#### Posterior mean

Using the MSE as risk, the Bayes estimate of the unknown parameter is simply the mean of the posterior distribution,^{[3]}

- [math]\displaystyle{ \widehat{\theta}(x) = E[\theta |x]=\int \theta\, p(\theta |x)\,d\theta. }[/math]

This is known as the *minimum mean square error* (MMSE) estimator.

### Bayes estimators for conjugate priors

If there is no inherent reason to prefer one prior probability distribution over another, a conjugate prior is sometimes chosen for simplicity. A conjugate prior is defined as a prior distribution belonging to some parametric family, for which the resulting posterior distribution also belongs to the same family. This is an important property, since the Bayes estimator, as well as its statistical properties (variance, confidence interval, etc.), can all be derived from the posterior distribution.

Conjugate priors are especially useful for sequential estimation, where the posterior of the current measurement is used as the prior in the next measurement. In sequential estimation, unless a conjugate prior is used, the posterior distribution typically becomes more complex with each added measurement, and the Bayes estimator cannot usually be calculated without resorting to numerical methods.

Following are some examples of conjugate priors.

- If [math]\displaystyle{ x|\theta }[/math] is Normal, [math]\displaystyle{ x|\theta \sim N(\theta,\sigma^2) }[/math], and the prior is normal, [math]\displaystyle{ \theta \sim N(\mu,\tau^2) }[/math], then the posterior is also Normal and the Bayes estimator under MSE is given by

- [math]\displaystyle{ \widehat{\theta}(x)=\frac{\sigma^{2}}{\sigma^{2}+\tau^{2}}\mu+\frac{\tau^{2}}{\sigma^{2}+\tau^{2}}x. }[/math]

- If [math]\displaystyle{ x_1, ..., x_n }[/math] are iid Poisson random variables [math]\displaystyle{ x_i|\theta \sim P(\theta) }[/math], and if the prior is Gamma distributed [math]\displaystyle{ \theta \sim G(a,b) }[/math], then the posterior is also Gamma distributed, and the Bayes estimator under MSE is given by

- [math]\displaystyle{ \widehat{\theta}(X)=\frac{n\overline{X}+a}{n+b}. }[/math]

- If [math]\displaystyle{ x_1, ..., x_n }[/math] are iid uniformly distributed [math]\displaystyle{ x_i|\theta \sim U(0,\theta) }[/math], and if the prior is Pareto distributed [math]\displaystyle{ \theta \sim Pa(\theta_0,a) }[/math], then the posterior is also Pareto distributed, and the Bayes estimator under MSE is given by

- [math]\displaystyle{ \widehat{\theta}(X)=\frac{(a+n)\max{(\theta_0,x_1,...,x_n)}}{a+n-1}. }[/math]

### Alternative risk functions

Risk functions are chosen depending on how one measures the distance between the estimate and the unknown parameter. The MSE is the most common risk function in use, primarily due to its simplicity. However, alternative risk functions are also occasionally used. The following are several examples of such alternatives. We denote the posterior generalized distribution function by [math]\displaystyle{ F }[/math].

#### Posterior median and other quantiles

- A "linear" loss function, with [math]\displaystyle{ a\gt 0 }[/math], which yields the posterior median as the Bayes' estimate:

- [math]\displaystyle{ L(\theta,\widehat{\theta}) = a|\theta-\widehat{\theta}| }[/math]
- [math]\displaystyle{ F(\widehat{\theta }(x)|X) = \tfrac{1}{2}. }[/math]

- Another "linear" loss function, which assigns different "weights" [math]\displaystyle{ a,b\gt 0 }[/math] to over or sub estimation. It yields a quantile from the posterior distribution, and is a generalization of the previous loss function:

- [math]\displaystyle{ L(\theta,\widehat{\theta}) = \begin{cases} a|\theta-\widehat{\theta}|, & \mbox{for }\theta-\widehat{\theta} \ge 0 \\ b|\theta-\widehat{\theta}|, & \mbox{for }\theta-\widehat{\theta} \lt 0 \end{cases} }[/math]
- [math]\displaystyle{ F(\widehat{\theta }(x)|X) = \frac{a}{a+b}. }[/math]

#### Posterior mode

- The following loss function is trickier: it yields either the posterior mode, or a point close to it depending on the curvature and properties of the posterior distribution. Small values of the parameter [math]\displaystyle{ K\gt 0 }[/math] are recommended, in order to use the mode as an approximation ([math]\displaystyle{ L\gt 0 }[/math]):

- [math]\displaystyle{ L(\theta,\widehat{\theta}) = \begin{cases} 0, & \mbox{for }|\theta-\widehat{\theta}| \lt K \\ L, & \mbox{for }|\theta-\widehat{\theta}| \ge K. \end{cases} }[/math]

Other loss functions can be conceived, although the mean squared error is the most widely used and validated. Other loss functions are used in statistics, particularly in robust statistics.

## Generalized Bayes estimators

The prior distribution [math]\displaystyle{ p }[/math] has thus far been assumed to be a true probability distribution, in that

- [math]\displaystyle{ \int p(\theta) d\theta = 1. }[/math]

However, occasionally this can be a restrictive requirement. For example, there is no distribution (covering the set, **R**, of all real numbers) for which every real number is equally likely. Yet, in some sense, such a "distribution" seems like a natural choice for a non-informative prior, i.e., a prior distribution which does not imply a preference for any particular value of the unknown parameter. One can still define a function [math]\displaystyle{ p(\theta) = 1 }[/math], but this would not be a proper probability distribution since it has infinite mass,

- [math]\displaystyle{ \int{p(\theta)d\theta}=\infty. }[/math]

Such measures [math]\displaystyle{ p(\theta) }[/math], which are not probability distributions, are referred to as improper priors.

The use of an improper prior means that the Bayes risk is undefined (since the prior is not a probability distribution and we cannot take an expectation under it). As a consequence, it is no longer meaningful to speak of a Bayes estimator that minimizes the Bayes risk. Nevertheless, in many cases, one can define the posterior distribution

- [math]\displaystyle{ p(\theta|x) = \frac{p(x|\theta) p(\theta)}{\int p(x|\theta) p(\theta) d\theta}. }[/math]

This is a definition, and not an application of Bayes' theorem, since Bayes' theorem can only be applied when all distributions are proper. However, it is not uncommon for the resulting "posterior" to be a valid probability distribution. In this case, the posterior expected loss

- [math]\displaystyle{ \int{L(\theta,a)p(\theta|x)d\theta} }[/math]

is typically well-defined and finite. Recall that, for a proper prior, the Bayes estimator minimizes the posterior expected loss. When the prior is improper, an estimator which minimizes the posterior expected loss is referred to as a **generalized Bayes estimator**.^{[2]}

### Example

A typical example is estimation of a location parameter with a loss function of the type [math]\displaystyle{ L(a-\theta) }[/math]. Here [math]\displaystyle{ \theta }[/math] is a location parameter, i.e., [math]\displaystyle{ p(x|\theta) = f(x-\theta) }[/math].

It is common to use the improper prior [math]\displaystyle{ p(\theta)=1 }[/math] in this case, especially when no other more subjective information is available. This yields

- [math]\displaystyle{ p(\theta|x) = \frac{p(x|\theta) p(\theta)}{p(x)} = \frac{f(x-\theta)}{p(x)} }[/math]

so the posterior expected loss

- [math]\displaystyle{ E[L(a-\theta)|x] = \int{L(a-\theta) p(\theta|x) d\theta} = \frac{1}{p(x)} \int L(a-\theta) f(x-\theta) d\theta. }[/math]

The generalized Bayes estimator is the value [math]\displaystyle{ a(x) }[/math] that minimizes this expression for a given [math]\displaystyle{ x }[/math]. This is equivalent to minimizing

- [math]\displaystyle{ \int L(a-\theta) f(x-\theta) d\theta }[/math] for a given [math]\displaystyle{ x. }[/math] (1)

In this case it can be shown that the generalized Bayes estimator has the form [math]\displaystyle{ x+a_0 }[/math], for some constant [math]\displaystyle{ a_0 }[/math]. To see this, let [math]\displaystyle{ a_0 }[/math] be the value minimizing (1) when [math]\displaystyle{ x=0 }[/math]. Then, given a different value [math]\displaystyle{ x_1 }[/math], we must minimize

- [math]\displaystyle{ \int L(a-\theta) f(x_1-\theta) d\theta = \int L(a-x_1-\theta') f(-\theta') d\theta'. }[/math] (2)

This is identical to (1), except that [math]\displaystyle{ a }[/math] has been replaced by [math]\displaystyle{ a-x_1 }[/math]. Thus, the expression minimizing is given by [math]\displaystyle{ a-x_1 = a_0 }[/math], so that the optimal estimator has the form

- [math]\displaystyle{ a(x) = a_0 + x.\,\! }[/math]

## Empirical Bayes estimators

A Bayes estimator derived through the empirical Bayes method is called an **empirical Bayes estimator**. Empirical Bayes methods enable the use of auxiliary empirical data, from observations of related parameters, in the development of a Bayes estimator. This is done under the assumption that the estimated parameters are obtained from a common prior. For example, if independent observations of different parameters are performed, then the estimation performance of a particular parameter can sometimes be improved by using data from other observations.

There are both parametric and non-parametric approaches to empirical Bayes estimation.^{[4]}

### Example

The following is a simple example of parametric empirical Bayes estimation. Given past observations [math]\displaystyle{ x_1,\ldots,x_n }[/math] having conditional distribution [math]\displaystyle{ f(x_i|\theta_i) }[/math], one is interested in estimating [math]\displaystyle{ \theta_{n+1} }[/math] based on [math]\displaystyle{ x_{n+1} }[/math]. Assume that the [math]\displaystyle{ \theta_i }[/math]'s have a common prior [math]\displaystyle{ \pi }[/math] which depends on unknown parameters. For example, suppose that [math]\displaystyle{ \pi }[/math] is normal with unknown mean [math]\displaystyle{ \mu_\pi\,\! }[/math] and variance [math]\displaystyle{ \sigma_\pi\,\!. }[/math] We can then use the past observations to determine the mean and variance of [math]\displaystyle{ \pi }[/math] in the following way.

First, we estimate the mean [math]\displaystyle{ \mu_m\,\! }[/math] and variance [math]\displaystyle{ \sigma_m\,\! }[/math] of the marginal distribution of [math]\displaystyle{ x_1, \ldots, x_n }[/math] using the maximum likelihood approach:

- [math]\displaystyle{ \widehat{\mu}_m=\frac{1}{n}\sum{x_i}, }[/math]
- [math]\displaystyle{ \widehat{\sigma}_m^{2}=\frac{1}{n}\sum{(x_i-\widehat{\mu}_m)^{2}}. }[/math]

Next, we use the law of total expectation to compute [math]\displaystyle{ \mu_m }[/math] and the law of total variance to compute [math]\displaystyle{ \sigma_m^{2} }[/math] such that

- [math]\displaystyle{ \mu_m=E_\pi[\mu_f(\theta)] \,\!, }[/math]
- [math]\displaystyle{ \sigma_m^{2}=E_\pi[\sigma_f^{2}(\theta)]+E_\pi[(\mu_f(\theta)-\mu_m)^{2}], }[/math]

where [math]\displaystyle{ \mu_f(\theta) }[/math] and [math]\displaystyle{ \sigma_f(\theta) }[/math] are the moments of the conditional distribution [math]\displaystyle{ f(x_i|\theta_i) }[/math], which are assumed to be known. In particular, suppose that [math]\displaystyle{ \mu_f(\theta) = \theta }[/math] and that [math]\displaystyle{ \sigma_f^{2}(\theta) = K }[/math]; we then have

- [math]\displaystyle{ \mu_\pi=\mu_m \,\!, }[/math]
- [math]\displaystyle{ \sigma_\pi^{2}=\sigma_m^{2}-\sigma_f^{2}=\sigma_m^{2}-K . }[/math]

Finally, we obtain the estimated moments of the prior,

- [math]\displaystyle{ \widehat{\mu}_\pi=\widehat{\mu}_m, }[/math]
- [math]\displaystyle{ \widehat{\sigma}_\pi^{2}=\widehat{\sigma}_m^{2}-K. }[/math]

For example, if [math]\displaystyle{ x_i|\theta_i \sim N(\theta_i,1) }[/math], and if we assume a normal prior (which is a conjugate prior in this case), we conclude that [math]\displaystyle{ \theta_{n+1}\sim N(\widehat{\mu}_\pi,\widehat{\sigma}_\pi^{2}) }[/math], from which the Bayes estimator of [math]\displaystyle{ \theta_{n+1} }[/math] based on [math]\displaystyle{ x_{n+1} }[/math] can be calculated.

## Properties

### Admissibility

Bayes rules having finite Bayes risk are typically admissible. The following are some specific examples of admissibility theorems.

- If a Bayes rule is unique then it is admissible.
^{[5]}For example, as stated above, under mean squared error (MSE) the Bayes rule is unique and therefore admissible. - If θ belongs to a discrete set, then all Bayes rules are admissible.
- If θ belongs to a continuous (non-discrete) set, and if the risk function R(θ,δ) is continuous in θ for every δ, then all Bayes rules are admissible.

By contrast, generalized Bayes rules often have undefined Bayes risk in the case of improper priors. These rules are often inadmissible and the verification of their admissibility can be difficult. For example, the generalized Bayes estimator of a location parameter θ based on Gaussian samples (described in the "Generalized Bayes estimator" section above) is inadmissible for [math]\displaystyle{ p\gt 2 }[/math]; this is known as Stein's phenomenon.

### Asymptotic efficiency

Let θ be an unknown random variable, and suppose that [math]\displaystyle{ x_1,x_2,\ldots }[/math] are iid samples with density [math]\displaystyle{ f(x_i|\theta) }[/math]. Let [math]\displaystyle{ \delta_n = \delta_n(x_1,\ldots,x_n) }[/math] be a sequence of Bayes estimators of θ based on an increasing number of measurements. We are interested in analyzing the asymptotic performance of this sequence of estimators, i.e., the performance of [math]\displaystyle{ \delta_n }[/math] for large *n*.

To this end, it is customary to regard θ as a deterministic parameter whose true value is [math]\displaystyle{ \theta_0 }[/math]. Under specific conditions,^{[6]} for large samples (large values of *n*), the posterior density of θ is approximately normal. In other words, for large *n*, the effect of the prior probability on the posterior is negligible. Moreover, if δ is the Bayes estimator under MSE risk, then it is asymptotically unbiased and it converges in distribution to the normal distribution:

- [math]\displaystyle{ \sqrt{n}(\delta_n - \theta_0) \to N\left(0 , \frac{1}{I(\theta_0)}\right), }[/math]

where *I*(θ_{0}) is the Fisher information of θ_{0}.
It follows that the Bayes estimator δ_{n} under MSE is asymptotically efficient.

Another estimator which is asymptotically normal and efficient is the maximum likelihood estimator (MLE). The relations between the maximum likelihood and Bayes estimators can be shown in the following simple example.

#### Example: estimating *p* in a binomial distribution

Consider the estimator of θ based on binomial sample *x*~b(θ,*n*) where θ denotes the probability for success. Assuming θ is distributed according to the conjugate prior, which in this case is the Beta distribution B(*a*,*b*), the posterior distribution is known to be B(a+x,b+n-x). Thus, the Bayes estimator under MSE is

- [math]\displaystyle{ \delta_n(x)=E[\theta|x]=\frac{a+x}{a+b+n}. }[/math]

The MLE in this case is x/n and so we get,

- [math]\displaystyle{ \delta_n(x)=\frac{a+b}{a+b+n}E[\theta]+\frac{n}{a+b+n}\delta_{MLE}. }[/math]

The last equation implies that, for *n* → ∞, the Bayes estimator (in the described problem) is close to the MLE.

On the other hand, when *n* is small, the prior information is still relevant to the decision problem and affects the estimate. To see the relative weight of the prior information, assume that *a*=*b*; in this case each measurement brings in 1 new bit of information; the formula above shows that the prior information has the same weight as *a+b* bits of the new information. In applications, one often knows very little about fine details of the prior distribution; in particular, there is no reason to assume that it coincides with B(*a*,*b*) exactly. In such a case, one possible interpretation of this calculation is: "there is a non-pathological prior distribution with the mean value 0.5 and the standard deviation *d* which gives the weight of prior information equal to 1/(4*d*^{2})-1 bits of new information."

Another example of the same phenomena is the case when the prior estimate and a measurement are normally distributed. If the prior is centered at *B* with deviation Σ, and the measurement is centered at *b* with deviation σ, then the posterior is centered at [math]\displaystyle{ \frac{\alpha}{\alpha+\beta}B+\frac{\beta}{\alpha+\beta}b }[/math], with weights in this weighted average being α=σ², β=Σ². Moreover, the squared posterior deviation is Σ²+σ². In other words, the prior is combined with the measurement in *exactly* the same way as if it were an extra measurement to take into account.

For example, if Σ=σ/2, then the deviation of 4 measurements combined matches the deviation of the prior (assuming that errors of measurements are independent). And the weights α,β in the formula for posterior match this: the weight of the prior is 4 times the weight of the measurement. Combining this prior with *n* measurements with average *v* results in the posterior centered at [math]\displaystyle{ \frac{4}{4+n}V+\frac{n}{4+n}v }[/math]; in particular, the prior plays the same role as 4 measurements made in advance. In general, the prior has the weight of (σ/Σ)² measurements.

Compare to the example of binomial distribution: there the prior has the weight of (σ/Σ)²−1 measurements. One can see that the exact weight does depend on the details of the distribution, but when σ≫Σ, the difference becomes small.

## Practical example of Bayes estimators

The Internet Movie Database uses a formula for calculating and comparing the ratings of films by its users, including their Top Rated 250 Titles which is claimed to give "a true Bayesian estimate".^{[7]} The following Bayesian formula was initially used to calculate a weighted average score for the Top 250, though the formula has since changed:

- [math]\displaystyle{ W = {Rv + Cm\over v+m}\ }[/math]

where:

- [math]\displaystyle{ W\ }[/math] = weighted rating
- [math]\displaystyle{ R\ }[/math] = average rating for the movie as a number from 1 to 10 (mean) = (Rating)
- [math]\displaystyle{ v\ }[/math] = number of votes/ratings for the movie = (votes)
- [math]\displaystyle{ m\ }[/math] = weight given to the prior estimate (in this case, the number of votes IMDB deemed necessary for average rating to approach statistical validity)
- [math]\displaystyle{ C\ }[/math] = the mean vote across the whole pool (currently 7.0)

Note that *W* is just the weighted arithmetic mean of *R* and *C* with weight vector *(v, m)*. As the number of ratings surpasses *m*, the confidence of the average rating surpasses the confidence of the mean vote for all films (C), and the weighted bayesian rating (W) approaches a straight average (R). The closer *v* (the number of ratings for the film) is to zero, the closer *W* is to *C*, where W is the weighted rating and C is the average rating of all films. So, in simpler terms, the fewer ratings/votes cast for a film, the more that film's Weighted Rating will skew towards the average across all films, while films with many ratings/votes will have a rating approaching its pure arithmetic average rating.

IMDb's approach ensures that a film with only a few ratings, all at 10, would not rank above "the Godfather", for example, with a 9.2 average from over 500,000 ratings.

## See also

## Notes

- ↑ Lehmann and Casella, Theorem 4.1.1
- ↑
^{2.0}^{2.1}Lehmann and Casella, Definition 4.2.9 - ↑ Jaynes, E.T. (2007).
*Probability Theory: The Logic of Science*(5. print. ed.). Cambridge [u.a.]: Cambridge Univ. Press. p. 172. ISBN 978-0-521-59271-0. - ↑ Berger (1980), section 4.5.
- ↑ Lehmann and Casella (1998), Theorem 5.2.4.
- ↑ Lehmann and Casella (1998), section 6.8
- ↑ IMDb Top 250

## References

- Lehmann, E. L.; Casella, G. (1998).
*Theory of Point Estimation*(2nd ed.). Springer. ISBN 0-387-98502-6. - Berger, James O. (1985).
*Statistical decision theory and Bayesian Analysis*(2nd ed.). New York: Springer-Verlag. ISBN 0-387-96098-8.

## External links

- Hazewinkel, Michiel, ed. (2001), "Bayesian estimator",
*Encyclopedia of Mathematics*, Springer Science+Business Media B.V. / Kluwer Academic Publishers, ISBN 978-1-55608-010-4, https://www.encyclopediaofmath.org/index.php?title=p/b015420

Original source: https://en.wikipedia.org/wiki/Bayes estimator.
Read more |