NEGATIVE BINOMIAL DISTRIBUTION
DEFINITION
Negative binomial distribution is a discrete distribution under which the random variable measures the number of trials required for '$$k$$' number of successes to occur. It is just the generalization of the Geometric distribution that measures the number of trials required for the first success. The Negative Binomial distribution can therefore be considered as the sum of '$$k$$' Geometric distributions.
There is another type of this distribution, under which the random variable measures the number of failures before ‘$$k$$’ number of successes occur.

CALCULATOR

#### Enter the following details:

Number of successes required:

Number of the trial on which successes are required:

Probability of success:

Probability that trails are required forsuccesses:

Probability that or less trails are required forsuccesses:

Probability that more than trails are required for successes:

Mean of the specified negative binomial distribution:

variance of the specified negative binomial distribution:

Probability distribution
 x p(X=x) P(X ≤ x)
FORMULA AND DERIVATION
Type 1 negative binomial distribution

Probability distribution:-

Consider $$x$$ number of Independent and Identically Distributed (IID) Bernoulli trials. Each trial can lead to either a success or a failure. We need $$k$$ number of successes in $$x$$ number of trials, such that the $$k^{th}$$ success occurs on trial number $$x$$.
If the$$k^{th}$$ success occurs on trial $$x$$, then the other $$k-1$$ successes can occur in any order in the previous $$x-1$$ trials. So, the total number of ways in which this can happen is $${}^{x-1}{C_{k-1}}$$. This combination represents the number of ways in which $$k-1$$ successes can occur in $$x-1$$ trials. If each success occurs with probability $$p$$, then the total probability of $$k$$ successes is $$p^k$$. If each failure occurs with probability $$q$$, then the total probability of failures is $$q^{x-k}$$ (since $$k$$ trials are successes, the remaining $$x-k$$ trials are failures).

Therefore the probability that the $$k^{th}$$ success will occur on trial $$x$$ can be written as follows:-
$p\left(X=x\right)=\ \left(\genfrac{}{}{0pt}{}{x-1}{k-1}\right)p^kq^{x-k} \ for \ x=k,\ k+1,\ k+2\dots$
$$\left(\genfrac{}{}{0pt}{}{x-1}{k-1}\right)$$ is the same as $${}^{x-1}{C_{k-1}}$$.

It is important to note that the random variable $$X$$ can take values beginning from $$x=k$$ . This is because, for $$k$$ successes to occur, a minimum of $$k$$ trials must be performed. Therefore, $$x$$ can be equal to or more than $$k$$.

Mean:-

Since the negative binomial distribution is the sum of $$k$$ geometric distributions, the negative binomial mean is $$k$$ times the geometric mean.

Therefore,
$E\left(X\right)=\ \mu =k\ \times \ \frac{1}{p}$ $\mu =\ \frac{k}{p}$
Variance:-

The variance of the negative binomial distribution is $$k$$ times the variance of the geometric distribution.

Therefore,
$Var\left(X\right)=\ {\sigma }^2=k\times \ \frac{q}{p^2}$ ${\sigma }^2=\ \frac{kq}{p^2}$
Probability Generating Function(PGF):-

The PGF of the Negative binomial distribution is
$G_X\left(t\right)=\ {\left(\frac{pt}{1-qt}\right)}^k \ for \ \frac{-1}{q}<t<\frac{1}{q}$
Moment Generating Function(MGF):-

The MGF of the Negative binomial distribution is
$M_X\left(t\right)=\ {\left(\frac{pe^t}{1-{qe}^t}\right)}^k \ for \ \frac{-1}{q}<e^t<\frac{1}{q}$
Cumulant Generating Function(CGF):-

The CGF of the Negative binomial distribution is
$c_X\left(t\right)=k\times \ \left[{\mathrm{ln} p\ }+t-{\mathrm{ln} \left(1-{qe}^t\right)\ }\right]$
Type 2 negative binomial distribution

Now, let us consider the second type of the negative binomial distribution, which measures the number of failures before the $$k^{th}$$ success.

Probability distribution:-

