Normal distribution is obviously very close to all of our hearts, it’s widely used and has unprecedented power.
However, lurking in the shadows of normal distribution is the under-utilized, potential-filled binomial distribution. The most common example of this distribution is the classic coin example:
“If we flip a fair coin with a fixed probability, and we flip the same coin n times, what is the probability of getting a certain number of heads?”
In other words, if we flip a coin n number of times, the probability (p) of it landing on head or tails (x) follows a binomial distribution. The Probability Mass Function or pmf is a function of n trials with p probability of successes in those trials:
According to statistical topics covered by Yale University, binomial distribution should specifically be used to “summarize a group of independent observations by the number of observations in the group that represent one of two outcomes.” The single coin flip is an ideal example of an experiment with a binary outcome, however, the outcomes of the experiment don’t necessarily need to be equally likely in order for the experiment to be considered a “binomial.” For instance, an unfair coin is also an example of binomial distribution.
Let’s dive into some python code that runs the simulation of flipping a fair coin 20 times in 5000 trials. For this example, the following are our variables:
- n = 20
- p = 0.5; for a fair coin
- trials = 5000; repeat this experiment for this number of times
After 5000 trials, each tossing the coin 20 times, we were able to plot the histogram below. Look! A binomial distribution! How cool is it that the world works in patterns :)
To double check our results, I also defined a function that would plot the discrete pmf for given n trials (in our situation 20). Based on the plot below, we can see that the binomial distribution is the perfect model to simulate a coin toss. So in the future, we know that it’s unnecessary to sit there tossing a coin 5000 times …..cause I know we all have better things to do.
Conclusive remarks:
- Clearly, probability distributions do an incredible job of modelling real-life scenarios.
- Specifically in regards to binomial distribution examples, all we need are n and p values to accurately model the outcomes. No need to sit there manually running 1000’s of trials!
- Unlock the power of binomial distribution, normal distribution may be convenient but it’s time we harnessed the untapped potential that comes along with binomial distribution as well.