Lecture 29 Credible Intervals and Bayesian Testing

Lecture 28 introduced the posterior distribution as the complete Bayesian answer. In this lecture we answer the interval question of lecture 26 and the testing question of lectures 22 to 25 in posterior terms, and then set the two approaches side by side on the mean of a normal sample; lecture 30 shows a comparison of this kind in R.

We use the two conjugate pairs from lecture 28. The first is the Beta posterior for the Bernoulli model from example 28.5. The second is the normal posterior from proposition 28.6: for a sample X1,…,XnX_{1},\dots,X_{n} from the normal distribution N⁢(θ,σ2)N(\theta,\sigma^{2}) with known variance and prior θ∼N⁢(μ0,τ2)\theta\sim N(\mu_{0},\tau^{2}), the posterior distribution is N⁢(μn,τn2)N(\mu_{n},\tau_{n}^{2}) with

equation (29.1) (29.1)
1τn2=1τ2+nσ2andμn=τn2⁢(μ0τ2+n⁢x¯σ2).\frac{1}{\tau_{n}^{2}}=\frac{1}{\tau^{2}}+\frac{n}{\sigma^{2}}\qquad\text{and}% \qquad\mu_{n}=\tau_{n}^{2}\Bigl{(}\frac{\mu_{0}}{\tau^{2}}+\frac{n\bar{x}}{% \sigma^{2}}\Bigr{)}.

We consider the data set from example 26.3: n=16n=16 observations with σ=2\sigma=2 and x¯=10.3\bar{x}=10.3. Assume that before the data were collected we expected the mean to be around 1212 and we chose the prior N⁢(12,1)N(12,1). Then the posterior precision is 1/1+16/4=51/1+16/4=5 and the posterior mean is μn=0.2⋅(12+4⋅10.3)=10.64\mu_{n}=0.2\cdot(12+4\cdot 10.3)=10.64, i.e. the posterior distribution is N⁢(10.64,0.2)N(10.64,0.2).

29.1 Credible Intervals

A confidence interval, as given in definition 26.1, is a random interval which covers the fixed parameter with a given probability. In contrast, in a Bayesian model the data are fixed after observation, the parameter is random and an interval estimate is a set which contains most of the posterior probability.

Definition 29.1.

Let π⁢(θ|x)\pi(\theta\mskip 1.0mu|\mskip 1.0mux) be the posterior density of θ\theta given the data xx and let α∈(0,1)\alpha\in(0,1). An interval [l,u][l,u] is a credible interval for θ\theta with credibility 1−α1-\alpha, if

ℙ⁢(l≤θ≤u|x)=∫luπ⁢(ϑ|x)⁢dϑ=1−α.\mathbb{P}(l\leq\theta\leq u\mskip 1.0mu|\mskip 1.0mux)=\int_{l}^{u}\pi(% \vartheta\mskip 1.0mu|\mskip 1.0mux)\,\mathrm{d}\vartheta=1-\alpha.

The equal-tailed credible interval is the interval [qα/2,q1−α/2][q_{\alpha/2},q_{1-\alpha/2}], between the α/2\alpha/2- and (1−α/2)(1-\alpha/2)-quantiles of the posterior distribution.

The probability in the definition is a probability about θ\theta, for the given data set: the sentence “θ\theta is in [l,u][l,u] with probability 0.950.95” (which we had to forbid in lecture 26) is the statement that a 95%95\% credible interval makes. The trade-off is that this probability depends on the prior distribution.

Any interval with posterior probability 1−α1-\alpha is a credible interval. The equal-tailed interval is the usual choice, because the endpoints of this interval are quantiles. The alternative is to find the shortest set with this probability.

Definition 29.2.

A highest posterior density (HPD) set with credibility 1−α1-\alpha is the set

Hc={θ∈Θ|π⁢(θ|x)≥c},H_{c}=\bigl{\{}\,\theta\in\Theta\mathrel{\big{|}}\pi(\theta\mskip 1.0mu|\mskip 1% .0mux)\geq c\,\bigr{\}},

