Lecture 28 Bayesian Inference: Priors and Posteriors

So far the parameter θ\theta has been a fixed but unknown number, and a sentence such as “θ\theta is probably close to 0.30.3” had no meaning. In this lecture and in lecture 29 we will see that the parameter itself can be given a probability distribution. The prior distribution is chosen before the data are seen, and the posterior distribution is obtained from it once the data are seen.

28.1 Prior, Likelihood and Posterior

In the Bayesian approach the parameter θ\theta is a random variable. The model then describes the distribution of the data for a given value of the parameter, and thus the model density is a conditional density. In the Bayesian lectures we write it as f⁢(x|θ)f(x\mskip 1.0mu|\mskip 1.0mu\theta) instead of f⁢(x;θ)f(x;\theta). Here x=(x1,…,xn)x=(x_{1},\dots,x_{n}) is the whole data set, so that f⁢(x|θ)=∏if⁢(xi|θ)f(x\mskip 1.0mu|\mskip 1.0mu\theta)=\prod_{i}f(x_{i}\mskip 1.0mu|\mskip 1.0mu\theta) is the likelihood L⁢(θ)L(\theta) of lecture 4.

Definition 28.1.

Let θ\theta be a random variable with values in Θ\Theta and density π⁢(θ)\pi(\theta), and assume that given θ\theta the data X=(X1,…,Xn)X=(X_{1},\dots,X_{n}) have joint density (or probability weights) f⁢(x|θ)f(x\mskip 1.0mu|\mskip 1.0mu\theta). Then the density π\pi is called the prior density (or prior) of θ\theta and the conditional density π⁢(θ|x)\pi(\theta\mskip 1.0mu|\mskip 1.0mux) of θ\theta given X=xX=x is called the posterior density (or posterior).

The prior represents the knowledge about θ\theta which is available before the data are seen, and where there is little such knowledge we choose it by a rule which depends only on the model (section 28.4), so that the posterior is determined by the data as far as possible. We use the letter π\pi for both densities, and the argument shows which one is meant: π⁢(θ)\pi(\theta) is the prior and π⁢(θ|x)\pi(\theta\mskip 1.0mu|\mskip 1.0mux) is the posterior.

The following lemma shows how the posterior is computed from the prior and the likelihood. It is Bayes’ theorem (proposition A.20) for the parameter and the data.

Lemma 28.2.

In the situation of definition 28.1, let m⁢(x)=∫Θf⁢(x|ϑ)⁢π⁢(ϑ)⁢dϑm(x)=\int_{\Theta}f(x\mskip 1.0mu|\mskip 1.0mu\vartheta)\,\pi(\vartheta)\,% \mathrm{d}\vartheta be the marginal density of the data. Then the posterior density is given by

equation (28.1) (28.1)
π⁢(θ|x)=f⁢(x|θ)⁢π⁢(θ)m⁢(x)for all x with m⁢(x)>0.\pi(\theta\mskip 1.0mu|\mskip 1.0mux)=\frac{f(x\mskip 1.0mu|\mskip 1.0mu\theta% )\,\pi(\theta)}{m(x)}\qquad\text{for all $x$ with $m(x)>0$.}
Proof.

The joint density of (θ,X)(\theta,X) is given by f⁢(x|θ)⁢π⁢(θ)f(x\mskip 1.0mu|\mskip 1.0mu\theta)\,\pi(\theta). Integrating out θ\theta gives the marginal density m⁢(x)m(x) of XX. Dividing the joint density by m⁢(x)m(x) gives the conditional density of θ\theta given X=xX=x. This completes the proof. ∎

The denominator m⁢(x)m(x) makes the posterior integrate to one and does not involve θ\theta. In practice we therefore do not compute it directly, but write

equation (28.2) (28.2)
π⁢(θ|x)∝f⁢(x|θ)⁢π⁢(θ),\pi(\theta\mskip 1.0mu|\mskip 1.0mux)\propto f(x\mskip 1.0mu|\mskip 1.0mu% \theta)\,\pi(\theta),

where ∝\propto means “equal up to a factor free of θ\theta”. In words, the posterior is proportional to the likelihood times the prior. We then try to recognise the right-hand side as the kernel of a known density, i.e. as the density with its normalising constant removed. The missing constant can then be read off from table A.2.

