0
0
4.5
11.25
3.354102
2
1.19257
0
0
4.5
11.25
3.354102
2
1.19257
The Negative Binomial Distribution Calculator computes probabilities and statistics for the negative binomial distribution, which models the number of failures before achieving a specified number of successes in a sequence of independent Bernoulli trials.
If each trial has success probability $$p$$, the probability of observing exactly $$k$$ failures before the $$r$$-th success is:
$$P(X = k) = \binom{k + r - 1}{k} p^r (1-p)^k, \quad k = 0, 1, 2, \ldots$$
The binomial coefficient $$\binom{k+r-1}{k}$$ counts the number of ways to arrange $$k$$ failures among the first $$k + r - 1$$ trials (the last trial must be a success).
The mean number of failures is $$E[X] = \frac{r(1-p)}{p}$$, and the variance is $$\text{Var}(X) = \frac{r(1-p)}{p^2}$$. The variance is always larger than the mean (overdispersion), which distinguishes the negative binomial from the Poisson distribution. The mode is $$\lfloor \frac{(r-1)(1-p)}{p} \rfloor$$ for $$r > 1$$.
When $$r = 1$$, the negative binomial reduces to the geometric distribution. The negative binomial can also be viewed as a Poisson-gamma mixture: if the rate of a Poisson process varies according to a gamma distribution, the resulting count follows a negative binomial distribution. This connection makes it a natural model for overdispersed count data.
In many real-world datasets, the variance of count data exceeds the mean, violating the Poisson assumption of equal mean and variance. The negative binomial distribution handles this overdispersion by adding an extra parameter. It is widely used in ecology (species abundance), epidemiology (disease counts), genomics (RNA-seq read counts), and insurance (claim frequencies).
The negative binomial appears in quality control (number of items inspected before finding $$r$$ defects), sports analytics (number of at-bats before $$r$$ hits), clinical trials (number of patients screened before $$r$$ eligible ones), and any scenario counting trials until a target number of successes.
Enter the required number of successes $$r$$, the success probability $$p$$, and the number of failures $$k$$. The calculator computes the PMF, mean, variance, standard deviation, mode, and skewness.
The calculator computes the PMF using logarithmic binomial coefficients (Stirling's approximation) to avoid overflow: $$\ln P = \ln\binom{k+r-1}{k} + r\ln p + k\ln(1-p)$$, then exponentiates. Statistical moments use the closed-form expressions for the negative binomial distribution.
The PMF gives the probability of exactly $$k$$ failures before the $$r$$-th success. A higher $$p$$ means fewer failures are expected. The overdispersion (variance > mean) increases as $$p$$ decreases. The skewness is always positive, indicating a right-skewed distribution, especially for small $$r$$ or small $$p$$.
Inputs
Results
With p = 0.4 and r = 3, the probability of exactly 5 failures before the 3rd success is about 10%. The expected number of failures is 4.5.
Inputs
Results
With r = 1, this is the geometric distribution. The probability of exactly 4 failures before the first success with p = 0.3 is about 7.2%.
The binomial distribution fixes the number of trials and counts successes. The negative binomial fixes the number of successes and counts failures (or total trials). They answer different questions about the same Bernoulli process.
The name comes from the negative binomial series expansion. The PMF involves $$\binom{k+r-1}{k}$$, which can be written as $$(-1)^k \binom{-r}{k}$$ using the generalized binomial coefficient with a negative upper index.
The negative binomial has variance $$\frac{r(1-p)}{p^2}$$, which is always greater than the mean $$\frac{r(1-p)}{p}$$ (since $$1/p > 1$$ for $$p < 1$$). This built-in overdispersion makes it suitable for count data where the Poisson model is too restrictive.
Yes. The negative binomial can be generalized to real-valued $$r > 0$$ by replacing the binomial coefficient with the gamma function: $$\binom{k+r-1}{k} = \frac{\Gamma(k+r)}{k! \, \Gamma(r)}$$. This is the form used in regression models for overdispersed counts.
If $$X \mid \lambda \sim \text{Poisson}(\lambda)$$ and $$\lambda \sim \text{Gamma}(r, p/(1-p))$$, then marginally $$X$$ follows a negative binomial distribution. This interpretation explains why it models heterogeneous Poisson data.
In genomics, RNA-seq read counts show overdispersion due to biological variability. The negative binomial distribution is the standard model in tools like DESeq2 and edgeR, where the extra parameter captures gene-specific biological variation beyond Poisson sampling noise.
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!
Exponential Distribution Calculator
Probability Distributions
Uniform Distribution Calculator
Probability Distributions
Geometric Distribution Calculator
Probability Distributions
Hypergeometric Distribution Calculator
Probability Distributions
Gamma Distribution Calculator
Probability Distributions
Weibull Distribution Calculator
Probability Distributions