where c>0c>0 is chosen such that ℙ⁢(θ∈Hc|x)=1−α\mathbb{P}(\theta\in H_{c}\mskip 1.0mu|\mskip 1.0mux)=1-\alpha.

The set HcH_{c} is the shortest set with posterior probability 1−α1-\alpha, since replacing part of it by a region where the density is below cc requires more length for the same probability. For a unimodal posterior distribution, HcH_{c} is an interval, called the HPD interval. If the density is continuous, it takes the value cc at each endpoint which is not on the boundary of Θ\Theta. For a symmetric, unimodal posterior distribution, the HPD interval is the equal-tailed interval (exercise 29.1).

Example 29.3.

If the posterior distribution is equal to the normal distribution N⁢(μn,τn2)N(\mu_{n},\tau_{n}^{2}), then the density is symmetric around μn\mu_{n} and decreases as it gets further away from this point. Thus, the HPD interval is the equal-tailed interval

equation (29.2) (29.2)
[μn−z1−α/2⁢τn,μn+z1−α/2⁢τn].\bigl{[}\,\mu_{n}-z_{1-\alpha/2}\,\tau_{n},\ \mu_{n}+z_{1-\alpha/2}\,\tau_{n}% \,\bigr{]}.

For our data set and the prior N⁢(12,1)N(12,1) we have τn=0.2=0.447\tau_{n}=\sqrt{0.2}=0.447, and the 95%95\% credible interval is 10.64±1.96⋅0.44710.64\pm 1.96\cdot 0.447, i.e. the interval [9.76,11.52][9.76,11.52]. The credible interval is shifted towards the prior mean and is shorter than the 95%95\% confidence interval [9.32,11.28][9.32,11.28] from example 26.3, because the prior provides additional information. In the case of the flat prior from section 28.4, the posterior distribution is N⁢(x¯,σ2/n)N(\bar{x},\sigma^{2}/n) and the credible interval (29.2) coincides with the confidence interval x¯±z1−α/2⁢σ/n\bar{x}\pm z_{1-\alpha/2}\,\sigma/\sqrt{n}. The reason for this coincidence is explained in section 29.3.

For a skewed posterior the HPD interval is shifted towards the mode and is slightly shorter than the equal-tailed interval. Exercise 29.2 compares the two intervals for the posterior Beta⁢(9,5)\text{Beta}(9,5) from example 28.5.

29.2 Bayesian Testing

In the Bayesian model a hypothesis H0:θ∈Θ0H_{0}\colon\theta\in\Theta_{0}, in the sense of definition 22.1, is an event concerning the random variable θ\theta and thus has a probability before and after the data are seen. Testing does not require new theory.

Definition 29.4.

Let H0:θ∈Θ0H_{0}\colon\theta\in\Theta_{0} and H1:θ∈Θ1H_{1}\colon\theta\in\Theta_{1} be hypotheses with positive prior probability. Then the posterior probability of H0H_{0} is given by

ℙ⁢(H0|x)=ℙ⁢(θ∈Θ0|x)=∫Θ0π⁢(ϑ|x)⁢dϑ.\mathbb{P}(H_{0}\mskip 1.0mu|\mskip 1.0mux)=\mathbb{P}(\theta\in\Theta_{0}% \mskip 1.0mu|\mskip 1.0mux)=\int_{\Theta_{0}}\pi(\vartheta\mskip 1.0mu|\mskip 1% .0mux)\,\mathrm{d}\vartheta.

Similarly, we can find the posterior probability of H1H_{1}. A Bayesian test rejects H0H_{0} if ℙ⁢(H0|x)\mathbb{P}(H_{0}\mskip 1.0mu|\mskip 1.0mux) falls below a given threshold. If both hypotheses are treated equally, the test instead chooses the hypothesis with the higher posterior probability.

The threshold plays the role of the level α\alpha of definition 22.6, but the two numbers are not comparable: α\alpha bounds the probability of a type I error over repeated samples, whereas the threshold bounds the posterior probability that a rejection is wrong, for the data in hand. Any asymmetry between the hypotheses can be expressed by the prior.