The posterior is the complete Bayesian answer. A statement like “ℙ⁢(θ>0.3|x)=0.95\mathbb{P}(\theta>0.3\mskip 1.0mu|\mskip 1.0mux)=0.95” now has a meaning.

28.2 Conjugate Priors

The rule (28.2) works best if the posterior distribution belongs to the same family of distributions as the prior distribution, so that the update only changes the parameters of the prior. These parameters are called hyperparameters.

Definition 28.3.

A family 𝒫︀\mathcal{P} of prior distributions is conjugate for a model with densities f⁢(x|θ)f(x\mskip 1.0mu|\mskip 1.0mu\theta), if for every prior in 𝒫︀\mathcal{P} and every data set xx the posterior π⁢(θ|x)\pi(\theta\mskip 1.0mu|\mskip 1.0mux) also belongs to 𝒫︀\mathcal{P}.

For exponential families, conjugate priors can be written down by inspection: the likelihood depends on the natural parameter η\eta only through the exponent η⁢Tn−n⁢K⁢(η)\eta T_{n}-nK(\eta) (lemma 7.5), and for a prior with an exponent of the same form the posterior has this form again.

Proposition 28.4.

Let f⁢(x|η)=h⁢(x)⁢exp⁡(η⁢T⁢(x)−K⁢(η))f(x\mskip 1.0mu|\mskip 1.0mu\eta)=h(x)\exp\bigl{(}\eta T(x)-K(\eta)\bigr{)} with η∈𝒩︀\eta\in\mathcal{N} be a one-parameter exponential family in its natural parametrisation, and for real numbers t0t_{0} and n0n_{0} let

πt0,n0⁢(η)∝exp⁡(t0⁢η−n0⁢K⁢(η))\pi_{t_{0},n_{0}}(\eta)\propto\exp\bigl{(}t_{0}\eta-n_{0}K(\eta)\bigr{)}

for all η∈𝒩︀\eta\in\mathcal{N}, whenever the right-hand side has a finite integral over 𝒩︀\mathcal{N}. Then these priors are conjugate for the model: if the prior is πt0,n0\pi_{t_{0},n_{0}}, the data x1,…,xnx_{1},\dots,x_{n} have natural statistic Tn=∑i=1nT⁢(xi)T_{n}=\sum_{i=1}^{n}T(x_{i}) and the marginal density satisfies 0<m⁢(x)<∞0<m(x)<\infty, then the posterior is πt0+Tn,n0+n\pi_{t_{0}+T_{n},\,n_{0}+n}.

Proof.

Using (28.2) and lemma 7.5 we find

π⁢(η|x)\displaystyle\pi(\eta\mskip 1.0mu|\mskip 1.0mux)
∝∏i=1nh⁢(xi)⁢exp⁡(η⁢Tn−n⁢K⁢(η))⁢exp⁡(t0⁢η−n0⁢K⁢(η))\displaystyle\propto\prod_{i=1}^{n}h(x_{i})\,\exp\bigl{(}\eta T_{n}-nK(\eta)% \bigr{)}\,\exp\bigl{(}t_{0}\eta-n_{0}K(\eta)\bigr{)}
∝exp⁡((t0+Tn)⁢η−(n0+n)⁢K⁢(η)),\displaystyle\propto\exp\bigl{(}(t_{0}+T_{n})\eta-(n_{0}+n)K(\eta)\bigr{)},

since ∏ih⁢(xi)\prod_{i}h(x_{i}) does not depend on η\eta. The right-hand side is the kernel of πt0+Tn,n0+n\pi_{t_{0}+T_{n},n_{0}+n}, which has a finite integral since m⁢(x)<∞m(x)<\infty. This completes the proof. ∎

The update adds the natural statistic to t0t_{0} and the sample size to n0n_{0}. We now compute the posterior for the Bernoulli model directly, in terms of the original parameter.

Example 28.5.

Let X1,…,XnX_{1},\dots,X_{n} be i.i.d. Bernoulli with success probability θ∈(0,1)\theta\in(0,1) and let the prior be the Beta⁢(a,b)\text{Beta}(a,b) distribution with a,b>0a,b>0. From table A.2 we know that this distribution has density

π⁢(θ)=θa−1⁢(1−θ)b−1B⁢(a,b)\pi(\theta)=\frac{\theta^{a-1}(1-\theta)^{b-1}}{B(a,b)}

