Why Generate Negative Binomial Probabilities Recursively?
A negative binomial model can describe a count of failures accumulated before a specified number of successes. When several probabilities are needed, calculating each one independently from factorials can be inefficient and can make arithmetic errors harder to spot. The recursion computes each probability from the one immediately before it, while the direct probability mass function provides an independent check.
The convention matters: negative binomial distributions are parameterized in more than one way. Here, \(N\) is the number of failures before the \(r\)th success in independent Bernoulli trials. The probability of success on each trial is \(\pi\), and the probability of failure is \(q=1-\pi\). Under this convention, \(E[N]=rq/\pi\).
The binomial coefficient counts the arrangements of the first \(n+r-1\) trials that contain \(n\) failures and \(r-1\) successes, followed by a success on the final trial. Thus exactly \(r\) successes have occurred by the end, with the \(r\)th success on trial \(n+r\).
Deriving the Probability Recursion
The most useful step is to divide the formula for \(g_n\) by the formula for \(g_{n-1}\). For \(n\geq 1\), the powers of \(\pi\) cancel, and the ratio of the binomial coefficients simplifies:
Multiplying by \(g_{n-1}\) gives a recurrence that starts from \(g_0\). Separating the terms in the ratio also shows its connection to the \((a,b,0)\) form.
The recursion is valid for every integer \(n\geq1\) in this model. It requires the initial value \(g_0\); the recursion alone does not specify the probability sequence. It also relies on the stated negative binomial parameterization. If a problem instead defines the count as the number of trials to obtain \(r\) successes, that count includes the \(r\) successes and is not \(N\); its support and probability formula differ.
Identify \(r\), \(\pi\), and \(q=1-\pi\), and confirm that the count is failures before the \(r\)th success.
Use \(g_0=\pi^r\), since zero failures means the first \(r\) trials are all successes.
For each \(n=1,2,\ldots\), multiply the previous probability by \(q(n+r-1)/n\).
Substitute the same \(n,r,\pi,q\) into the direct mass function and compare the requested probabilities.
Worked Applications
The following examples use the failures-before-successes convention throughout. In each one, the direct probability mass function checks the recursive calculation; it is not a different model.
Worked Example: Use the Mean to Set the Parameters
A hypothetical count follows a negative binomial distribution with \(r=3\) and mean \(E[N]=6\). Find \(\pi\) and \(q\), then calculate \(P(N\leq2)\) recursively and check the answer with the direct mass function.
Method and parameter conversion. Under this convention \(E[N]=rq/\pi\), and \(\pi+q=1\). Thus
Using \(\pi+q=1\), we get \(3\pi=1\), so \(\pi=1/3\) and \(q=2/3\). The starting probability and the next two recursion multipliers are
Therefore \(g_1=2/27=6/81\), and \(g_2=(4/3)(2/27)=8/81\). Adding the three probabilities gives
Direct check. The mass function gives \(g_0=(1/3)^3=1/27\), \(g_1=\binom{3}{1}(1/3)^3(2/3)=2/27\), and \(g_2=\binom{4}{2}(1/3)^3(2/3)^2=8/81\). These match the recursion. The mean and the probability values are consistent with the specified parameters.
Common mistake avoided: Do not reverse the success and failure probabilities when using the mean. Here the mean equation is \(rq/\pi\), not \(r\pi/q\).
Worked Example: Generate a Short Probability Sequence
For a hypothetical portfolio count, suppose \(N\) has \(r=2\), \(\pi=0.6\), and \(q=0.4\). Generate \(g_0\) through \(g_3\), find \(P(N\leq3)\), and check the sequence directly.
Recursive calculation. Begin with \(g_0=\pi^r=(0.6)^2=0.36\). For \(n=1\), the multiplier is \(0.4(1+2-1)/1=0.8\), so \(g_1=0.8(0.36)=0.288\). For \(n=2\), the multiplier is \(0.4(2+2-1)/2=0.6\), giving \(g_2=0.6(0.288)=0.1728\). For \(n=3\), the multiplier is \(0.4(3+2-1)/3=4/15\), giving \(g_3=(4/15)(0.1728)=0.04608\).
Consequently,
Direct check. The mass function has \(g_n=\binom{n+1}{n}(0.6)^2(0.4)^n\). It gives \(g_0=0.36\), \(g_1=2(0.36)(0.4)=0.288\), \(g_2=3(0.36)(0.16)=0.1728\), and \(g_3=4(0.36)(0.064)=0.09216\).
This reveals an arithmetic error in the recursive calculation above: the \(n=3\) multiplier is \(0.4(4)/3=8/15\), not \(4/15\). Correcting it gives \(g_3=(8/15)(0.1728)=0.09216\), and therefore \(P(N\leq3)=0.36+0.288+0.1728+0.09216=0.91296\). The direct and corrected recursive values agree.
Common mistake avoided: Simplify the entire multiplier \(q(n+r-1)/n\) before multiplying. Checking each generated probability against the direct mass function catches an incorrectly simplified ratio.
Worked Example: Combine a Mean Check With a Tail Probability
A hypothetical count has \(r=4\) and mean \(E[N]=4\). Find \(\pi\) and \(q\), generate \(g_0\) through \(g_4\), and calculate \(P(N\leq4)\). Verify the last generated probability with the direct mass function.
Find the parameters. The mean equation gives \(4=4q/\pi\), so \(q=\pi\). Since \(q+\pi=1\), both are \(1/2\). Hence \(g_0=(1/2)^4=1/16\). The successive multipliers for \(n=1,2,3,4\) are \(2\), \(5/4\), \(1\), and \(7/8\).
Applying them in order,
In a common denominator of 256, \(g_0=16/256\), \(g_1=32/256\), \(g_2=40/256\), and \(g_3=40/256\). Thus
Direct check of \(g_4\). The mass function gives \(\binom{7}{4}(1/2)^4(1/2)^4=35/256\), agreeing with the recursion. The parameters also reproduce the stated mean: \(rq/\pi=4(1/2)/(1/2)=4\).
Common mistake avoided: A cumulative probability through \(n=4\) includes five terms, \(g_0\) through \(g_4\). Stopping at \(g_3\) would answer a different question.
Checks, Interpretation, and Exam Traps
A recursion makes a sequence of calculations efficient, but it does not remove the need to track the model and indices carefully. First confirm what the count represents. Then keep the \(n\) in the recursion aligned with the probability being calculated: the multiplier \(q(n+r-1)/n\) produces \(g_n\) from \(g_{n-1}\), not \(g_{n+1}\) from \(g_n\).
A cumulative probability is a sum of the individual probabilities requested. For example, \(P(N\leq2)=g_0+g_1+g_2\); it is not simply one of the generated terms. A partial sum need not equal 1, because it leaves out the probabilities above its upper endpoint.
The sum in the first worked example is also a useful arithmetic warning. The correct terms are \(3/81\), \(6/81\), and \(8/81\). The incorrect calculation \(3+6+14=23\), and hence \(23/81\), uses a wrong value for the third term. The correct numerator is \(3+6+8=17\), so the cumulative probability is \(17/81\approx0.2099\). Showing the terms before adding them helps distinguish a probability-model error from a simple summation error.
Check Your Understanding
For each problem, use the failures-before-successes convention and check the recursion indices carefully.
- A count has \(r=2\) and \(\pi=q=0.5\). Calculate \(P(N\leq2)\) recursively. (Answer: \(11/16=0.6875\))
- A count has \(r=3\), \(\pi=2/3\), and \(q=1/3\). Calculate \(P(N\leq2)\). (Answer: \(64/81\approx0.7901\))
- A negative binomial count has \(r=2\) and mean 6. Find \(\pi\) and \(q\), then calculate \(P(N\leq2)\). (Answer: \(\pi=1/4,\ q=3/4,\ P(N\leq2)=67/256\approx0.2617\))
- A count has \(r=4\), \(\pi=0.4\), and \(q=0.6\). Generate \(g_0,g_1,g_2\) and calculate \(P(N\leq2)\). (Answer: \(g_0=0.0256,\ g_1=0.06144,\ g_2=0.09216,\ P(N\leq2)=0.1792\))
- A count has \(r=3\) and \(g_0=0.125\). Find \(\pi\) and \(q\), then calculate \(P(N\leq3)\). (Answer: \(\pi=q=0.5,\ P(N\leq3)=0.65625\))