Example 29.5.

For our data set we test H0:θ≤10H_{0}\colon\theta\leq 10 against H1:θ>10H_{1}\colon\theta>10. With the prior N⁢(12,1)N(12,1) the posterior distribution is N⁢(10.64,0.2)N(10.64,0.2), and thus we have

ℙ⁢(H0|x)=ℙ⁢(θ≤10|x)=Φ⁢(10−10.640.447)=Φ⁢(−1.43)=0.076,\mathbb{P}(H_{0}\mskip 1.0mu|\mskip 1.0mux)=\mathbb{P}(\theta\leq 10\mskip 1.0% mu|\mskip 1.0mux)=\Phi\Bigl{(}\frac{10-10.64}{0.447}\Bigr{)}=\Phi(-1.43)=0.076,

and consequently ℙ⁢(H1|x)=0.924\mathbb{P}(H_{1}\mskip 1.0mu|\mskip 1.0mux)=0.924. A symmetric decision between the hypotheses favours H1H_{1}, but the rule with threshold 0.050.05 does not reject H0H_{0}. For the flat prior the hypotheses have no prior probabilities, but the formal posterior N⁢(10.3,0.25)N(10.3,0.25) still gives

ℙ⁢(H0|x)=Φ⁢(−0.6)=0.274.\mathbb{P}(H_{0}\mskip 1.0mu|\mskip 1.0mux)=\Phi(-0.6)=0.274.

Here the evidence against H0H_{0} is much weaker than for the prior N⁢(12,1)N(12,1): this prior, which has only 2.3%2.3\% of its mass below 1010, contributed substantially to the result above.

The same approach can be used for a hypothesis about a proportion. For the posterior Beta⁢(9,5)\text{Beta}(9,5) in example 28.5, the posterior probability of H0:θ≤1/2H_{0}\colon\theta\leq 1/2 is the value of the Beta distribution function at 1/21/2. To find this value by hand, we approximate the posterior by the normal distribution with the same mean and variance. From table A.2 we find the mean 9/14=0.6439/14=0.643 and the variance 9⋅5/(142⋅15)=0.01539\cdot 5/(14^{2}\cdot 15)=0.0153, so that the standard deviation is 0.1240.124. This gives

ℙ⁢(H0|x)≈Φ⁢(0.5−0.6430.124)=Φ⁢(−1.15)=0.125,\mathbb{P}(H_{0}\mskip 1.0mu|\mskip 1.0mux)\approx\Phi\Bigl{(}\frac{0.5-0.643}% {0.124}\Bigr{)}=\Phi(-1.15)=0.125,

which is close to the exact value 0.1330.133. Exercise 29.3 shows a case where the integral can be computed exactly.

A simple hypothesis θ=θ0\theta=\theta_{0} has probability zero under every prior with a density, and thus for two simple hypotheses the prior must be a two-point distribution. The posterior is then a two-point distribution as well.

Definition 29.6.

Let H0:θ=θ0H_{0}\colon\theta=\theta_{0} and H1:θ=θ1H_{1}\colon\theta=\theta_{1} be simple hypotheses and let the prior have probability p0p_{0} for θ0\theta_{0} and p1=1−p0p_{1}=1-p_{0} for θ1\theta_{1}. Then the prior odds of H0H_{0} against H1H_{1} are p0/p1p_{0}/p_{1} and the posterior odds are ℙ⁢(H0|x)/ℙ⁢(H1|x)\mathbb{P}(H_{0}\mskip 1.0mu|\mskip 1.0mux)/\mathbb{P}(H_{1}\mskip 1.0mu|% \mskip 1.0mux).

By Bayes’ theorem (proposition A.20) we have

ℙ⁢(Hj|x)=pj⁢f⁢(x|θj)m⁢(x)for j=0,1,\mathbb{P}(H_{j}\mskip 1.0mu|\mskip 1.0mux)=\frac{p_{j}\,f(x\mskip 1.0mu|% \mskip 1.0mu\theta_{j})}{m(x)}\qquad\text{for $j=0,1$,}

