Binomial Distribution With Python

March 20, 2018

1 min read

Binomial Distribution With Python

The binomial distribution is the distribution of the number of successes in a sequence of n repeated Bernoulli trials. Repeated Bernoulli trials mean that all trials are independent and each result have two possible outcomes. Random variable X represents the number of successes in n trials. Now we can construct the formula.

probability of getting x successes
probability of getting x successes

If you follow the series up to this point you can mention that this formula was explained in the “Repetitive experiments” part.

Let’s take a look at the classic example. Imagine that you tossing coin 20 times. What the probability that you will have exactly 6 tails?

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
view raw pt_12_1.ipynb hosted with ❤ by GitHub

As you can see from chart probability that you have 6 tails is equal to the probability that you will have 6 heads. This is because you have mirroring probabilities.

Let’s take a look at the characteristics of the binomial distribution. The mean and the variance:

characteristics