Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Negative Binomial Distribution Explorer


Modify Parameters and See Results

Number of trials until r successes

Parameters

Target Successes (r)
5

The number of successes we are waiting to achieve

Success Probability (p)
0.30

The probability of success on each trial

Failure Probability (q = 1-p)
0.70

The probability of failure on each trial

Expected Trials (E[X])
16.67

Average number of trials needed to get 5 successes

Statistics

Expected Value
16.6667
Variance
38.8889
Std Deviation
6.2361
Mode
14

Probability Calculator

Key Properties

Real-World Applications

  • Number of coin flips until getting 5 heads
  • Number of sales calls until closing 3 deals
  • Number of product inspections until finding 10 defects
  • Number of free throw attempts until making 20 baskets
  • Number of patients treated until 8 successful recoveries







Setting Distribution Parameters

Adjust r (number of successes) to specify how many successes you're waiting to achieve. The slider ranges from 1 (equivalent to geometric distribution) to 20 successes, covering typical application scenarios.

Set p (success probability) using the bottom slider from 0.01 to 0.99. This defines the likelihood of success on each individual trial, with higher p meaning you'll reach r successes more quickly.

The visualization updates immediately to show how these parameters affect the distribution shape. Higher r values create more bell-shaped distributions, while r = 1 gives the characteristic geometric decay.

Understanding the PMF Display

The PMF bars start at k = r (the minimum possible trial number) since you need at least r trials to get r successes. Each bar shows P(X = k), the probability that the rth success occurs exactly on trial k.

The distribution's shape depends heavily on r. For r = 1, you see pure exponential decay. As r increases, the distribution becomes more symmetric and bell-shaped, eventually approximating a normal distribution for large r.

The mode (peak) occurs near r/p, which also represents the mean. This is where the rth success is most likely to occur, balancing the competing effects of needing more trials versus decreasing probability of longer sequences.

Interpreting CDF Values

The CDF shows P(X ≤ k), the probability that you achieve r successes within the first k trials. The curve starts at 0 for k < r and approaches 1 as k increases.

The steepness of the CDF curve around the mean indicates concentration. A steep curve means most probability mass is concentrated near the expected value r/p, while a gradual curve indicates higher variability.

Unlike the binomial CDF which always reaches exactly 1 at n trials, the negative binomial CDF approaches 1 asymptotically since theoretically you could need infinitely many trials (though this becomes vanishingly unlikely).

Calculating Point Probabilities

Enter trial number k in the Point Probability calculator to compute P(X = k) using the negative binomial formula: C(k-1, r-1) × p^r × (1-p)^(k-r).

The binomial coefficient C(k-1, r-1) counts ways to arrange r-1 successes in the first k-1 trials (the rth success must occur on trial k). The calculator handles this computation even for large values.

Try k = 10, r = 3, p = 0.4. This calculates the probability that your 3rd success occurs exactly on the 10th trial - meaning exactly 2 successes in the first 9 trials, followed by a success on trial 10.

Using Cumulative Calculators

The P(X ≤ k) calculator sums probabilities from r to k, giving the probability of achieving r successes within k trials. This is useful for questions like "What's the chance I'll close 5 sales within 20 calls?"

P(X ≥ k) computes the probability of needing at least k trials, which equals 1 - P(X ≤ k-1). This helps assess risk: "What's the probability I'll need 30 or more trials to get 10 successes?"

The distinction between ≤ and < (or ≥ and >) matters for discrete distributions. P(X < k) excludes k itself and equals P(X ≤ k-1).

Computing Range Probabilities

Range calculations find P(a ≤ X ≤ b) by computing F(b) - F(a-1), where F is the CDF. This gives the probability that the rth success occurs between trials a and b.

The four boundary options provide flexibility:
[a, b] includes both a and b
(a, b) excludes both endpoints
[a, b) includes a but excludes b
(a, b] excludes a but includes b

Example: With r = 5, what's P(15 ≤ X ≤ 25)? This is the probability that your 5th success occurs somewhere between trial 15 and trial 25.

What is the Negative Binomial Distribution?

The negative binomial distribution models the number of trials needed to achieve a fixed number r of successes in a sequence of independent Bernoulli trials. It generalizes the geometric distribution from r = 1 to any positive integer r.

The "negative" terminology comes from an equivalent formulation counting failures before the rth success, but the standard parameterization counts total trials. Each trial has constant success probability p and is independent of all others.

Applications include epidemiology (cases until r infections), insurance (claims until r payouts), and ecology (samples until r species observed). For comprehensive theory, see negative binomial distribution theory page.

Relationship to Geometric Distribution

The geometric distribution is the special case where r = 1. When you only need one success, the negative binomial reduces exactly to the geometric distribution.

For r > 1, the negative binomial can be viewed as the sum of r independent geometric random variables. If X1,X2,...,XrX_1, X_2, ..., X_r are geometric(p), then X1+X2+...+XrX_1 + X_2 + ... + X_r follows a negative binomial distribution.

This connection explains why both distributions share certain properties and why the negative binomial approaches a normal distribution as r increases - it's a sum of independent random variables, invoking the Central Limit Theorem.

Distribution Statistics and Properties

The mean E[X] = r/p represents the expected number of trials to achieve r successes. With r = 5 and p = 0.25, expect 20 trials on average.

The variance equals r(1-p)/p², which grows faster than the mean as p decreases. This variance > mean property distinguishes negative binomial from Poisson and makes it useful for overdispersed count data.

The standard deviation r(1p)/p2\sqrt{r(1-p)/p²} measures typical deviation from the mean. When r is large, the distribution becomes approximately normal with these parameters.

Related Distributions and Tools

The binomial distribution fixes trials and counts successes, while negative binomial fixes successes and counts trials. They're complementary approaches to modeling binary outcomes.

The Poisson distribution assumes mean equals variance, but negative binomial allows variance > mean (overdispersion). This makes negative binomial more flexible for real-world count data with extra variability.

Related Calculators:

Geometric Distribution Calculator - Special case where r = 1

Binomial Distribution Calculator - Fixed trials, variable successes

Poisson Distribution Calculator - Rare events with equidispersion

Probability Distribution Comparison - When to use each distribution