# Bayesian analysis Symmetric 90% and 95% confidence intervals for a random variable `p` (where `p` is the probability of an event) are given. If a subjective probability `p_0` an effective number...

Bayesian analysis

Symmetric 90% and 95% confidence intervals for a random variable `p` (where `p` is the probability of an event) are given. If a subjective probability `p_0` an effective number of observations `n_0` upon which it is based are also given, how does one revise the subjective probability in the light of the data? (Assume a conjugate prior distribution)

Posted on

The confidence intervals given will be of the form

`hat(p) pm z_(1-alpha/2)sqrt((hat(p)(1-hat(p)))/n)`

where `z_(1-alpha/2)` is the 100(alpha/2)th percentile of the standard Normal distribution. For symmetric 90% intervals` ` `alpha = 0.1` and for symmetric 95% intervals `alpha = 0.05` so that the corresponding percentiles would be

`z(0.95) = 1.64 ` ,  `z(0.975) = 1.96`

The center of the interval will give you `hat(p)`` ` and the distance between the center and each end will give you `z_(1-alpha/2)sqrt((hat(p)(1-hat(p)))/n)` . Knowing `z_(1-alpha/2)` and an estimate of `p`, `hat(p)`, one can then obtain `n`.

The 'subjective' probability defines what the prior distribution for the probability `p` (a random variable in the Bayesian paradigm) is. If that distribution is assumed to be a Beta distribution (so that it is a 'conjugate prior') then it will be of the form Beta(`alpha`,`beta`) where `alpha-1` is the number of hypothetical successes and `beta -1` the hypothetical number of failures. If the subjective 'expected' probability is `p_0` and is worth `n_0` hypothetical observations (a larger `n_0` implies a stronger belief in `p_0`) then

`alpha + beta - 2 = n_0`  and `alpha - 1 = n_0p_0`

Therefore `alpha = (n_0p_0) + 1`  and `beta = n_0 + 2 - (n_0p_0) - 1`

`= n_0(1-p_0) + 1`

To update this prior in the light of the data add the number of successes to `alpha` and the number of failures to `beta`. The number of successes is `nhat(p)` (`n` and `hat(p)` obtained earlier from the confidence intervals) and the number of failures `n(1-hat(p))`. So the posterior distribution after updating the prior in the light of the data is Beta(`alpha',beta'`) where

`alpha' = alpha + nhat(p) = (n_0p_0) + 1 + nhat(p) `

`beta' = beta + n(1-hat(p)) = n_0(1-p_0) + 1 + n(1-hat(p))`

Answer: update the Beta prior in the light of the (binary) data to give a Beta posterior