Negative Binomial Distribution Calculator

Negative Binomial Distribution Calculator

Calculate probabilities for the negative binomial distribution. Models the number of failures before achieving a specified number of successes.

Last updated: March 2026

Enter parameters and click Calculate to see results

What is the Negative Binomial Distribution?

The Negative Binomial Distribution models the number of failures (k) that occur before achieving a specified number of successes (r) in a sequence of independent Bernoulli trials, each with probability p of success. It's called "negative" because it counts failures rather than successes.

This distribution is widely used in quality control, epidemiology, and reliability engineering. For example, in manufacturing, it can model how many non-defective items you'll inspect before finding a target number of defective ones. In sports, it models games until a team reaches a certain number of wins.

The probability mass function is: P(X = k) = C(k+r-1, k) × p^r × (1-p)^k, where C represents the binomial coefficient. The mean is r(1-p)/p and the variance is r(1-p)/p².

How to Use This Calculator

Step-by-Step Guide

1
Enter r (successes needed): The target number of successes you're waiting for. Must be a positive integer (r ≥ 1).
2
Enter p (success probability): The probability of success on each trial, between 0 and 1 (exclusive). For example, 0.4 means 40% chance of success.
3
Enter k (number of failures): The number of failures before the r-th success. Must be a non-negative integer (k ≥ 0).
4
Interpret results: The calculator provides PMF (exact probability), CDF (cumulative probability), mean (expected failures), variance, and standard deviation.

Key Formulas

PMF: P(X = k) = C(k+r-1, k) × p^r × (1-p)^k
Mean: E[X] = r(1-p)/p
Variance: Var(X) = r(1-p)/p²
Standard Deviation: σ = √(Variance)

Example Calculation

Quality Control Scenario

Problem:
A factory inspects products until finding 5 defective items (r = 5). Each product has a 40% chance of being defective (p = 0.4). What is the probability of inspecting exactly 7 non-defective items (k = 7) before finding the 5th defect?
Given:
r = 5 (target defects)
p = 0.4 (defect probability)
k = 7 (non-defects before 5th defect)
Calculation:
P(X = 7) = C(11, 7) × (0.4)^5 × (0.6)^7
= 330 × 0.01024 × 0.0279936
≈ 0.0946
Statistics:
Mean = 5(1-0.4)/0.4 = 7.5 non-defects expected
Variance = 5(0.6)/0.16 = 18.75
Std Dev = √18.75 ≈ 4.33
Interpretation:
There's approximately a 9.46% probability of inspecting exactly 7 non-defective items before finding the 5th defective item. On average, we expect to see about 7.5 non-defects.

Frequently Asked Questions

What's the difference from binomial distribution?

Binomial has a fixed number of trials and counts successes. Negative binomial has a fixed number of successes and counts failures until reaching those successes. Use negative binomial when you're waiting for a specific number of events to occur.

When is negative binomial used?

Quality control (inspecting until finding r defects), epidemiology (tracking disease cases until threshold), reliability engineering (failures before r-th success), sports analytics (games until team wins r times), and sequential sampling studies.

What does the mean represent?

The mean r(1-p)/p is the expected number of failures before achieving r successes. For r=5, p=0.4, the mean is 7.5, meaning on average you'll see 7.5 failures before the 5th success.

Can I use it with small p?

Yes, but when p is very small (rare success), the distribution becomes very spread out with high variance. The mean r(1-p)/p becomes large, requiring many trials to reach r successes. This is still valid but may need large sample sizes.

What's the relationship with geometric distribution?

Geometric distribution is a special case of negative binomial with r=1 (waiting for the first success). Negative binomial generalizes this to waiting for the r-th success.

How do I interpret variance?

Variance r(1-p)/p² measures the spread of possible failure counts. Higher variance means more uncertainty about k. When p is close to 0 or 1, or when r is large, variance increases, indicating more variability in outcomes.

Is the PMF always ≤ 1?

Yes, P(X=k) is always between 0 and 1. The sum of all PMF values over k=0,1,2,... equals 1 (total probability). The peak typically occurs near the mean value.

Can I approximate with normal distribution?

Yes, when r is large (typically r > 5) and p is not too extreme, negative binomial can be approximated by Normal(μ=r(1-p)/p, σ²=r(1-p)/p²). Check with Q-Q plot or goodness-of-fit test.

Related Tools