Roboculator
Online CalculatorsCategoriesDate & EventsNews
Get Started
Online CalculatorsCategoriesDate & EventsNewsGet Started
Roboculator

Smart calculators for every challenge. Free, fast, and private.

Categories

  • Finance
  • Health
  • Math
  • Construction
  • Conversion
  • Everyday Life

Popular Tools

  • Date & Events
  • Loan Calculator
  • BMI Calculator
  • Percentage Calc
  • Latest News
  • Search All

Resources

  • Glossary
  • Topic Tags
  • News & Insights

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Service
  • Editorial Policy
  • Disclaimer
© 2026 Roboculator. All rights reserved.
Roboculator

roboculator.com

  1. Home
  2. /Math
  3. /Probability Distributions
  4. /Negative Binomial Distribution Calculator

Negative Binomial Distribution Calculator

Last updated: March 28, 2026

Calculator

Results

P(X = k)

0

P(X ≤ k) approx

0

Mean

4.5

Variance

11.25

Standard Deviation

3.354102

Mode

2

Skewness

1.19257

Results

P(X = k)

0

P(X ≤ k) approx

0

Mean

4.5

Variance

11.25

Standard Deviation

3.354102

Mode

2

Skewness

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.

Definition and PMF

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).

Statistical Properties

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$$.

Relationship to Other Distributions

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.

Overdispersion and 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).

Applications

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.

How to Use This Calculator

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.

Visual Analysis

How It Works

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.

Understanding Your Results

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$$.

Worked Examples

3 Successes with p = 0.4, Observing 5 Failures

Inputs

r3
p0.4
k5

Results

pmf0.10032906
cdf approx0.10032906
mean val4.5
variance11.25
std dev3.354102
mode3
skewness1.527525

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.

First Success (r = 1, Geometric Case)

Inputs

r1
p0.3
k4

Results

pmf0.07203
cdf approx0.07203
mean val2.333333
variance7.777778
std dev2.788867
mode0
skewness2.031009

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%.

Frequently Asked Questions

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.

Sources & Methodology

Hilbe, J. M. (2011). Negative Binomial Regression (2nd ed.). Cambridge University Press. Agresti, A. (2013). Categorical Data Analysis (3rd ed.). Wiley.
R

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!

Related Calculators

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