for 0<θ<10<\theta<1, and mean a/(a+b)a/(a+b). If T=∑ixiT=\sum_{i}x_{i} is the number of successes in the sample, then the likelihood is f⁢(x|θ)=θT⁢(1−θ)n−Tf(x\mskip 1.0mu|\mskip 1.0mu\theta)=\theta^{T}(1-\theta)^{n-T}, as in example 5.3, and thus we have

π⁢(θ|x)∝θT⁢(1−θ)n−T⋅θa−1⁢(1−θ)b−1=θa+T−1⁢(1−θ)b+n−T−1.\pi(\theta\mskip 1.0mu|\mskip 1.0mux)\propto\theta^{T}(1-\theta)^{n-T}\cdot% \theta^{a-1}(1-\theta)^{b-1}=\theta^{a+T-1}(1-\theta)^{b+n-T-1}.

The right-hand side is the kernel of the Beta⁢(a+T,b+n−T)\text{Beta}(a+T,\,b+n-T) density, i.e. this density without its normalising constant 1/B⁢(a+T,b+n−T)1/B(a+T,\,b+n-T). Since the posterior integrates to one, it must have the same constant, and thus the posterior distribution is Beta⁢(a+T,b+n−T)\text{Beta}(a+T,\,b+n-T) with density

π⁢(θ|x)=θa+T−1⁢(1−θ)b+n−T−1B⁢(a+T,b+n−T)\pi(\theta\mskip 1.0mu|\mskip 1.0mux)=\frac{\theta^{a+T-1}(1-\theta)^{b+n-T-1}% }{B(a+T,\,b+n-T)}

for 0<θ<10<\theta<1. The Beta distributions are therefore conjugate for the Bernoulli model, and the update adds the successes to aa and the failures to bb. The posterior mean is given by

equation (28.3) (28.3)
𝔼⁢(θ|x)=a+Ta+b+n=a+ba+b+n⋅aa+b+na+b+n⋅x¯,\mathbb{E}(\theta\mskip 1.0mu|\mskip 1.0mux)=\frac{a+T}{a+b+n}=\frac{a+b}{a+b+% n}\cdot\frac{a}{a+b}+\frac{n}{a+b+n}\cdot\bar{x},

which is a weighted average of the prior mean a/(a+b)a/(a+b) and the sample proportion x¯=T/n\bar{x}=T/n, i.e. the maximum likelihood estimate from example 5.3. The weight of the prior mean tends to zero as n→∞n\to\infty.

The example is an instance of proposition 28.4. Changing variables to the log-odds η\eta of example 7.2, with the factor d⁢θ/d⁢η=θ⁢(1−θ)\mathrm{d}\theta/\mathrm{d}\eta=\theta(1-\theta) from proposition A.19, turns the Beta⁢(a,b)\text{Beta}(a,b) prior into πa,a+b\pi_{a,a+b}. Thus the prior acts like a+ba+b earlier observations, of which aa were successes. This equivalent sample size a+ba+b is a guide for choosing the hyperparameters in practice (exercise 28.1). For a=b=2a=b=2, n=10n=10 and T=7T=7 the posterior distribution is Beta⁢(9,5)\text{Beta}(9,5) with mean 9/14≈0.6439/14\approx 0.643, between the prior mean 0.50.5 and the sample proportion 0.70.7.

The same proposition shows that normal priors are conjugate for the normal mean with known variance: the cumulant function of this model is quadratic (exercise 7.5), and thus the priors πt0,n0\pi_{t_{0},n_{0}} with n0>0n_{0}>0 are normal densities. The following proposition gives the updated mean and variance. Its proof, which is based on completing the square, is exercise 28.3.

Proposition 28.6.

Let X1,…,XnX_{1},\dots,X_{n} be i.i.d. N⁢(θ,σ2)N(\theta,\sigma^{2}) with known variance σ2\sigma^{2} and let the prior be θ∼N⁢(μ0,τ2)\theta\sim N(\mu_{0},\tau^{2}). Then the posterior distribution is N⁢(μn,τn2)N(\mu_{n},\tau_{n}^{2}) where

