Exercise

# Compare with classical methods

Agresti and Coull's classical interval method is available in your workspace as `classical_binom_ci()`

and takes the arguments `y`

, `n`

and the confidence level `conf.level`

.

For our example where 16 out of 20 students are concerned about being overweight, you can compute a 90% classical interval:

```
classical_binom_ci(16, 20, .90)
```

To compare between Bayesian and classical methods, suppose we assign `P`

a uniform density (i.e. a \(beta(1, 1)\) curve).

Now you can construct a 90% Bayesian probability interval for `P`

and compare this interval with the Agresti-Coull interval.

Instructions

**100 XP**

- Define the number of successes
`y`

and the sample size`n`

. - Use the
`classical_binom_ci()`

function to find a 90% confidence interval for`P`

. - Define the vector of prior beta shape parameters
`ab`

if we are assigning a uniform prior for`P`

. - Find the vector beta shape parameters
`ab_new`

for the posterior curve. - Using the
`qbeta()`

function, construct a 90% Bayesian probability interval and compare with the classical interval you found in the second instruction.