The world’s leading publication for data science, AI, and ML professionals.

Bernoulli and Binomial Distributions Explained

Discussing two other common forms of distributions

Image Source
Image Source

Often in data science, we focus and obsess over obtaining the holy grail of distributions – the normal distribution. However, two other types of distributions, the Bernoulli and binomial , have many real world applications and must be clearly understood when the data science community encounters them. In this post, I will discuss the differences between the two and provide simple, real examples of their occurrence in our data-driven world.

Bernoulli Distribution

Also called the binary distribution, this is the kind of distribution that is present when flipping a coin. Personally, I much prefer referring to this as the binary distribution because of that prefix, bi. What this means is that for whatever your experiment or event may be, there are only two possible outcomes – Heads or tails, success or failure, 0 or 1, etc.

If you were to model the Bernoulli Distribution in the form of a coin flip, we could assign 0 to represent heads and 1 to represent tails. Assuming that it is a fair coin being flipped, this means that the probability of obtaining heads or tails for one flip would be 50% each. One important thing to note is that this kind of distribution doesn’t have to be 50/50. For example, if you can conclude that kicking an extra point in football has a 75% success rate, and you represent 1 as a successful try, then the probability of 1 would be 75% and the probability of 0 would be 25%, assuming there are no other external factors being considered (which, let’s face it, is not very realistic.)

Lastly, the most important thing to note about a binary distribution is that it is only for the consideration of one event (one coin flip, one extra point kick, etc.). If you are interested in discovering the probability of obtaining a certain amount of results given a certain amount of events, that will lead you right into the next type of distribution, which is a binomial distribution.

Binomial Distributions

Essentially, a Binomial Distribution is a collection, n, of independent Bernoulli events. One super important thing to remember is that an event being independent means that the results of the next event are not affected by the results of the previous event. Going back to the extra point example, if a kicker misses the try, that try can be considered independent because that previous result will not affect the results of the next kick they may attempt – the probability of success is still 75%. If sports isn’t your thing or you have absolutely no clue what I’m referring to, then another example would be that if you flip a coin and land on heads, that result will have no effect on the result of the next flip.

Now, it’s math time. Going forward with the football example, we have two parameters that are involved for a binomial distribution – p, which is the probability of success and n, which is the number of events. We also have a third variable, Y, which is more of a designation than anything else. Now, how would we calculate the different probabilities given that there are two kicking events?

First, let’s recognize and understand that given 2 consecutive kicking events there are 3 possible outcomes:

  • P(Y=0) = both kicks miss
  • P(Y=1) = 1 kick is good, 1 kick is missed (remember, order does not matter)
  • P(Y=2) = both kicks are good

Well, calculating P(Y=0) and P(Y=2) are both pretty easy. Since they both involve the same event occurring two times in a row, you simply multiply their probabilities together. So,:

  • P(Y=0) = 0.25*0.25 = 0.0625 = 6.25%
  • P(Y=2) = 0.75*0.75 = 0.5625 = 56.25%

So, this means the Probability of the kicker missing two consecutive kicks is about 6.25%, while the likelihood of them making two consecutive kicks is 56.25%.

Now, calculating P(Y=1) is where it can get tricky. We want to calculate the probability of 1 kick being made and 1 kick being missed in consecutive attempts, with order not being a factor and both events remaining independent of each other. This means that the calculation would look like this:

  • P(Y=1) = (0.750.25) + (0.250.75) = 0.375 = 37.5%

Another way the above formula can be written is 2(0.750.25). Either way the probability of the above events (2 consecutive kicks, 1 make, 1 miss, order irrelevant, and both events being independent) is 37.5%.

One final cool thing about these distributions is that if you add the 3 probabilities together – 6.25% + 37.5% + 56.25% – you will get 100%! This means that given the situation of events, you have correctly calculated all forms of probability based on all possible results.

After reading this article, I’ll bet you’ll start noticing Bernoulli and binomial distributions more frequently in your daily lives. Yay, math! I hope this helped you learn a thing or two and thank you for reading!

LinkedIn


Related Articles