1τn2=1τ2+nσ2andμn=1/τ21/τ2+n/σ2⁢μ0+n/σ21/τ2+n/σ2⁢x¯.\frac{1}{\tau_{n}^{2}}=\frac{1}{\tau^{2}}+\frac{n}{\sigma^{2}}\qquad\text{and}% \qquad\mu_{n}=\frac{1/\tau^{2}}{1/\tau^{2}+n/\sigma^{2}}\,\mu_{0}+\frac{n/% \sigma^{2}}{1/\tau^{2}+n/\sigma^{2}}\,\bar{x}.

The reciprocal of a variance is called a precision. The proposition shows that precisions add, and that the posterior mean is the average of μ0\mu_{0} and x¯\bar{x}, weighted by the prior precision 1/τ21/\tau^{2} and the precision n/σ2n/\sigma^{2} of X¯\bar{X}.

28.3 Point Estimates from the Posterior

If a single number is required for θ\theta, the posterior mean, median and mode can all be used. If the error of an estimate is measured by its square, as in lecture 2, the following lemma shows that the optimal choice is the posterior mean θ^B=𝔼⁢(θ|x)\hat{\theta}_{B}=\mathbb{E}(\theta\mskip 1.0mu|\mskip 1.0mux). This is called the Bayes estimator (under squared error) for θ\theta.

Lemma 28.7.

Assume that the posterior distribution has finite variance. Then the posterior mean θ^B=𝔼⁢(θ|x)\hat{\theta}_{B}=\mathbb{E}(\theta\mskip 1.0mu|\mskip 1.0mux) minimises the posterior expected squared error, i.e. for every number dd we have

𝔼⁢((θ−d)2|x)≥𝔼⁢((θ−θ^B)2|x)=Var(θ|x),\mathbb{E}\bigl{(}(\theta-d)^{2}\!\mathrel{\big{|}}\!x\bigr{)}\geq\mathbb{E}% \bigl{(}(\theta-\hat{\theta}_{B})^{2}\!\mathrel{\big{|}}\!x\bigr{)}=\mathop{% \mathrm{Var}}\nolimits(\theta\mskip 1.0mu|\mskip 1.0mux),

and the inequality is strict unless d=θ^Bd=\hat{\theta}_{B}.

Proof.

Adding and subtracting θ^B\hat{\theta}_{B} inside the square, as in the proof of lemma 2.7, we get

𝔼⁢((θ−d)2|x)=𝔼⁢((θ−θ^B)2|x)+2⁢(θ^B−d)⁢𝔼⁢(θ−θ^B|x)+(θ^B−d)2.\mathbb{E}\bigl{(}(\theta-d)^{2}\!\mathrel{\big{|}}\!x\bigr{)}=\mathbb{E}\bigl% {(}(\theta-\hat{\theta}_{B})^{2}\!\mathrel{\big{|}}\!x\bigr{)}+2(\hat{\theta}_% {B}-d)\,\mathbb{E}(\theta-\hat{\theta}_{B}\mskip 1.0mu|\mskip 1.0mux)+(\hat{% \theta}_{B}-d)^{2}.

The middle term vanishes, because 𝔼⁢(θ|x)=θ^B\mathbb{E}(\theta\mskip 1.0mu|\mskip 1.0mux)=\hat{\theta}_{B}, and the last term is non-negative and zero only for d=θ^Bd=\hat{\theta}_{B}. This completes the proof. ∎

The lemma is a statement about fixed data. For fixed θ\theta and varying data, the Bayes estimator from example 28.5 is biased but consistent (exercise 28.4).

28.4 Flat, Improper and Jeffreys Priors

If little is known about θ\theta before the data are seen, the obvious choice is the flat prior, which is constant on Θ\Theta. For the Bernoulli model this prior is Beta⁢(1,1)\text{Beta}(1,1) and from example 28.5 we know that the posterior mean is (T+1)/(n+2)(T+1)/(n+2), which is close to x¯\bar{x} but is shifted towards 1/21/2.

On an unbounded parameter space a constant function has infinite integral and thus is not a density. A prior with infinite integral is called improper. Improper priors are nevertheless used: if f⁢(x|θ)⁢π⁢(θ)f(x\mskip 1.0mu|\mskip 1.0mu\theta)\,\pi(\theta) has finite integral over Θ\Theta, this product is normalised and used as the formal posterior. The finiteness of the integral must be checked in each case (exercise 28.2). For the normal mean, the flat prior on ℝ\mathbb{R} leads to the proper posterior N⁢(x¯,σ2/n)N(\bar{x},\sigma^{2}/n), because the likelihood, as a function of θ\theta, is proportional to this density (exercise 28.3).