where m⁢(x)=p0⁢f⁢(x|θ0)+p1⁢f⁢(x|θ1)m(x)=p_{0}\,f(x\mskip 1.0mu|\mskip 1.0mu\theta_{0})+p_{1}\,f(x\mskip 1.0mu|% \mskip 1.0mu\theta_{1}). When we divide the two expressions, the term m⁢(x)m(x) cancels and we find

equation (29.3) (29.3)
ℙ⁢(H0|x)ℙ⁢(H1|x)=p0p1⋅f⁢(x|θ0)f⁢(x|θ1),\frac{\mathbb{P}(H_{0}\mskip 1.0mu|\mskip 1.0mux)}{\mathbb{P}(H_{1}\mskip 1.0% mu|\mskip 1.0mux)}=\frac{p_{0}}{p_{1}}\cdot\frac{f(x\mskip 1.0mu|\mskip 1.0mu% \theta_{0})}{f(x\mskip 1.0mu|\mskip 1.0mu\theta_{1})},

i.e. the posterior odds are the prior odds times the likelihood ratio. In this context, the likelihood ratio is also called the Bayes factor in favour of H0H_{0}. This is the inverse of the ratio considered in the Neyman–Pearson lemma, theorem 23.2. From the posterior odds rr we can derive the posterior probabilities as ℙ⁢(H0|x)=r/(1+r)\mathbb{P}(H_{0}\mskip 1.0mu|\mskip 1.0mux)=r/(1+r).

Example 29.7.

We use our data set again, this time to test H0:θ=10H_{0}\colon\theta=10 against H1:θ=11H_{1}\colon\theta=11. Since the likelihood of a normal sample satisfies f⁢(x|θ)∝exp⁡(−n⁢(x¯−θ)2/(2⁢σ2))f(x\mskip 1.0mu|\mskip 1.0mu\theta)\propto\exp\bigl{(}-n(\bar{x}-\theta)^{2}/(% 2\sigma^{2})\bigr{)} by exercise 28.3, the Bayes factor is

f⁢(x|θ0)f⁢(x|θ1)=exp⁡(n2⁢σ2⁢((x¯−θ1)2−(x¯−θ0)2))=exp⁡(n⁢(θ1−θ0)⁢(θ0+θ1−2⁢x¯)2⁢σ2).\frac{f(x\mskip 1.0mu|\mskip 1.0mu\theta_{0})}{f(x\mskip 1.0mu|\mskip 1.0mu% \theta_{1})}=\exp\Bigl{(}\frac{n}{2\sigma^{2}}\bigl{(}(\bar{x}-\theta_{1})^{2}% -(\bar{x}-\theta_{0})^{2}\bigr{)}\Bigr{)}=\exp\Bigl{(}\frac{n(\theta_{1}-% \theta_{0})(\theta_{0}+\theta_{1}-2\bar{x})}{2\sigma^{2}}\Bigr{)}.

Here we have n=16n=16, σ=2\sigma=2 and x¯=10.3\bar{x}=10.3, so that the exponent is 16⋅1⋅0.4/8=0.816\cdot 1\cdot 0.4/8=0.8 and the Bayes factor is e0.8=2.23e^{0.8}=2.23. Since x¯\bar{x} is closer to 1010 than to 1111, the data favour H0H_{0} by a factor of approximately two. If the prior odds are 11, the posterior odds are 2.232.23 and ℙ⁢(H0|x)=2.23/3.23=0.69\mathbb{P}(H_{0}\mskip 1.0mu|\mskip 1.0mux)=2.23/3.23=0.69. Exercise 29.4 treats a case where the prior odds are different from 11.

29.3 Comparing Frequentist and Bayesian Answers

Now we have two different sets of answers, for the same data, for the normal mean. We conclude by comparing the two sets.

The first difference is in the nature of the statements. A 95%95\% confidence interval is a statement about a procedure: it says that for repeated samples, the interval covers the fixed truth in 95%95\% of cases. A 95%95\% credible interval is a statement about the parameter, given the data and the prior. Similarly, a pp-value is computed assuming H0H_{0} is true, whereas ℙ⁢(H0|x)\mathbb{P}(H_{0}\mskip 1.0mu|\mskip 1.0mux) is the probability of the hypothesis given the data.

