Negative Binomial Distribution Calculator

Calculate exact and cumulative probabilities for failures before a chosen number of successes in independent Bernoulli trials.

Negative binomial probability
Enter the target successes, probability per trial, and observed failures.

About the negative binomial distribution

The negative binomial distribution describes how many failures occur before a fixed number of successes is reached in a sequence of independent trials. Every trial has only two outcomes, conventionally called success and failure, and the probability of success remains constant. This calculator uses r for the required number of successes, p for the success probability on each trial, and k for the number of failures observed before the rth success. That definition is common in probability courses, quality control, reliability studies, epidemiology, and count-data modeling. The exact probability is found with the probability mass function C(k + r - 1, k) times p raised to r times (1 - p) raised to k. The combination counts the possible arrangements of earlier successes and failures while requiring the final trial to be the target success. The calculator also sums the mass function from zero through k to report P(X <= k), then subtracts that cumulative value from one to report P(X > k). Together these values answer exact, at-most, and more-than questions without separate calculations. The expected number of failures is r(1 - p) / p, and the variance is r(1 - p) / p squared. A larger success probability generally moves the distribution toward zero failures and reduces its spread. A larger target number of successes increases both the expected failures and the variance. When p equals one, every trial succeeds, so zero failures has probability one and the mean and variance are both zero. Use whole numbers for r and k because they count outcomes. Enter p as a decimal between zero and one, such as 0.35 for a 35 percent chance. Trials must be independent and identically distributed for the standard model to apply. If probabilities change between trials, outcomes influence one another, or the process stops for another reason, a different model may be more appropriate. Also note that some textbooks define the negative binomial variable as the total number of trials rather than failures. Under that convention, total trials equals k + r, while the probability itself is unchanged after the variables are translated correctly.

Negative binomial examples

These examples use failures before the target success.

InputsResultInterpretation
r = 3, p = 0.5, k = 2P(X = 2) = 0.1875There is an 18.75% chance of exactly two failures before the third success.
r = 2, p = 0.5, k = 0P(X = 0) = 0.25Two immediate successes occur with probability 0.5 squared.
r = 1, p = 0.25, k = 3P(X = 3) = 0.10546875This geometric special case measures three failures before the first success.

How to use the calculator

  1. Enter the positive whole number of successes required to stop the experiment.
  2. Enter the constant probability of success for one trial as a decimal from greater than zero through one.
  3. Enter the nonnegative whole number of failures to evaluate.
  4. Select Calculate to view the exact probability, cumulative tails, mean, and variance.

Negative binomial distribution FAQ

What does the negative binomial distribution measure?

It measures the number of failures before a specified number of successes occurs. It assumes independent trials with the same success probability.

How is it different from the binomial distribution?

A binomial experiment fixes the number of trials and counts successes. A negative binomial experiment fixes the number of successes and counts failures or trials until that target.

Is the geometric distribution related?

Yes. The geometric distribution is the negative binomial distribution with one required success, so it counts failures before the first success.

Can the probability of success be entered as a percentage?

Enter it as a decimal rather than a percentage. For example, use 0.4 for a 40 percent probability of success.

Why must successes and failures be whole numbers?

They are counts of discrete trial outcomes, so fractional values have no meaning in this model. The calculator rejects negative and non-integer counts.