Get startedGet started for free

Probability distributions and stories: The Binomial distribution

1. Probability distributions and stories: The Binomial distribution

In the last video, we simulated a story about a person flipping a coin. We did this to get the probability for each possible outcome of the story. That set of probabilities is called

2. Probability mass function (PMF)

a probability mass function, or PMF. A PMF is defined as the set of probabilities of discrete outcomes. To understand how this works, consider a simpler story

3. Discrete Uniform PMF

of a person rolling a die once. The outcomes are discrete because only certain values may be attained; you cannot roll a 3-point-7 with a die. Each result has the same, or uniform, probability of one-sixth. For this reason, the PMF associated with this story is called the Discrete Uniform PMF. Now the PMF is a property of a discrete probability distribution.

4. Probability distribution

A distribution is just a mathematical description of outcomes.

5. Discrete Uniform distribution: the story

We can match a story to a distribution, as we have just seen with the Discrete Uniform distribution. The story we simulated in the last video corresponds to the Binomial distribution. Its story is as follows:

6. Binomial distribution: the story

The number r of successes in n Bernoulli trials, each with probability p of success, is Binomially distributed. The number of heads in four coin flips matches this story, since a coin flip is a Bernoulli trial with p = 0-point-5.

7. Sampling from the Binomial distribution

Assuming we have instantiated a random generator as rng, as we will through the rest of this course, we call the function rng-dot-binomial with two arguments, the number of Bernoulli trials (coin flips) and the probability of success (heads). We get 2 heads out of four. We want to repeat the four-flip experiment over and over again. Again, we can specify the size keyword argument, which tells the function how many random numbers to sample out of the Binomial distribution.

8. The Binomial PMF

To be able to plot the Binomial PMF, we'll draw 10,000 samples from a Binomial distribution where we do 60 Bernoulli trials with a probability of success of 0-point-1. If we do this over and over and tally the results, we can plot the PMF. As expected the most likely number of successes is 6 out of 60, but we may expect to get as many as 11 or as few as 1. Unfortunately, while this is a proper way to display a PMF, it is not the easiest to implement with Matplotlib. You'll plot a PMF as a histogram in the exercises.

9. The Binomial CDF

The CDF is just as informative and easier to plot just as we have done before,

10. The Binomial CDF

and here it is. Now that you know the story of the Binomial distribution, have a feel for how it looks, and know how to sample out of it,

11. Let's practice!

let's do some hacker statistics with it!

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.