The second observation is that for the normal mean with known variance and a flat prior, the numerical answers coincide. Example 29.3 shows the two intervals coinciding, and the tests coincide as well: for H0:θ≤θ0H_{0}\colon\theta\leq\theta_{0} the flat-prior posterior probability Φ⁢(n⁢(θ0−x¯)/σ)\Phi\bigl{(}\sqrt{n}\,(\theta_{0}-\bar{x})/\sigma\bigr{)} equals, by the symmetry of Φ\Phi, the pp-value 1−Φ⁢(n⁢(x¯−θ0)/σ)1-\Phi\bigl{(}\sqrt{n}\,(\bar{x}-\theta_{0})/\sigma\bigr{)} of the one-sided zz-test from example 22.7. As for the size in lecture 22, the supremum in definition 22.9 for the composite null hypothesis θ≤θ0\theta\leq\theta_{0} is attained at θ0\theta_{0}. For our data set both values equal 0.2740.274.

The answers coincide because, as a function of θ\theta, the flat-prior posterior density has the same shape as the density of X¯\bar{X} as a function of x¯\bar{x}. This is the reason why the misreadings in lectures 22 and 26 were so tempting: each of the two forbidden sentences, about the pp-value and about the confidence interval, is a true sentence about the flat-prior posterior for the simplest model.

The coincidence only holds for special models and priors. An informative prior, i.e. a proper prior which expresses knowledge about θ\theta, moves the Bayesian answer towards the prior mean and makes the interval shorter, as in the case of N⁢(12,1)N(12,1) above. If θ\theta is close to the prior mean, this is an advantage, but if θ\theta is far from the prior mean, the interval is moved away from the true value. The frequentist guarantee from definition 26.1 holds for all θ\theta. A credible interval has no such guarantee: exercise 29.5 shows that its frequentist coverage can be far below 95%95\% when θ\theta is far from the prior mean.

As the sample size increases, the influence of the prior decreases. For the normal mean, equation (29.1) shows that the weight of the prior mean in μn\mu_{n} goes to zero and that n⁢τn2/σ2→1n\tau_{n}^{2}/\sigma^{2}\to 1 as n→∞n\to\infty, so that for large nn the posterior is approximately N⁢(x¯,σ2/n)N(\bar{x},\sigma^{2}/n), the posterior for the flat prior. The same effect holds for all regular models. The general version of this result, the Bernstein–von Mises theorem, is the Bayesian analogue of theorem 17.1: under the regularity conditions from definition 16.1, and for any prior density which is continuous and positive at the true value, the posterior distribution is approximately

equation (29.4) (29.4)
N⁢(θ^n,1ℐ︀n⁢(θ^n))for large ⁢n,N\Bigl{(}\hat{\theta}_{n},\ \frac{1}{\mathcal{I}_{n}(\hat{\theta}_{n})}\Bigr{)% }\qquad\text{for large }n,

where θ^n\hat{\theta}_{n} is the maximum likelihood estimator. We state this result without proof. The idea is that the log-posterior is ℓ⁢(θ)+log⁡π⁢(θ)\ell(\theta)+\log\pi(\theta) up to a constant, and that the log-likelihood grows like nn while log⁡π⁢(θ)\log\pi(\theta) does not. From (29.4) we know that the equal-tailed credible interval is approximately the Wald interval θ^n±z1−α/2⁢se(θ^n)\hat{\theta}_{n}\pm z_{1-\alpha/2}\,\mathop{\mathrm{se}}\nolimits(\hat{\theta}% _{n}) of proposition 26.8, independently of the prior: for large sample size both approaches give approximately the same interval, with frequentist coverage approximately 1−α1-\alpha.

