Tutorials › VEE Mathematical Statistics › Deriving the Negative Binomial Mass Function

VEE Mathematical Statistics · Geometric and Negative Binomial Models · Tutorial 112 of 880

Deriving the Negative Binomial Mass Function

Learn how to derive and apply the exact probability that the rth success occurs on a specified trial.

Intermediate 10 min read

What You'll Learn

  • State the independent, constant-probability Bernoulli assumptions behind the model
  • Count the arrangements that place the first r − 1 successes before the specified final success
  • Derive the mass function for the trial number of the rth success
  • Calculate exact completion probabilities from sequence counts and individual sequence probabilities
  • Recognize common errors in the binomial coefficient, success count, and failure count

Why Counting Sequences Gives the Probability

A waiting-time question asks not only how many successes occur, but when a specified success occurs. For example, the event that the third positive result occurs on sample 5 requires the fifth result to be positive, with exactly two positive results among the first four. Counting the possible orders of those first four results gives the number of ways the event can happen; the Bernoulli model gives the probability of each way.

The derivation depends on a fixed-trial model. Each trial has two possible outcomes, called success and failure, and its success probability is the same on every trial. The outcomes on different trials must also be independent. If the success probability changes over time or trials are dependent, the formula derived here generally does not apply.

Definition: Suppose trials are independent Bernoulli trials, each with success probability \(p\), where \(0<p<1\), and let \(q=1-p\) be the failure probability. For a positive integer \(r\), let \(T_r\) denote the trial number on which the \(r\)th success occurs. The event \(T_r=n\) is possible only for integers \(n\ge r\). On that event, trial \(n\) is a success and the preceding \(n-1\) trials contain exactly \(r-1\) successes.

A particular ordered sequence of \(n\) outcomes that qualifies for \(T_r=n\) has \(r\) successes and \(n-r\) failures. By independence, its probability is \(p^r q^{n-r}\). The remaining task is to count how many such sequences there are.

Deriving the Negative Binomial Mass Function

The last trial is already determined: it must be a success, because it is the \(r\)th success. Among the first \(n-1\) trials, choose the \(r-1\) positions occupied by successes. All other positions among those first \(n-1\) trials must be failures. Therefore the number of qualifying sequences is \(\binom{n-1}{r-1}\). The events corresponding to the different sequences are disjoint, and each has the same probability.

$$ P(T_r=n) = \binom{n-1}{r-1}p^r q^{n-r}, \qquad n=r,r+1,r+2,\ldots $$

This is the probability mass function for the trial number of the \(r\)th success. Each part has a direct interpretation: the binomial coefficient counts arrangements before the final trial; \(p^r\) accounts for all \(r\) successes, including the required success on trial \(n\); and \(q^{n-r}\) accounts for the failures among the first \(n-1\) trials.

Derivation: For \(T_r=n\), the first \(n-1\) trials must contain exactly \(r-1\) successes. There are \(\binom{n-1}{r-1}\) ways to choose their positions. For any one such arrangement, independence gives probability \(p^{r-1}q^{(n-1)-(r-1)}=p^{r-1}q^{n-r}\) for the first \(n-1\) trials. The final trial is a success, with probability \(p\), so the probability of that complete sequence is \(p^{r-1}q^{n-r}p=p^r q^{n-r}\). The qualifying arrangements are mutually exclusive, so adding their probabilities gives \(\binom{n-1}{r-1}p^r q^{n-r}\).

The exponents and the binomial coefficient can be checked from the event description. Across all \(n\) trials there are \(r\) successes and \(n-r\) failures. But only the first \(n-1\) positions are being arranged freely: the final success is fixed. Thus the count is not \(\binom{n}{r}\), which would count arrangements of \(r\) successes anywhere among \(n\) trials and would include sequences whose \(r\)th success happens before trial \(n\).

Worked Example: Third Positive Result on Sample 5

A hypothetical laboratory instrument records a positive result independently on each sample with probability \(p=0.40\). What is the probability that the third positive result occurs on sample 5? Also state how many ordered outcome sequences qualify.

Method. Use the exact-trial mass function. Here \(r=3\), \(n=5\), \(p=0.40\), and \(q=1-0.40=0.60\). The first four samples must contain exactly two positives, and sample 5 must be positive.

Count the sequences. Choose which two of the first four samples are positive. The remaining two of those samples are negative, and the fifth sample is the required third positive:

$$ \binom{4}{2}=6 $$

Probability of one sequence. Every qualifying sequence contains three positives and two negatives. By independence, its probability is

$$ (0.40)^3(0.60)^2 =0.064(0.36) =0.02304. $$

Combine the disjoint sequences.

$$ P(T_3=5) = 6(0.40)^3(0.60)^2 = 6(0.02304) = 0.13824. $$

There are 6 qualifying sequences, and the probability is 0.13824. As a check, each sequence ends in a positive and has exactly two positives among the first four; multiplying the common sequence probability by six gives the event probability. The common mistake avoided here is dropping or miscalculating the sequence probability after correctly finding the count.

Applying the Count to Different Success Probabilities

The counting method does not depend on what a success represents. It may be a part passing inspection, a transaction meeting a specified criterion, or a hypothetical observation being classified as positive. What matters is that the outcome on each trial follows the same independent Bernoulli model. Translate the event into the number of successes and failures first, then use the arrangement count.