The flat prior has a more basic defect: flatness depends on the parametrisation. If θ\theta is uniform on (0,1)(0,1), then ψ=θ2\psi=\theta^{2} has density 1/(2⁢ψ)1/(2\sqrt{\psi}) by proposition A.19, and a prior which is meant to express no knowledge about θ\theta expresses some knowledge about θ2\theta^{2}. A rule which does not depend on the parametrisation can be built from the Fisher information, since proposition 11.9 shows how the information transforms.

Definition 28.8.

In the situation of section 11.1, the Jeffreys prior for θ\theta is given by

πJ⁢(θ)∝ℐ︀⁢(θ)\pi_{J}(\theta)\propto\sqrt{\mathcal{I}(\theta)}

for all θ∈Θ\theta\in\Theta, where ℐ︀⁢(θ)\mathcal{I}(\theta) is the Fisher information of an observation.

This prior is justified by the following invariance property, which the flat prior lacks.

Proposition 28.9.

Let ψ=g⁢(θ)\psi=g(\theta) where g:Θ→g⁢(Θ)g\colon\Theta\to g(\Theta) is a twice continuously differentiable bijection with g′⁢(θ)≠0g^{\prime}(\theta)\neq 0 for all θ\theta, and let ℐ︀θ\mathcal{I}_{\theta} and ℐ︀ψ\mathcal{I}_{\psi} be as in proposition 11.9. If θ\theta has the Jeffreys prior πθ⁢(θ)∝ℐ︀θ⁢(θ)\pi_{\theta}(\theta)\propto\sqrt{\mathcal{I}_{\theta}(\theta)}, then ψ\psi has the density πψ⁢(ψ)∝ℐ︀ψ⁢(ψ)\pi_{\psi}(\psi)\propto\sqrt{\mathcal{I}_{\psi}(\psi)}. This is the Jeffreys prior computed using the ψ\psi-parametrisation.

Proof.

Let h=g−1h=g^{-1}. If θ\theta has density πθ\pi_{\theta}, then the change-of-variable formula from proposition A.19 shows that ψ\psi has density πψ⁢(ψ)=πθ⁢(h⁢(ψ))⁢|h′⁢(ψ)|\pi_{\psi}(\psi)=\pi_{\theta}\bigl{(}h(\psi)\bigr{)}\,|h^{\prime}(\psi)|. For an improper prior there is no random variable to transform, and we take this formula as the definition of the transformed prior. Using proposition 11.9 and h′⁢(ψ)=1/g′⁢(θ)h^{\prime}(\psi)=1/g^{\prime}(\theta) for θ=h⁢(ψ)\theta=h(\psi) we get

πψ⁢(ψ)∝ℐ︀θ⁢(θ)⁢|h′⁢(ψ)|=ℐ︀θ⁢(θ)|g′⁢(θ)|=ℐ︀θ⁢(θ)g′⁢(θ)2=ℐ︀ψ⁢(ψ).\pi_{\psi}(\psi)\propto\sqrt{\mathcal{I}_{\theta}(\theta)}\,\bigl{|}h^{\prime}% (\psi)\bigr{|}=\frac{\sqrt{\mathcal{I}_{\theta}(\theta)}}{|g^{\prime}(\theta)|% }=\sqrt{\frac{\mathcal{I}_{\theta}(\theta)}{g^{\prime}(\theta)^{2}}}=\sqrt{% \mathcal{I}_{\psi}(\psi)}.

This completes the proof. ∎

Depending on the model, the Jeffreys prior can be proper or improper.

Example 28.10.

For the Bernoulli model, from example 11.5 we know ℐ︀⁢(θ)=1/(θ⁢(1−θ))\mathcal{I}(\theta)=1/\bigl{(}\theta(1-\theta)\bigr{)} and thus the Jeffreys prior is given by

πJ⁢(θ)∝θ−1/2⁢(1−θ)−1/2\pi_{J}(\theta)\propto\theta^{-1/2}(1-\theta)^{-1/2}