Summary.
  • •
    ​

    A credible interval with credibility 1−α1-\alpha has posterior probability 1−α1-\alpha: this is a probability statement about θ\theta for the given data, taking the prior into account. The equal-tailed interval is based on posterior quantiles, the HPD interval is the shortest one, and for symmetric, unimodal posteriors both intervals coincide.

  • •
    ​

    For the normal mean with known variance and normal prior, the 1−α1-\alpha credible interval is μn±z1−α/2⁢τn\mu_{n}\pm z_{1-\alpha/2}\,\tau_{n}; for the flat prior this interval coincides with the confidence interval x¯±z1−α/2⁢σ/n\bar{x}\pm z_{1-\alpha/2}\,\sigma/\sqrt{n}.

  • •
    ​

    A Bayesian test compares posterior probabilities of the hypotheses, or rejects H0H_{0} if ℙ⁢(H0|x)\mathbb{P}(H_{0}\mskip 1.0mu|\mskip 1.0mux) falls below a threshold. For two simple hypotheses, the posterior odds are the prior odds times the likelihood ratio, known as the Bayes factor.

  • •
    ​

    The level of a test and the confidence level of an interval are statements about the procedure applied to repeated samples, whereas the credibility of an interval is a statement about the parameter given one data set. For the normal mean with known variance and flat prior, the intervals, and the one-sided test and pp-value, agree numerically while the statements do not have the same meaning.

  • •
    ​

    An informative prior shifts the Bayesian answer towards the prior mean and shortens the interval. For large nn the posterior is approximately N⁢(θ^n,1/ℐ︀n⁢(θ^n))N\bigl{(}\hat{\theta}_{n},1/\mathcal{I}_{n}(\hat{\theta}_{n})\bigr{)} and the credible and Wald intervals approximately coincide.

Exercise 29.1.

Let the posterior density π⁢(θ|x)\pi(\theta\mskip 1.0mu|\mskip 1.0mux) be continuous, strictly increasing on (−∞,μ](-\infty,\mu] and strictly decreasing on [μ,∞)[\mu,\infty).

  1. 1.
    ​

    Show that the HPD set HcH_{c} from definition 29.2 is an interval [l,u][l,u] with l<μ<ul<\mu<u and π⁢(l|x)=π⁢(u|x)\pi(l\mskip 1.0mu|\mskip 1.0mux)=\pi(u\mskip 1.0mu|\mskip 1.0mux).

  2. 2.
    ​

    Assume that the density is symmetric about μ\mu, i.e. that π⁢(μ+t|x)=π⁢(μ−t|x)\pi(\mu+t\mskip 1.0mu|\mskip 1.0mux)=\pi(\mu-t\mskip 1.0mu|\mskip 1.0mux) for all tt. Show that the HPD interval with credibility 1−α1-\alpha coincides with the equal-tailed interval [qα/2,q1−α/2][q_{\alpha/2},q_{1-\alpha/2}].

  3. 3.
    ​

    Now assume that the posterior density is continuous and strictly decreasing on [0,∞)[0,\infty) and zero elsewhere. Show that the HPD set with credibility 1−α1-\alpha is the one-sided interval [0,q1−α][0,q_{1-\alpha}] and that this interval is shorter than the equal-tailed interval.

Exercise 29.2.

In example 28.5, a Bernoulli sample with n=10n=10 and T=7T=7 successes was combined with the prior Beta⁢(2,2)\text{Beta}(2,2) to obtain the posterior distribution Beta⁢(9,5)\text{Beta}(9,5) with mean 9/14=0.6439/14=0.643. The quantiles of a Beta distribution have to be found numerically. The 0.0250.025- and 0.9750.975-quantiles of Beta⁢(9,5)\text{Beta}(9,5) are 0.3860.386 and 0.8610.861.

  1. 1.
    ​

    Write down the equal-tailed 95%95\% credible interval for θ\theta and compare the mid-point of this interval to the posterior mean.

  2. 2.
    ​

    Show that the posterior density has its maximum at θ=2/3\theta=2/3, so that the mode of the posterior distribution is above the mean.

  3. 3.
    ​

    The HPD interval for Beta⁢(9,5)\text{Beta}(9,5), found numerically, is [0.401,0.874][0.401,0.874]. Using definition 29.2, explain why this interval is shifted towards the mode, compared to the equal-tailed interval. Also explain why the difference between the two intervals decreases as nn increases.

