In the study of discrete probability distributions, the Binomial Distribution is the most widely used model for counting successes. It describes the behavior of a random variable that represents the number of “successes” in a sequence of independent experiments.
A Binomial experiment consists of repeated Bernoulli trials. A Bernoulli trial is a random experiment with exactly two possible outcomes: “Success” (S) and “Failure” (F).
For a random variable \(X\) to follow a Binomial distribution, it must satisfy these four conditions:
If a random variable \(X\) follows a Binomial distribution with \(n\) trials and probability \(p\), we denote it as: \[X \sim B(n, p)\]
The probability of achieving exactly \(k\) successes is:
\[P(X = k) = \binom{n}{k} p^k (1-p)^{n-k}\]
Where: * \(n\): Total number of trials. * \(k\): Number of successes (\(0, 1, \dots, n\)). * \(p\): Probability of success. * \(\binom{n}{k} = \frac{n!}{k!(n-k)!}\) (The Binomial Coefficient).
The shape of the distribution changes based on the probability \(p\).
A factory produces components with a 5% defect rate (\(p=0.05\)). In a random batch of 10 components, what is the probability that exactly 2 are defective?
Solution: \(n=10, k=2, p=0.05\)
## [1] 0.0746348
dbinom(k, n, p): Probability of exactly \(k\) successes (\(P(X=k)\)).pbinom(k, n, p): Cumulative probability of \(k\) or fewer successes (\(P(X \le k)\)).rbinom(m, n, p): Generates \(m\) random values from a Binomial
distribution.A student takes a 10-question multiple-choice quiz. Each question has 5 options, and only one is correct. The student guesses randomly on every question. 1. What is the probability of getting exactly 4 correct? 2. What is the probability of passing (getting 6 or more correct)?
A server has a 99% uptime probability on any given day. Over a 30-day month: 1. What is the expected number of days the server is up? 2. What is the probability that the server stays up for all 30 days?
| Feature | Formula / Value |
|---|---|
| Parameters | \(n\) (trials), \(p\) (prob of success) |
| Support | \(k \in \{0, 1, \dots, n\}\) |
| Mean | \(np\) |
| Variance | \(np(1-p)\) |
| R Function (Exact) | dbinom() |
| R Function (Cumulative) | pbinom() |
### How to fix your R environment (Optional)
If you still want to use `ggplot2` in the future, you should fix the `ffi_list2` error by running this in your R console:
```r
install.packages("rlang", type = "binary")
install.packages("ggplot2", type = "binary")
Then restart RStudio before knitting again. However, the Base R version I provided above will work immediately without needing these fixes.