## Point Estimates

Posterior medians require the computer, except when the posterior distribution is symmetric (in which case the median is the center of symmetry).

Here is the example from the slides. The data are Binomial(`n`,
`p`) and the prior distribution for
`p` is Beta(α_{1}, α_{2})

## Posterior PDF

When you have a computer, there is no point in not plotting the whole posterior PDF. For the same example above

## Interval Estimates

### Equal Tails

The most obvious Bayesian competitor of frequentist confidence intervals is the interval between the α ⁄ 2 and 1 − α ⁄ 2 quantiles of the posterior distribution of the parameter of interest. This makes a 100 (1 − α) % credible interval for the parameter of interest.

Again, the data are Binomial(`n`,
`p`) and the prior distribution for
`p` is Beta(α_{1}, α_{2})

The shaded area under the curve has posterior probability
`conf.level`

. The unshaded areas on either side
have posterior probability α ⁄ 2.

With the data, hyperparameter, and confidence level given in the form before editing, the unshaded area to the left is too small to be seen

Rweb:> qbeta(0.025, 0 + 1 / 2, 10 - 0 + 1 / 2) [1] 4.789043e-05But it is there.

### Highest Posterior Density

The next most obvious Bayesian competitor of frequentist confidence intervals is the level set of the posterior PDF of the parameter of interest that has probability 1 − α. This makes a 100 (1 − α) % credible interval for the parameter of interest.

Again, the data are Binomial(`n`,
`p`) and the prior distribution for
`p` is Beta(α_{1}, α_{2})

The shaded area under the curve has posterior probability
`conf.level`

.

Unlike the equal tailed interval, the HPD region automatically switches from two-sided to one-sided as appropriate.

With the data, hyperparameter, and confidence level given in the form before editing, the HPD is one-sided, going all the way to zero.

### Two Intervals Compared

Same as in the two preceding sections except we put both intervals on one plot.

## Hypothesis Tests

### One Sample, One Tailed

The most obvious Bayesian competitor of frequentist `P`-values
is the Bayes factor comparing the hypotheses.

The hypotheses (models) are

`H`

_{0}=

`m`

_{1}:

`p`≥

`p`

_{0}

`H`

_{1}=

`m`

_{2}:

`p`<

`p`

_{0}

Again, the data are Binomial(`n`, `p`).
The prior distribution for
`p` is Beta(α_{1}, α_{2})
conditioned on whichever hypothesis we are doing.

### One Sample, Two Tailed

The hypotheses (models) are

`H`

_{0}=

`m`

_{1}:

`p`=

`p`

_{0}

`H`

_{1}=

`m`

_{2}:

`p`≠

`p`

_{0}

Again, the data are Binomial(`n`, `p`).
The prior distribution for `m`_{1} is concentrated
at the point `p`_{0}.
The prior distribution for `m`_{2} is
`p` is Beta(α_{1}, α_{2}).

### Two Sample, Two Tailed

Now the data are`x`

_{i},

`i`= 1, 2, where the

`x`

_{i}are independent and

`x`

_{i}is Binomial(

`n`

_{i},

`p`

_{i}).

The hypotheses (models) are

`H`

_{0}=

`m`

_{1}:

`p`

_{1}=

`p`

_{2}

`H`

_{1}=

`m`

_{2}:

`p`

_{1}≠

`p`

_{2}

The prior distribution for `m`_{1} forces
`p`_{1} = `p`_{2} = `p`,
in which case the distribution of
`x`_{1} + `x`_{2}
is Binomial(`n`_{1} +
`n`_{2}, `p`).
For model `m`_{2} we consider
`p`_{1} and `p`_{2} a priori independent,
and we use the same Beta(α_{1}, α_{2})
for both parameters. In model `m`_{1} we use the
prior Beta(α_{3}, α_{4})
for the only parameter.

### Two Sample, One Tailed

Now the data are`x`

_{i},

`i`= 1, 2, where the

`x`

_{i}are independent and

`x`

_{i}is Binomial(

`n`

_{i},

`p`

_{i}).

The hypotheses (models) are

`H`

_{0}=

`m`

_{1}:

`p`

_{1}≥

`p`

_{2}

`H`

_{1}=

`m`

_{2}:

`p`

_{1}<

`p`

_{2}

We use the same prior distribution
Beta(α_{1}, α_{2})
for both parameters.