Worked Example: Fourth Pass on Test 6

At a hypothetical quality-control station, each part passes independently with probability \(p=0.70\). Find the probability that the fourth pass occurs on test 6. State the number of failures in each qualifying sequence and the number of qualifying sequences.

Method. For the fourth pass to occur on test 6, test 6 must be a pass and the first five tests must contain exactly three passes. Thus \(r=4\), \(n=6\), and \(q=1-0.70=0.30\).

Count and identify outcomes. Choose three of the first five tests to be passes. The other two of the first five are failures; test 6 is the fourth pass. So each qualifying sequence has four passes and two failures, and there are

$$ \binom{5}{3}=10 $$

qualifying sequences.

Probability. One sequence has probability \((0.70)^4(0.30)^2\). Evaluating each factor,

$$ (0.70)^4=0.2401, \qquad (0.30)^2=0.09, \qquad 0.2401(0.09)=0.021609. $$

Summing the probabilities of the 10 disjoint sequences gives

$$ P(T_4=6) = \binom{5}{3}(0.70)^4(0.30)^2 = 10(0.021609) = 0.21609. $$

The answer is 10 sequences, 2 failures per sequence, and probability 0.21609. The sequence count is not itself the probability: the probability of one sequence must still be multiplied by the count. The check is that each sequence has six outcomes in total, four passes and two failures, as required.

Worked Example: Fifth Flag on Audit 9

In a hypothetical audit process, each reviewed record is independently flagged with probability \(p=0.20\). Find the probability that the fifth flagged record is found on review 9. Show both the count of arrangements and the probability calculation.

Method. The ninth review must be flagged, and the first eight reviews must contain exactly four flagged records. Thus \(r=5\), \(n=9\), and \(q=1-0.20=0.80\).

Count the arrangements. The four earlier flags can occupy any four of the first eight positions:

$$ \binom{8}{4} = \frac{8\cdot7\cdot6\cdot5}{4\cdot3\cdot2\cdot1} = 70. $$

Each qualifying sequence therefore contains five flagged records and four unflagged records. Its probability is

$$ (0.20)^5(0.80)^4 = 0.00032(0.4096) = 0.000131072. $$

Multiplying by the 70 disjoint arrangements,

$$ P(T_5=9) = 70(0.000131072) = 0.00917504. $$

The probability is 0.00917504, or about 0.0092 to four decimal places. The check is that the exponent of \(0.20\) is five, not four: the flagged record on review 9 is included among the five total flags. The common error this avoids is counting only the flags before the final review when setting the probability exponent.

Common Counting and Probability Traps

A reliable solution separates the event into its fixed last outcome, the arrangements before it, and the probability of one complete sequence. Most errors come from blending these steps or using a count that describes a different event.

  • Choosing positions among all \(n\) trials. The last trial is required to be the \(r\)th success, so choose the earlier successes among the first \(n-1\) trials. Use \(\binom{n-1}{r-1}\), not \(\binom{n}{r}\).
  • Using only \(r-1\) successes in the probability. There are \(r-1\) successes before trial \(n\), but trial \(n\) adds one more. A qualifying complete sequence has \(r\) successes, so its success factor is \(p^r\).
  • Using the wrong failure count. The first \(n-1\) trials contain \(n-r\) failures, and trial \(n\) is a success. Hence the failure factor is \(q^{n-r}\).
  • Forgetting the assumptions. The product \(p^r q^{n-r}\) applies when each trial is independent and has the same success probability \(p\). A changing success probability requires a different calculation.
  • Allowing an impossible trial number. The \(r\)th success cannot occur before trial \(r\). If \(n<r\), then \(P(T_r=n)=0\).
Key takeaway: For the \(r\)th success to occur on trial \(n\), fix a success on trial \(n\), choose \(r-1\) successes among the first \(n-1\) trials, and assign the remaining earlier positions to failures. Under independent Bernoulli trials with constant success probability \(p\), this gives \(\binom{n-1}{r-1}p^r(1-p)^{n-r}\).

Check Your Understanding

For each problem, identify the required arrangement count and use the probability of a complete qualifying sequence. Assume independent trials with the stated constant success probability.

  1. A sensor registers a target independently with probability \(0.50\) on each scan. Find the probability that the second registration occurs on scan 4. (Answer: \(0.1875\))
  2. A hypothetical screening procedure has a positive-result probability of \(0.60\) on each independent test. Find the probability that the third positive occurs on test 5. (Answer: \(0.20736\))
  3. A machine produces an acceptable unit with probability \(0.30\) on each independent attempt. Find the probability that the fourth acceptable unit occurs on attempt 7, and state the number of failures in a qualifying sequence. (Answer: \(0.055566\); 3 failures)
  4. In a hypothetical independent review process, each record is flagged with probability \(0.80\). Find the probability that the second flag occurs on review 5. (Answer: \(0.02048\))
  5. A process is observed for four independent trials, each with success probability \(0.25\). Can the third success occur on trial 2? Give the probability of that event and explain the support restriction. (Answer: \(0\); the third success cannot occur before trial 3)
Clinical Biostats