The negative binomial distribution is used to calculate the probability that there are ‘x’ failures preceding the rth success in ‘x+r’ Bernoulli trials.
Let X be a random variable following the negative binomial distribution with parameters ‘r’ and ‘p’. The probability distribution function is given by the formula,
P(X=x) = x+r-1Cr-1 pr (1-p)x where x = 0, 1, 2,….
We can use the above formula to calculate probabilities for the random variable.
Notice that if we put r=1 in the above formula, we get the pdf of the geometric distribution. Thus the negative binomial distribution is a generalization of the geometric distribution.
Example:
Suppose that a coin is tossed some number of times. Calculate the probability that we throw the coin 10 times in order to obtain 4 heads.
Solution: Let X denote the number of times that we get tails (failure) in order to get heads (success) 4 times. Then X is a negative binomial random variable with the parameters given as,
p = 0.5 = probability of getting heads (success)
r = 4 = the number of heads (successes) out of the total number of trials.
Then we can calculate the required probability using the above formula.
P(X=6) = 6+4-1C4-1 (0.5)4 (0.5)6 = 0.082.
Properties:
The expected value/mean of the negative binomial distribution is given as,
E(X) = r(1-p)/p.
The variance of the negative binomial distribution is given as,
V(X) = r(1-p)/p2.