21.2. The Beta-Binomial Distribution
As in the previous section, let have the beta prior, and given let the be the number of heads in the first tosses of a -coin.
All the calculations we carried out in the previous section were under the condition that , but we never needed to find the probability of this event. It was part of the constant that made the posterior density of integrate to 1.
We can now find by writing the posterior density in two ways:
Now equate constants:
21.2.1. Beta-Binomial Probabilities
So for in the range 0 through ,
where is the constant in the beta density, given by
That’s not as awful as it looks. A better way to think of the formula is
This discrete distribution is called the beta-binomial distribution with parameters , , and . It is the distribution of the number of heads in tosses of a coin that lands heads with a probability picked according to the beta distribution.
One pair is particularly interesting: . That’s the case when has the uniform prior. The distribution of reduces to
There’s no in the answer! The conclusion is that if you choose uniformly between 0 and 1 and toss a -coin times, the distribution of the number of heads is uniform on .
If you choose uniformly between 0 and 1, then for the conditional distribution of given that was the selected value is binomial . But the unconditional distribution of is uniform.
21.2.2. Checking by Integration
If you prefer, you can find the distribution of directly, by conditioning on .
21.2.3. Expectation
Given , the conditional distribution of is binomial . Therefore
or, equivalently,
By iteration,
The expected proportion of heads in tosses is
which is the expectation of the prior distribution of .
In the next section we will examine the long run behavior of this random proportion.
21.2.4. Endnote
The unconditional probability appeared in the denominator of our calculation of the posterior density of given . Because of the simplifications that result from using conjugate priors, we were able to calculate the denominator in a couple of different ways. But often the calculation can be intractable, especially in high dimensional settings. Methods of dealing with this problem are covered in more advanced courses.