to trial. The probability of a failure is equal to q = (1 − p).
4. The trials are independent.
5. The random variable of interest is Y , the number of failures before n successes occur.
A random variable Y is said to have a negative binomial probability distribution if and only if
$$p(y) = left( {begin{array}{*{20}{c}} {n + y - 1}\ {n - 1} end{array}} right){p^n}{(1 - p)^y},;;;;y = 0,;1,;...,;;;0 le p le 1.$$
Relative Mathematica Functions
NegativeBinomialDistribution[n, p] represents a negative binomial distribution with parameters n and p.
A[p_] := NegativeBinomialDistribution[2, p];
a1 = {Arrowheads[0.02], Arrow[{{10, 0.06}, {2, PDF[A[0.1], 2]}}]};
t1 = Text[Style["n=2,p=" <> ToString[0.1], Medium], {10, 0.06}, {-1, 0}];
a2 = {Arrowheads[0.02], Arrow[{{10, 0.08}, {2, PDF[A[0.2], 2]}}]};
t2 = Text[Style["n=2,p=" <> ToString[0.2], Medium], {10, 0.08}, {-1, 0}];
a3 = {Arrowheads[0.02], Arrow[{{10, 0.10}, {2, PDF[A[0.3], 2]}}]};
t3 = Text[Style["n=2,p=" <> ToString[0.3], Medium], {10, 0.10}, {-1, 0}];
epilog = {a1, t1, a2, t2, a3, t3};
DiscretePlot[Evaluate@Table[PDF[A[p], k], {p, {0.1, 0.2, 0.3}}], {k, 0, 15},
PlotRange -> All, PlotMarkers -> Automatic, Epilog -> epilog,
Background -> RGBColor[0.1, 0.45, 0.3, 0.9]]