for 0<θ<10<\theta<1. This is the kernel of the Beta⁢(1/2,1/2)\text{Beta}(1/2,1/2) density. The Jeffreys prior is proper and has more weight near the boundaries of the interval than the flat prior does. From example 28.5 we know that the posterior distribution is Beta⁢(T+1/2,n−T+1/2)\text{Beta}(T+1/2,\,n-T+1/2) with mean (T+1/2)/(n+1)(T+1/2)/(n+1).

A location model has densities f⁢(x|θ)=f0⁢(x−θ)f(x\mskip 1.0mu|\mskip 1.0mu\theta)=f_{0}(x-\theta) with θ∈ℝ\theta\in\mathbb{R}, and a scale model has densities f⁢(x|σ)=f0⁢(x/σ)/σf(x\mskip 1.0mu|\mskip 1.0mu\sigma)=f_{0}(x/\sigma)/\sigma with σ>0\sigma>0, where f0f_{0} is a fixed density. Under the conditions of section 11.1, the Fisher information is constant in a location model and is c/σ2c/\sigma^{2} with a constant c>0c>0 in a scale model (exercise 28.5). Thus, whatever the density f0f_{0}, the Jeffreys prior is flat for a location parameter and is proportional to 1/σ1/\sigma for a scale parameter. Both priors are improper. For example, the normal mean with known variance is a location parameter, and the model N⁢(0,σ2)N(0,\sigma^{2}) is a scale model with ℐ︀⁢(σ)=2/σ2\mathcal{I}(\sigma)=2/\sigma^{2}.

Summary.
  • •
    ​

    The data can be used to update the prior density π⁢(θ)\pi(\theta) to the posterior π⁢(θ|x)∝f⁢(x|θ)⁢π⁢(θ)\pi(\theta\mskip 1.0mu|\mskip 1.0mux)\propto f(x\mskip 1.0mu|\mskip 1.0mu% \theta)\,\pi(\theta). The normalising constant can be found by recognising the kernel of a known density.

  • •
    ​

    A family of priors is conjugate for a model if the posterior always belongs to the same family. For a one-parameter exponential family in its natural parametrisation, the priors proportional to exp⁡(t0⁢η−n0⁢K⁢(η))\exp(t_{0}\eta-n_{0}K(\eta)) are conjugate. Beta priors are conjugate for the Bernoulli model, and normal priors are conjugate for the normal mean with known variance.

  • •
    ​

    For the Beta-Bernoulli and normal-normal pairs, the posterior mean is a weighted average of the prior mean and the maximum likelihood estimate. As nn increases, the prior weight decreases. The posterior mean is the Bayes estimator for θ\theta under squared error.

  • •
    ​

    A flat prior is not invariant under reparametrisation, but the Jeffreys prior πJ⁢(θ)∝ℐ︀⁢(θ)\pi_{J}(\theta)\propto\sqrt{\mathcal{I}(\theta)} is. The Jeffreys prior is Beta⁢(1/2,1/2)\text{Beta}(1/2,1/2) for the Bernoulli model, is flat for a location parameter, and is proportional to 1/σ1/\sigma for a scale parameter. An improper prior can only be used if the posterior is proper.

Exercise 28.1.

A Bernoulli model is to be fitted with a Beta⁢(a,b)\text{Beta}(a,b) prior for the success probability θ\theta.

  1. 1.
    ​

    Find aa and bb such that the prior mean is 0.30.3 and the equivalent sample size a+ba+b is 1010. Use the variance in table A.2 to find the prior standard deviation.

  2. 2.
    ​

    Find aa and bb such that the prior has mean 0.30.3 and standard deviation 0.10.1. What is the equivalent sample size for this prior?

  3. 3.
    ​

    For the prior in the first part of the question, a sample of size n=20n=20 has T=9T=9 successes. Determine the posterior distribution and the posterior mean. Write the posterior mean as a weighted average of the prior mean and x¯\bar{x}.

Exercise 28.2.

