Stats Refresher - Bernoulli and Binomial Distributions
Bernoulli Random Variable
Let us take an example of a coin toss. A coin toss has only two possible outcomes. The result can be either a head or a tail. A coin toss is an example of a Bernoulli random variable. Coin toss of a fair or unbiased coin can be considered as a Bernoulli random variable where the probability of both the outcomes is 50% each.
If we define the event of getting a head as success, the probability of getting a success in the case of a fair coin is 50% or 0.5.
And the probability of getting a failure is 1-0.5 = 0.5
Bernoulli Distribution
If we try to mathematically formulate or summarize a Bernoulli random variable, here are the things you can keep in mind.
Bernoulli random variable has only two outcomes - a success and a failure.
Probability of success is usually represented by a notation p
Probability of failure in the case of a Bernoulli distribution hence is 1-p
For eg:In the case of a biased coin, if success is defined as the occurrence of head and if the probability of getting a head is 0.6, then the below can be used to describe the Bernoulli random variable.
p = probability of success = probability of getting a head = 0.6
Probability of getting a tail = 1-p = 0.4
Note: Even the roll of a die can be considered as a Bernoulli Random Variable. Let us take this as a second example of a Bernoulli Random variable.
Let us say, the occurence of the number 1 is considered as a success and any other outcome is considered as a failure. Then this particular experiment can be expressed using a Bernoulli Random Variable as below:
Success → obtaining a 1 while rolling a die
Failure → obtaining any other number other than 1
P = probability of success = probability of getting a 1 in the roll of a die = 1/6
P = probability of failure = 1 - ⅙ = ⅚
Binomial Distribution
Let us try to understand Binomial Distribution with an example again. Consider an example of multiple coin tosses, say tossing a coin 5 times. Let it be represented by the random variable X. It is a series of repeated Bernoulli trials. Here X is said to follow a binomial distribution.
If we consider a biased or unbiased coin with probability p as the probability of getting a head, then, we can calculate the probability of getting k successes using the formula:
$$P(X=k) = \binom{n}{k}*p^k*(1-p)^{n-k}$$
This is also called the probability mass function of a binomial distribution.
A typical problem on binomial distribution.
Consider 10 coin tosses assuming the coin is fair. What is the probability of getting exactly 2 heads?
$$n = 10 $$
$$k = 2 $$
$$p = 0.5 $$
$$P(X=2) = \binom{n}{k}(0.5)^20.5^{8} $$
$$\therefore P(X = 2) = 0.0439$$
Summary - Tips to remember Bernoulli and Binomial distributions:
When we think of a Bernoulli Random Variable, we should think of just two outcomes. A success and a failure. The probability of success in the case of Bernoulli Random Variable is often denoted using “p” and hence failure can be computed as (1-p).
When we think of Binomial Random Variable, we should visualise a series of repeated Bernoulli trials, like a multiple coin tosses. The pmf of a Bernoulli Distribution helps us compute the probability of the number of successes, given the number of trials and the probability of success.
More to come.. :)