Negative Binomial Distribution Calculator
Find negative binomial probabilities, mean, variance, and a full distribution table for any r, p, and k.
🎲 What is the Negative Binomial Distribution?
The negative binomial distribution is a discrete probability distribution that models the number of trials needed to achieve a fixed number of successes in a sequence of independent Bernoulli trials. Each trial has the same probability p of success. If X is the trial number on which the r-th success occurs, then X follows a Negative Binomial(r, p) distribution with possible values X = r, r+1, r+2, ... The minimum value is r because you need at least r trials to accumulate r successes.
This distribution has wide practical applications. In clinical trials, researchers model the number of patients to screen until r eligible participants are enrolled. In quality control, inspectors track how many items must be checked before finding r defectives. In sales and marketing, teams calculate how many customer contacts are needed before closing r sales. In network engineering, the negative binomial models the number of packet transmissions required until r successful acknowledgements are received. In ecology, it captures the overdispersed distribution of animal counts in quadrats, where variance exceeds the mean.
A common point of confusion is the relationship between the negative binomial and the binomial distribution. The binomial counts successes in a fixed number of trials; the negative binomial counts trials until a fixed number of successes. They are complementary perspectives on the same underlying Bernoulli process. Another important relationship: the geometric distribution is the special case of the negative binomial with r = 1, modeling the number of trials until the very first success.
The negative binomial is also used in statistics and data science to model count data with overdispersion, where the variance of observed counts exceeds what the Poisson distribution would predict. This makes it a common choice for regression models on count outcomes such as website visits, hospital admissions, or accident frequencies where true Poisson behavior is too restrictive.
📐 Formula
📖 How to Use This Calculator
Steps
💡 Example Calculations
Example 1 - Basketball Free Throws: 5 Makes from 8 Attempts
A player makes 70% of free throws. What is the probability the 5th make occurs on exactly the 8th attempt?
Example 2 - Quality Control: Finding 3 Defects in 10 Items
A factory produces items with a 20% defect rate. What is P(3rd defect is found on the 10th item)?
Example 3 - Clinical Trial: 10 Responders from 30 Screened
A drug has a 40% response rate. What is the probability the 10th responder is found on exactly the 30th patient screened?
❓ Frequently Asked Questions
🔗 Related Calculators
What is the negative binomial distribution formula?
P(X = k) = C(k-1, r-1) times p^r times (1-p)^(k-r) for k = r, r+1, r+2, ... where k is the trial number of the r-th success, r is the number of successes needed, and p is the per-trial success probability. The binomial coefficient C(k-1, r-1) counts the ways to place r-1 successes in the first k-1 trials (the k-th trial is always a success).
What is the mean of the negative binomial distribution?
The mean (expected value) is mu = r/p. For example, if you need 5 successes with a 25% per-trial success probability, the expected number of trials is 5/0.25 = 20. The variance is r(1-p)/p^2 and the standard deviation is sqrt(r(1-p)/p^2).
What is the difference between negative binomial and binomial distributions?
In the binomial distribution, the number of trials n is fixed and the number of successes X is random. In the negative binomial, the number of successes r is fixed and the number of trials X is random. Binomial asks how many successes in n trials; negative binomial asks how many trials until r successes.
What is the difference between negative binomial and geometric distributions?
The geometric distribution is the special case of the negative binomial with r = 1. The geometric counts trials until the first success; the negative binomial counts trials until the r-th success. When r = 1, the negative binomial formula P(X=k) = p(1-p)^(k-1) matches the geometric PMF.
What are the variance and standard deviation of the negative binomial distribution?
The variance is sigma^2 = r(1-p)/p^2 and the standard deviation is sigma = sqrt(r(1-p)/p^2). For r = 3 successes with p = 0.30, variance = 3 times 0.70 / 0.09 = 23.33 and SD = 4.83. The negative binomial has greater variance than the binomial for the same p, reflecting the uncertainty in waiting time.
When should I use the negative binomial distribution?
Use the negative binomial when you repeat independent trials each with fixed success probability p and want to model the number of trials until you accumulate r successes. Examples: quality control inspections until r defective items are found, clinical trials until r patients respond to treatment, sales calls until r conversions are made, and network retransmissions until r successful acknowledgements.
How does this calculator handle large values of r and k?
The calculator uses log-space computation for the binomial coefficient C(k-1, r-1) to avoid floating-point overflow. The formula in log space is log P(X=k) = log C(k-1, r-1) + r log(p) + (k-r) log(1-p), then P(X=k) = exp(log P(X=k)). The log-gamma (Lanczos) approximation handles factorials for large k and r without overflow.
What is P(X at least k) for the negative binomial?
P(X at least k) = 1 - P(X at most k-1) = 1 - sum of P(X=j) for j from r to k-1. This is the upper tail probability: the chance the r-th success requires at least k trials. For planning purposes, this tells you the probability the experiment will take longer than k trials before achieving r successes.
Can the negative binomial model overdispersion in count data?
Yes. The negative binomial is widely used in regression for count data where the variance exceeds the mean (overdispersion), a situation the Poisson distribution cannot handle. In a Poisson distribution, variance equals the mean. The negative binomial has variance = mu + mu^2/r, always greater than mu for finite r. As r approaches infinity, the negative binomial converges to Poisson.