Let $$Y$$ be the second type of the negative binomial variable, taking values $$y=0,1,2\dots \dots$$ which count the number of failures before the $$k^{th}$$ success. In the first type of the negative binomial distribution where $$x$$ trials are required for $$k$$ successes, the number of failures will be $$X-k$$. Therefore, $$Y=X-k$$, where $$X$$ is the first type of the negative binomial distribution.
The question of interest in this case is the number of failures before the $$k^{th}$$ success occurs. The probability of $$y$$ failures and $$k$$ successes can be written as $$q^yp^k$$. Our interest extends only until the $$k^{th}$$ success occurs, which means the $$k^{th}$$ success will be the last trial that we would consider. So, there will be a total of $$y+k$$ trials ($$y$$ failures and $$k$$ successes), of which the $$k^{th}$$ success occurs on the last trial. Of the remaining $$y+k-1$$ trials, there are multiple orders in which $$y$$ failures can occur. This is incorporated into the probability distribution by multiplying the above mentioned probability $$(q^yp^k)$$ with $${}^{y+k-1}{C_y}$$ or $$\left(\genfrac{}{}{0pt}{}{y+k-1}{y}\right)$$, which represents the number of ways in which $$y$$ failures can occur out of $$y+k-1$$ trials. Therefore, the probability function can be written as follows:-
$p\left(Y=y\right)=\left(\genfrac{}{}{0pt}{}{y+k-1}{y}\right)q^yp^k \ for \ y=0,1,2\dots \dots$
It is important to note that the random variable $$Y$$ can take values beginning from $$y=0$$ because there can be a possibility of zero failures before $$k$$ successes.

Mean:-

The second type of the negative binomial distribution is the sum of $$k$$ geometric distributions of the second type(number of failures before 1st success + number of failures before another success + number of failures before another success ……… + number of failures before $$k^{th}$$ success).Therefore, the mean or expected value is $$k$$ times that of the second type of the geometric distribution.
$E\left(X\right)=\ \mu =\ \frac{kq}{p}$
Variance:-

The variance is $$k$$ times the variance of the second type of the geometric distribution.
$Var\left(X\right)=\ {\sigma }^2=\ \frac{kq}{p^2}$
EXAMPLES
Example 1

A salesman is given a target of 5 sales on a particular day. From his past work record, the store manager learns that the salesman’s probability of making a sale per visitor is 0.6. The store manager wishes to find out the probability that salesman will reach his target on the 20th customer visit, for that day.

In this example, the number of customer visits required for 5 sales can be modelled using a negative binomial distribution .

Here,
$$p=0.6(probability\ of\ success\ for\ each\ trial)$$
$$k=5(number\ of\ success\ required)$$
$$x=20(number\ of\ the\ trial\ on\ which\ the\ 5th\ success\ is\ required)$$

The required probability is $$P(X = 20)$$.

$P\left(X=x\right)=\ \left(\genfrac{}{}{0pt}{}{x-1}{k-1}\right)p^kq^{x-k}$ $P\left(X=20\right)=\ \left(\genfrac{}{}{0pt}{}{20-1}{5-1}\right){0.6}^5{0.4}^{20-5}\$ $\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =\ \left(\genfrac{}{}{0pt}{}{19}{4}\right){0.6}^5{0.4}^{15}$ $\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =0.0003236$
Mean:-
$\mu =\ \frac{k}{p}=\ \frac{5}{0.6}=8.33$
This means that if the salesman worked equally efficiently every day, for a large number of days, he would need just 8.33 customer visits a day to make 5 sales.

Example 2

A footballer’s probability of scoring a goal on one attempt is 0.8. The player’s coach wishes to determine the probability that the player’s 3rd goal would be on his 5th attempt.

The number of attempts required to score 3 goals can be modelled using the negative binomial distribution.

Here,
$$k=3$$
$$p=0.8$$
$$q=1-0.8=0.2$$

The required probability is $$P(X=5)$$
$P\left(X=x\right)=\ \left(\genfrac{}{}{0pt}{}{x-1}{k-1}\right)p^kq^{x-k}$ $P\left(X=5\right)=\ \left(\genfrac{}{}{0pt}{}{5-1}{3-1}\right){0.8}^3{0.2}^{5-3}$ $\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =\ \left(\genfrac{}{}{0pt}{}{4}{2}\right){0.8}^3{0.2}^2$ $\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =0.12288$
Mean:-
$\mu =\ \frac{k}{p}=\ \frac{3}{0.8}=3.75$