2024-06-09

What is a binomial distribution?

The binomial distribution for a sample count X is the number of successes with parameters sample size/number of instances (n) and probability of success for any one instance (p). Denoted as B(n, p) of X.

This distribution is used when there is a fixed sample size, all of the instances in the sample are independent of each other, the probability of success is the same for each instance, and each instance can be classified as a success or failure.

Mean and Standard Deviation of Binomial Distributions

A count X with B(n, p) has the following mean (\(\mu\)) and standard deviation (\(\sigma\)):

\[ \mu_X = np \] \[ \sigma_X = \sqrt{np(1-p)} \]

Binomial Coefficient and Binomial Probability

Binomial coefficients are the total number of possible arrangements of number of successes (k) in the sample size (n) and are used to find the binomial probability of a distribution.

Binomial Coefficient Formula:

\[\binom{n}{k} = \frac{n!}{k!(n-k)!}\]

Binomial Probability Formula:

\[P(X=k) = \binom{n}{k}p^k(1-p)^{n-k}\]

Binomial Coefficients and Probability in R

A common problem for binomial distributions involves finding the probability of k number of heads or tails in n number of tosses of a fair coin. For example, if we want to find the probability of 3 tails in 5 tosses we can use the dbinom() function in R to find the answer using the syntax dbinom(k,n,p).

p = dbinom(3, 5, .5)
print(paste0
      ("The probability of getting tails 3 times out of 5 tosses of a fair coin is ", p))
## [1] "The probability of getting tails 3 times out of 5 tosses of a fair coin is 0.3125"

If we wanted to find the probability of at least 3 tails in 5 coin tosses, we can use the cumulative binomial distribution function pbinom with the syntax pbinom(k,n,p).

x = pbinom(3, 5, .5)
print(paste0
      ("The probability of getting tails at least 3 times out of 5 tosses of a fair coin is ", x))
## [1] "The probability of getting tails at least 3 times out of 5 tosses of a fair coin is 0.8125"

Examples of Binomial Distribution Graphs

One of the best ways to display data involving binomial distributions is with a histogram. This histogram shows the distribution of a fair six sided die landing on an even number in 3 rolls.

Examples Cont’d

As the sample size grows, the closer to Normal the data becomes. Here’s what the distribution looks like in 20 rolls instead of 3.

Cumulative Binomial Probability Graph

We can easily visualize the cumulative probability distribution in a line graph. Below is the graph for rolling at least a 15 in 8 rolls of a fair 20 sided die.

Conclusion

Binomial distributions, coefficients, and probabilities are important tools for any statistician and have many practical applications. Hopefully this presentation has helped you get familiar with the concept and provided the confidence to move forward in your own calculations. Thank you for your time!