Negative Binomial

A negative binomial experiment is a statistical experiment that has the following properties:

  • The experiment consists of nn repeated trials.

  • The trials are independent.

  • The outcome of each trial is either success (ss) or failure (ff).

  • P(s)P(s) is the same for every trial.

  • The experiment continues until xx successes are observed.

If XX is the number of experiments until the xthx^{th} success occurs, then XX is a discrete random variable called a negative binomial.

Consider the following probability mass function:

b(x,n,p)=(n1x1)pxq(nx)b \cdot (x, n, p) = \binom{n-1}{x-1} \cdot p^x \cdot q^{(n-x)}

The function above is negative binomial and has the following properties:

  • The number of successes to be observed is xx.

  • The total number of trials is nn.

  • The probability of success of 11 trial is pp.

  • The probability of failure of 11 trial , where q=1pq=1-p.

  • is the negative binomial probability, meaning the probability of having x1x-1 successes after n1n-1 trials and having xx successes after nn trials.

Note: Recall that (nx)=n!x!(nx)!\binom{n}{x}=\frac{n!}{x!(n-x)!}. For further review, see the Combinations and Permutations Tutorial.

The geometric distribution is a special case of the negative binomial distribution that deals with the number of Bernoulli trials required to get a success (i.e., counting the number of failures before the first success). Recall that XX is the number of successes in independent Bernoulli trials, so for each ii (where 1in1\leq i \leq n):

Xi={1,if the ith trail is a success0,otherwise X_i = \begin{cases} 1, & \text{if the } i^{th}\text{ trail is a success} \\ 0, & \text{otherwise } \end{cases}

The geometric distribution is a negative binomial distribution where the number of successes is 11. We express this with the following formula:

g(n,p)=q(n1)pg(n, p) = q^{(n-1)} \cdot p

Example

Bob is a high school basketball player. He is a 70%70\% free throw shooter, meaning his probability of making a free throw is 0.700.70. What is the probability that Bob makes his first free throw on his fifth shot?

For this experiment, n=5n=5, p=0.7p=0.7 and q=0.3q=0.3. So, g(n=5,p=0.7)=0.340.7=0.00567\newline g(n=5, p=0.7) = 0.3^4 0.7 = 0.00567

# The probability that a machine produces a defective product 
# is 1/3. What is the probability that the 1st defect is found 
# during the 5th inspection?
#
# Answer 0.066
print(round((((1-ratio)**4)*ratio), 3))

# What is the probability that the 1st defect is found during 
# the first 5th inspections?
def geo_dist(i, r):
    return ((1-r)**i)*r

r = 1/3
t = 5
print(round(sum([geo_dist(i, r) for i in range(0, t)]), 3))

Last updated