Exercise 29.3.

Assume that we have observed two successes in three Bernoulli trials with success probability θ\theta, and the prior distribution of θ\theta is flat on the interval (0,1)(0,1).

  1. 1.
    ​

    Determine the posterior distribution of θ\theta.

  2. 2.
    ​

    Calculate the posterior probability of H0:θ≤1/2H_{0}\colon\theta\leq 1/2 by integrating the posterior density. Also, calculate the posterior odds of H0H_{0} against H1:θ>1/2H_{1}\colon\theta>1/2.

  3. 3.
    ​

    The prior odds of H0H_{0} against H1H_{1} were 11. By what factor have the data changed these odds?

  4. 4.
    ​

    Write down the equations for the boundaries of the 95%95\% equal-tailed credible interval and explain why these equations are best solved numerically.

Exercise 29.4.

In the situation of example 22.7, a sample of size n=25n=25 from N⁢(θ,4)N(\theta,4) has mean x¯=10.9\bar{x}=10.9. We want to compare the simple hypotheses H0:θ=10H_{0}\colon\theta=10 and H1:θ=11H_{1}\colon\theta=11.

  1. 1.
    ​

    Compute the Bayes factor in favour of H0H_{0}.

  2. 2.
    ​

    Before the data were available, H0H_{0} was three times as likely as H1H_{1}. Compute the posterior odds and the posterior probability of H0H_{0}.

  3. 3.
    ​

    The one-sided zz-test from lecture 22 gives the pp-value 0.01220.0122 for these data. Compare this pp-value with your posterior probability of H0H_{0} and explain why the two numbers can differ so much, although both count against H0H_{0}.

  4. 4.
    ​

    What value must the prior odds in favour of H0H_{0} have for the posterior probability of H0H_{0} to be greater than one half?

Exercise 29.5.

Let X1,…,XnX_{1},\dots,X_{n} be i.i.d. with N⁢(θ,σ2)N(\theta,\sigma^{2}) where σ2\sigma^{2} is known, and let the prior be N⁢(μ0,τ2)N(\mu_{0},\tau^{2}). Let w=(1/τ2)/(1/τ2+n/σ2)w=(1/\tau^{2})/(1/\tau^{2}+n/\sigma^{2}) be the weight of the prior mean in μn\mu_{n}. Consider the credible interval (29.2) to be a random interval, as introduced in lecture 26, where θ\theta is fixed and the data are random.

  1. 1.
    ​

    Show that τn2=(1−w)⁢σ2/n\tau_{n}^{2}=(1-w)\sigma^{2}/n and that under ℙθ\mathbb{P}_{\theta} the posterior mean satisfies μn−θ∼N⁢(w⁢(μ0−θ),(1−w)2⁢σ2/n)\mu_{n}-\theta\sim N\bigl{(}w(\mu_{0}-\theta),\,(1-w)^{2}\sigma^{2}/n\bigr{)}.

  2. 2.
    ​

    Determine the coverage probability ℙθ⁢(μn−z1−α/2⁢τn≤θ≤μn+z1−α/2⁢τn)\mathbb{P}_{\theta}\bigl{(}\mu_{n}-z_{1-\alpha/2}\tau_{n}\leq\theta\leq\mu_{n}% +z_{1-\alpha/2}\tau_{n}\bigr{)} as a function of θ\theta.

  3. 3.
    ​

    For n=16n=16, σ=2\sigma=2, τ=1\tau=1, μ0=12\mu_{0}=12 and α=0.05\alpha=0.05, determine the coverage probability for θ=12\theta=12 and for θ=10\theta=10 and discuss the result as |θ−μ0|→∞|\theta-\mu_{0}|\to\infty.

  4. 4.
    ​

    Is the credible interval a confidence interval with level 0.950.95 in the sense of definition 26.1? What happens to the coverage probability as n→∞n\to\infty with θ\theta fixed?