Negative Binomial Distribution Calculator
Compute probabilities for the negative binomial distribution where X = number of failures before the r-th success, and each trial has success probability p.
Formula used for exact probability: P(X = k) = C(k + r - 1, k) (1 - p)k pr
What is the negative binomial distribution?
The negative binomial distribution models count data for repeated independent trials when each trial can be a success or failure. In this calculator, we use the common setup: you run trials until the r-th success happens, and the random variable X counts how many failures occurred before that moment.
Quick interpretation
- r tells you how many successes you are waiting for.
- p is the probability of success in each trial.
- k is a number of failures you want to evaluate in a probability statement.
When this calculator is useful
Use a negative binomial calculator whenever overdispersed count behavior appears naturally from repeated Bernoulli events.
- Sales calls until you close a fixed number of clients
- Quality control checks until a target number of passing units is reached
- Game attempts until a player achieves a fixed number of wins
- Clinical or reliability processes with repeated pass/fail outcomes
How to use this tool
Step 1: Set parameters
Input an integer for r, a decimal probability for p, and an integer for k.
Step 2: Choose probability type
- P(X = k): probability of exactly k failures.
- P(X ≤ k): cumulative probability of up to k failures.
- P(X ≥ k): right-tail probability of at least k failures.
Step 3: Read supporting metrics
The calculator also reports mean, variance, standard deviation, and the implied total number of trials T = r + k. These summaries help connect PMF/CDF values to practical planning.
Key formulas behind the calculator
Mean(X) = r(1 - p)/p
Var(X) = r(1 - p)/p2
Std Dev(X) = sqrt(Var(X))
Since total trials to reach the r-th success is T = X + r, you also get: E[T] = r/p
Common mistakes to avoid
- Confusing the variable definition (failures before r-th success vs. total trials).
- Using p as failure probability (here p means success probability).
- Entering non-integer values for r or k.
- Comparing outputs with software that uses a different negative binomial parameterization.
Practical example
Suppose each trial succeeds with probability p = 0.4, and you need r = 5 successes. If you set k = 3, then:
- P(X = 3) gives the chance you see exactly 3 failures before the 5th success.
- P(X ≤ 3) gives the chance you reach 5 successes with 3 or fewer failures.
- P(X ≥ 3) gives the chance failures are 3 or more before finishing.
Why analysts like the negative binomial model
Compared to simpler count models, the negative binomial distribution naturally allows larger variance, making it a strong choice for overdispersed count data. It appears often in biostatistics, economics, operations research, reliability engineering, and applied machine learning workflows.