0.26876022
7.5
18.75
4.3301
0.26876022
7.5
18.75
4.3301
The Negative Binomial Distribution Calculator computes the probability mass function (PMF) and key statistical moments for the negative binomial distribution, one of the most versatile discrete probability distributions in statistics. This distribution models the number of failures that occur before a specified number of successes is achieved in a sequence of independent Bernoulli trials, each with the same probability of success.
Unlike the standard binomial distribution, which counts successes in a fixed number of trials, the negative binomial distribution answers the question: how many failures will I observe before reaching r successes? This makes it invaluable in fields ranging from epidemiology (modeling disease outbreaks) to ecology (species abundance modeling) and quality control (defect analysis in manufacturing processes).
The negative binomial distribution is also widely used as an alternative to the Poisson distribution when the data exhibit overdispersion — that is, when the observed variance exceeds the mean. In genomics and RNA sequencing analysis, the negative binomial model is the standard choice for modeling read count data precisely because biological count data almost always show greater variability than a Poisson model would predict. Insurance companies use this distribution to model claim frequencies, and ecologists employ it to describe the clumped spatial patterns of organisms.
The distribution has a rich set of properties that make it analytically tractable. It is infinitely divisible, meaning that the sum of independent negative binomial variables with the same p is again negative binomial. The moment generating function exists for all t < −ln(1 − p), enabling straightforward derivation of all moments. The distribution is also a member of the exponential family, which facilitates maximum likelihood estimation and generalized linear model fitting.
This calculator uses the Stirling approximation for the gamma function to compute the binomial coefficients involved in the PMF, providing accurate results for a wide range of parameter values. Enter your desired number of successes, the observed number of failures, and the probability of success per trial to obtain the exact PMF value along with the distribution's mean, variance, and standard deviation.
The negative binomial distribution PMF gives the probability of observing exactly k failures before the r-th success:
$$P(X = k) = \binom{k + r - 1}{k} \cdot p^r \cdot (1 - p)^k$$
where r is the number of successes needed, k is the number of failures, and p is the probability of success on each trial. The binomial coefficient is computed using the gamma function:
$$\binom{k + r - 1}{k} = \frac{\Gamma(k + r)}{\Gamma(r) \cdot \Gamma(k + 1)}$$
The mean and variance of the distribution are:
$$\mu = \frac{r(1 - p)}{p}, \quad \sigma^2 = \frac{r(1 - p)}{p^2}$$
Note that the variance is always greater than the mean (since 1/p > 1 for p < 1), which is why this distribution is used for overdispersed count data. The standard deviation is simply the square root of the variance.
The PMF value represents the exact probability of observing the specified number of failures before achieving the target number of successes. Values closer to zero indicate less likely outcomes. The mean tells you the expected number of failures, while the variance and standard deviation quantify the spread of possible outcomes. A higher variance relative to the mean indicates greater unpredictability in the number of failures. If the mean is much larger than r, the success probability is low and you should expect many trials before completing all successes.
Inputs
Results
With a 40% success rate, the probability of exactly 10 failures before 5 successes is about 5.35%. On average, you would expect 7.5 failures.
Inputs
Results
With 60% success probability, the chance of exactly 2 failures before 3 successes is about 20.7%, consistent with the mean of 2 expected failures.
The binomial distribution counts the number of successes in a fixed number of trials. The negative binomial distribution counts the number of failures before a fixed number of successes. In the binomial case, the number of trials is fixed and the number of successes is random; in the negative binomial case, the number of successes is fixed and the number of trials (or equivalently failures) is random.
Use the negative binomial when your count data show overdispersion — when the variance exceeds the mean. The Poisson distribution assumes mean equals variance, which is often too restrictive for real-world data. The negative binomial adds an extra parameter that allows the variance to exceed the mean, making it suitable for clustered or heterogeneous count data such as RNA-seq reads, insurance claims, or species counts.
The parameter r represents the number of successes you are waiting for. For example, if you are testing light bulbs and want to find 5 defective ones (r = 5), the negative binomial tells you the probability distribution of how many non-defective bulbs (failures to find defects) you will test before finding all 5 defective ones. In the overdispersion context, r acts as a dispersion parameter controlling how much extra variance exists beyond Poisson.
Yes. When r is allowed to be any positive real number (not just integers), the distribution is sometimes called the Polya distribution. This generalization is especially important in regression modeling where r serves as a continuous dispersion parameter. This calculator uses the gamma function formulation, which naturally supports non-integer r values.
The geometric distribution is a special case of the negative binomial with r = 1. It models the number of failures before the first success. If you sum r independent geometric random variables, you get a negative binomial random variable, which is why the negative binomial counts failures before the r-th success.
When p is very small (close to 0), the expected number of failures becomes very large and the distribution is right-skewed with high variance. When p is close to 1, few failures are expected and the distribution is concentrated near zero. As p approaches 1, the distribution converges to a point mass at k = 0, since successes occur almost every trial.
Roboculator Team
The Roboculator Team explains calculations, planning tools, and practical formulas in clear language for real-life situations.
How helpful was this calculator?
Be the first to rate!
Normal Distribution Calculator
Probability Distributions
Standard Normal Distribution Calculator
Probability Distributions
Poisson Distribution Calculator
Probability Distributions
Exponential Distribution Calculator
Probability Distributions
Uniform Distribution Calculator
Probability Distributions
Geometric Distribution Calculator
Probability Distributions