Negative Binomial Distribution Calculator

Calculate negative binomial probabilities — failures before the r-th success — with full distribution table, visual chart, and parameter sensitivity analysis.

Target number of successes
P(X = 10)
0.056694
5.669% — exactly 10 failures
P(X ≤ 10)
0.498348
Cumulative probability
P(X > 10)
0.501652
More than k failures
P(5 ≤ X ≤ 15)
0.580626
58.063%
Mean (E[X])
12.0000
r(1−p)/p = 3×0.800/0.200
Std Deviation
7.7460
Var = 60.0000
Mode
8
Most likely number of failures
Expected Total Trials
15.00
10 failures + 3 successes = 13 trials for your k

Probability Distribution

Distribution Table

k (failures)Total trialsP(X = k)P(X ≤ k)Bar
030.0080000.008000
140.0192000.027200
250.0307200.057920
360.0409600.098880
470.0491520.148032
580.0550500.203082
690.0587200.261802
7100.0603980.322200
8110.0603980.382598
9120.0590560.441654
10130.0566940.498348
11140.0536010.551949
12150.0500280.601977
13160.0461790.648156
14170.0422210.690378
15180.0382810.728658
16190.0344530.763111
17200.0308050.793915
18210.0273820.821297
19220.0242110.845509
Parameter Sensitivity
p (%)Mean failuresStd DevP(X ≤ 10)
5%57.0033.762.45%
10%27.0016.4313.39%
20%12.007.7549.83%
30%7.004.8379.75%
40%4.503.3594.21%
50%3.002.4598.88%
60%2.001.8399.87%
70%1.291.3699.99%
80%0.750.97100.00%
90%0.330.61100.00%
Planning notes, formulas, and examples

About the Negative Binomial Distribution Calculator

The negative binomial distribution calculator computes the probability of observing exactly k failures before achieving r successes in a sequence of independent Bernoulli trials. While the binomial distribution fixes the number of trials and asks "how many successes?", the negative binomial fixes the number of successes and asks "how many failures (or trials) until we get there?"

This distribution appears in quality control (how many good items before r defectives?), sales (how many calls before r sales?), ecology (species abundance modeling), and genomics (RNA-seq count data). When r = 1, it reduces to the geometric distribution.

Enter the target number of successes (r), success probability (p), and desired failure count (k) to get point and cumulative probabilities, a full distribution chart and table, and sensitivity analysis across different success rates. Check the r = 1 case against the geometric distribution and confirm that total trials equal k + r.

When This Page Helps

The negative binomial distribution is essential for "waiting time" problems — when you need to know how many trials until achieving a target number of successes. It gives the complete probability landscape with visual tools, making it easy to reason about expected effort and variability.

Critical for bioinformaticians (RNA-seq), quality engineers (reliability testing), sales managers (pipeline modeling), and students studying discrete distributions.

How to Use the Inputs

  1. Enter r — the target number of successes you're waiting for.
  2. Enter p — the probability of success on each independent trial.
  3. Enter k — the number of failures for point probability P(X = k).
  4. Set k₁ and k₂ for interval probability calculation.
  5. Review the distribution chart, full table, and expected total trials.
  6. Explore the parameter sensitivity analysis to see how changing p affects results.
Formula used
P(X = k) = C(k+r−1, k) × p^r × (1−p)^k. Mean = r(1−p)/p. Variance = r(1−p)/p². Mode = ⌊(r−1)(1−p)/p⌋ for r > 1.

Example Calculation

Result: P(X = 10) ≈ 0.0805 (8.05%)

With r = 3 successes needed at p = 20% per trial, the probability of exactly 10 failures (13 total trials) before the 3rd success is about 8.05%.

Tips & Best Practices

  • When r = 1, the negative binomial becomes the geometric distribution: "How many failures before the first success?"
  • The expected total number of trials is r/p. For r = 3 and p = 0.2, expect 15 trials on average.
  • The negative binomial can model overdispersed count data (variance > mean), unlike the Poisson where variance = mean.
  • In RNA-seq analysis, the negative binomial handles biological variability that the Poisson cannot capture.
  • The PMF can be computed for non-integer r (using the Gamma function), giving the Pólya distribution used in Bayesian statistics.
  • As r → ∞ (with appropriate parameterization), the negative binomial converges to the Poisson distribution.

Overdispersion and Count Modeling

In ecology, the number of species in a sample often shows variance much greater than the mean — overdispersion. The negative binomial handles this by adding a "clumping" parameter. If individual counts follow Poisson(λ) and λ itself follows a Gamma distribution, the marginal distribution of counts is negative binomial.

Bayesian Interpretation

The negative binomial arises naturally as a Poisson-Gamma mixture. Starting with a Poisson likelihood and Gamma prior on the rate, the predictive distribution is negative binomial. This makes it fundamental in Bayesian count regression and hierarchical models.

Comparison with Alternative Models

For count data: Poisson (variance = mean), negative binomial (variance > mean), and COM-Poisson (flexible variance). The negative binomial sits in the "sweet spot" of handling overdispersion while remaining computationally tractable, making it the default choice in many applied fields.

Sources & Methodology

Last updated:

Frequently Asked Questions

  • Binomial: fixed n trials, random number of successes. Negative binomial: fixed r successes, random number of failures (or trials). They answer complementary questions.