17.4. Beta Densities with Integer Parameters#
In the previous section we learned how to work with joint densities, but many of the joint density functions seemed to appear out of nowhere. For example, we checked that the function
is a joint density, but there was no clue where it came from. In this section we will find its origin and go on to develop an important family of densities on the unit interval.
17.4.1. Order Statistics of IID Uniform Variables#
Let

Based on the graph above, can you tell which star corresponds to
What you can see, however, is the list of
These are called the order statistics of
Remember that because the

In general for
See More
17.4.2. Joint Density of Two Order Statistics#
Let
The graph below shows the event

To find
one of
must be inone must be in
one must be in
one must be in
one must be in
You can think of each of the five independent uniform
The chances are given by
where
Apply the multinomial formula to get
and therefore the joint density of
This solves the mystery of how the formula arises.
But it also does much more. The marginal densities of the order statistics of i.i.d. uniform
Quick Check
Answer
17.4.3. The Density of #
Let
The graph below displays the event
One of the variables
has to be in .Of the remaining
variables, must have values in and the rest in .

Apply the multinomial formula again.
Therefore the density of
For consistency, let’s rewrite the exponents slightly so that each ends with
Because
17.4.4. Beta Densities#
We have shown that if
is a probability density function. This is called the beta density with parameters
By the derivation above, the
The shape of the density is determined by the two factors that involve
Notice that the uniform
The graph below shows some beta density curves. As you would expect, the beta
x = np.arange(0, 1.01, 0.01)
for i in np.arange(1, 7, 1):
plt.plot(x, stats.beta.pdf(x, i, 6-i), lw=2)
plt.title('Beta $(i, 6-i)$ densities for $1 \leq i \leq 5$');

By choosing the parameters appropriately, you can create beta densities that put much of their mass near a prescribed value. That is one of the reasons beta densities are used to model random proportions. For example, if you think that the probability that an email is spam is most likely in the 60% to 90% range, but might be lower, you might model your belief by choosing the density that peaks at around 0.75 in the graph above.
The calculation below shows you how to get started on the process of picking parameters so that the beta density with those parameters has properties that reflect your beliefs.
17.4.5. The Beta Integral#
The beta density integrates to 1, and hence for all positive integers
Thus probability theory makes short work of an otherwise laborious integral. Also, we can now find the expectation of a random variable with a beta density.
Let
You can follow the same method to find
The formula for the expectation allows you to pick parameters corresponding to your belief about the random proportion being modeled by
You will have noticed that the form of the beta density looks rather like the binomial formula. Indeed, we used the binomial formula to derive the beta density. Later in the course you will see another close relation between the beta and the binomial. These properties make the beta family one of the most widely used families of densities in machine learning.