How to simulate coin flips using binomial distribution in Python
The binomial distribution is one of the most popular distributions in statistics . In probability theory and statistics, the binomial distribution with parameters n and p is the discrete probability distribution of the number of successes in a sequence of n independent experiments. Each experiment asks a yes-no question and has its own boolean valued outcome. Success is probability of p and failure is a probability of q=1-p. The binomial distribution is the basis of the binomial test of statistical significance.
An example of the binomial distribution can be seen below:-
If a random variable X follows a binomial distribution the probability of X = k can be found using the following formula:-
In this post I intend to demonstrate how to simulate flips of a coin using Python’s functions relating specifically to the binomial distribution. I have written the Python code in Google Colab, which is a free online Jupyter Notebook hosted by Google.