The Haldane prior for the Bernoulli success probability is the limit a,b→0a,b\to 0 of the kernel θa−1⁢(1−θ)b−1\theta^{a-1}(1-\theta)^{b-1}, i.e. the function π⁢(θ)∝θ−1⁢(1−θ)−1\pi(\theta)\propto\theta^{-1}(1-\theta)^{-1} for 0<θ<10<\theta<1.

  1. 1.
    ​

    Show that this prior is improper.

  2. 2.
    ​

    Show that the formal posterior π⁢(θ|x)∝θT−1⁢(1−θ)n−T−1\pi(\theta\mskip 1.0mu|\mskip 1.0mux)\propto\theta^{T-1}(1-\theta)^{n-T-1} is a proper distribution if and only if 0<T<n0<T<n. Identify the resulting distribution.

  3. 3.
    ​

    For 0<T<n0<T<n, determine the posterior mean and compare it to the maximum likelihood estimate.

  4. 4.
    ​

    Describe what happens for T=0T=0.

Exercise 28.3.

Using the following steps, prove proposition 28.6.

  1. 1.
    ​

    Show that the likelihood, as a function of θ\theta, satisfies f⁢(x|θ)∝exp⁡(−n⁢(θ−x¯)2/(2⁢σ2))f(x\mskip 1.0mu|\mskip 1.0mu\theta)\propto\exp\bigl{(}-n(\theta-\bar{x})^{2}/(% 2\sigma^{2})\bigr{)}.

  2. 2.
    ​

    Multiply the prior density by this function and show, by completing the square in θ\theta, that

    π⁢(θ|x)∝exp⁡(−(θ−μn)22⁢τn2)\pi(\theta\mskip 1.0mu|\mskip 1.0mux)\propto\exp\Bigl{(}-\frac{(\theta-\mu_{n}% )^{2}}{2\tau_{n}^{2}}\Bigr{)}

    where μn\mu_{n} and τn2\tau_{n}^{2} are as in the proposition.

  3. 3.
    ​

    What happens to μn\mu_{n} and τn2\tau_{n}^{2} when τ→∞\tau\to\infty with nn fixed? And when n→∞n\to\infty with τ\tau fixed?

Exercise 28.4.

Let X1,…,XnX_{1},\dots,X_{n} be i.i.d. Bernoulli with success probability θ\theta and let θ^B=(a+T)/(a+b+n)\hat{\theta}_{B}=(a+T)/(a+b+n) with T=∑iXiT=\sum_{i}X_{i} be the Bayes estimator from example 28.5. Now fix θ\theta and regard θ^B\hat{\theta}_{B} as an estimator in the sense of lecture 2.

  1. 1.
    ​

    What are the bias and variance of θ^B\hat{\theta}_{B}? Show that the estimator is biased for every θ≠a/(a+b)\theta\neq a/(a+b), but consistent.

  2. 2.
    ​

    For a=b=1a=b=1 and n=10n=10, compare the mean squared errors MSE(θ^B)\mathop{\mathrm{MSE}}\nolimits(\hat{\theta}_{B}) and MSE(X¯)\mathop{\mathrm{MSE}}\nolimits(\bar{X}) for θ=1/2\theta=1/2 and θ=0.1\theta=0.1.

Exercise 28.5.

Let f0f_{0} be a fixed density such that the following models satisfy the conditions of section 11.1, and let ℓ0⁢(z)=log⁡f0⁢(z)\ell_{0}(z)=\log f_{0}(z).

  1. 1.
    ​

    For the location model f⁢(x|θ)=f0⁢(x−θ)f(x\mskip 1.0mu|\mskip 1.0mu\theta)=f_{0}(x-\theta), show that the score is −ℓ0′⁢(x−θ)-\ell_{0}^{\prime}(x-\theta) and thus that the Fisher information does not depend on θ\theta.

  2. 2.
    ​

    For the scale model f⁢(x|σ)=f0⁢(x/σ)/σf(x\mskip 1.0mu|\mskip 1.0mu\sigma)=f_{0}(x/\sigma)/\sigma and z=x/σz=x/\sigma, show that the score is −(1+z⁢ℓ0′⁢(z))/σ-\bigl{(}1+z\ell_{0}^{\prime}(z)\bigr{)}/\sigma and that ℐ︀⁢(σ)=c/σ2\mathcal{I}(\sigma)=c/\sigma^{2} where cc does not depend on σ\sigma.

  3. 3.
    ​

    For the N⁢(0,σ2)N(0,\sigma^{2}) model with parameter σ\sigma, show that ℐ︀⁢(σ)=2/σ2\mathcal{I}(\sigma)=2/\sigma^{2}.