Negative Binomial Distribution Calculator

Distribution Parameters

Required number of successes (positive integer)
Probability of success on a single trial (0 < p ≤ 1)

Calculation Type

Calculate P(X = k), the probability of needing exactly k trials to get r successes

Display Options

Negative Binomial Distribution Visualization

r = 3, p = 0.4

Probability Table

k P(X = k) P(X ≤ k)

Negative Binomial Distribution Overview

The negative binomial distribution models the number of trials needed to achieve a specified number of successes in a sequence of independent Bernoulli trials, each with the same probability of success.

Probability Mass Function (PMF)

\[ P(X = k) = \binom{k-1}{r-1} p^r (1-p)^{k-r} \]

where r is the number of successes, p is the probability of success on each trial, and k is the number of trials (k ≥ r).

Cumulative Distribution Function (CDF)

\[ P(X \leq k) = \sum_{i=r}^{k} \binom{i-1}{r-1} p^r (1-p)^{i-r} \]

Expected Value

\[ E[X] = \frac{r}{p} \]

Variance

\[ Var(X) = \frac{r(1-p)}{p^2} \]

Key Properties

  • The distribution is always positively skewed (right-tailed)
  • When r = 1, the negative binomial distribution reduces to the geometric distribution
  • The sum of independent negative binomial random variables with the same p is also negative binomial
  • As r increases, the distribution approaches normality
  • Skewness = (2-p)/√(r(1-p)) and Kurtosis = 3 + 6/r + p²/(r(1-p))

Understanding the Negative Binomial Distribution

Definition & Characteristics

The negative binomial distribution models the number of trials needed to achieve a specified number of successes (r) in a sequence of independent Bernoulli trials, where each trial has the same probability of success (p).

Requirements for a Negative Binomial Distribution

  1. Fixed number of successes: The experiment continues until a specified number of successes (r) is achieved.
  2. Independence: Each trial is independent of all other trials.
  3. Binary outcomes: Each trial has exactly two possible outcomes: "success" or "failure".
  4. Constant probability: The probability of success p is the same for each trial.

Mathematical Formulation

A random variable X follows a negative binomial distribution with parameters r and p, written as X ~ NB(r, p), if:

  • X represents the number of trials needed to achieve r successes
  • The probability of success in any single trial is p
  • All trials are independent of each other
  • The probability mass function is: \[ P(X = k) = \binom{k-1}{r-1} p^r (1-p)^{k-r} \] for k = r, r+1, r+2, ...

Relationship with Geometric Distribution

The negative binomial distribution is a generalization of the geometric distribution:

  • When r = 1, the negative binomial distribution becomes the geometric distribution
  • The negative binomial can be viewed as the sum of r independent geometric random variables

Properties & Applications

Key Properties

Expected Value (Mean)
E[X] = r/p
The average number of trials needed to achieve r successes
Variance
Var(X) = r(1-p)/p²
Measures the spread or dispersion of the distribution
Standard Deviation
σ = √(r(1-p)/p²)
Typical deviation from the mean
Skewness
(2-p)/√(r(1-p))
Always positive, indicating right-skewed distribution

Alternative Parameterizations

The negative binomial distribution can also be parameterized in terms of the number of failures before the rth success (Y = X - r), giving:

\[ P(Y = y) = \binom{y+r-1}{y} p^r (1-p)^y \]

This parameterization is sometimes preferred in certain applications.

Normal Approximation

For large values of r, the negative binomial distribution can be approximated by a normal distribution with mean r/p and variance r(1-p)/p².

Real-World Applications

  • Quality Control: Number of items inspected until finding a certain number of defects
  • Epidemiology: Modeling disease outbreaks and transmission
  • Sports Analytics: Number of at-bats until a baseball player gets a certain number of hits
  • Marketing: Number of sales calls needed to achieve a target number of successful sales
  • Risk Management: Modeling claim frequencies in insurance
  • Reliability Theory: Number of components tested until finding a specified number of failures

Example Problems

Example 1: Sales Calls

A salesperson has a 30% success rate on sales calls. What is the probability that exactly 8 calls are needed to make 3 sales?

This is a negative binomial distribution problem where:

  • r = 3 (number of successes needed)
  • p = 0.3 (probability of success on a single call)
  • k = 8 (total number of calls)
\begin{align} P(X = 8) &= \binom{8-1}{3-1} p^3 (1-p)^{8-3} \\ &= \binom{7}{2} (0.3)^3 (0.7)^5 \\ &= 21 \times 0.027 \times 0.16807 \\ &= 21 \times 0.004538 \\ &= 0.0953 \end{align}

The probability that exactly 8 calls are needed to make 3 sales is approximately 0.0953 or 9.53%.

Example 2: Testing Components

An engineer tests electronic components until finding 4 defective ones. Each component has a 15% chance of being defective. What is the probability that the engineer needs to test at most 30 components?

This is a negative binomial distribution problem where:

  • r = 4 (number of defective components needed)
  • p = 0.15 (probability of a component being defective)
  • We want P(X ≤ 30), the probability of finding 4 defective components within 30 tests

Using the negative binomial CDF:

\begin{align} P(X \leq 30) &= \sum_{k=4}^{30} \binom{k-1}{4-1} (0.15)^4 (0.85)^{k-4} \end{align}

This sum is complex to calculate by hand, but using computational methods:

\begin{align} P(X \leq 30) &= 0.9322 \end{align}

The probability that the engineer needs to test at most 30 components to find 4 defective ones is approximately 0.9322 or 93.22%.

Example 3: Expected Number of Trials

A basketball player has a 40% free-throw success rate. On average, how many free throws must the player attempt to make 5 successful shots?

This is a negative binomial distribution problem where:

  • r = 5 (number of successful free throws needed)
  • p = 0.4 (probability of making a free throw)
  • We want E[X], the expected number of attempts needed
\begin{align} E[X] &= \frac{r}{p} \\ &= \frac{5}{0.4} \\ &= 12.5 \end{align}

On average, the player will need to attempt 12.5 free throws to make 5 successful shots.

Example 4: Variance Calculation

In a manufacturing process, each item has a 20% chance of requiring rework. What is the variance in the number of items that need to be inspected to find 10 items requiring rework?

This is a negative binomial distribution problem where:

  • r = 10 (number of items requiring rework)
  • p = 0.2 (probability an item requires rework)
  • We want Var(X), the variance in the number of items inspected
\begin{align} Var(X) &= \frac{r(1-p)}{p^2} \\ &= \frac{10 \times (1-0.2)}{0.2^2} \\ &= \frac{10 \times 0.8}{0.04} \\ &= \frac{8}{0.04} \\ &= 200 \end{align}

The variance in the number of items that need to be inspected is 200, which means the standard deviation is √200 = 14.14 items.

Test Your Knowledge

Quick Quiz: Negative Binomial Distribution

1. A customer service representative resolves customer issues with a 25% success rate on the first attempt. What is the probability that exactly 12 attempts are needed to resolve 4 customer issues?

A. 0.0562
B. 0.0785
C. 0.0827
D. 0.0918

2. If r = 5 and p = 0.2, what is the expected number of trials needed to achieve 5 successes?

A. 1
B. 5
C. 20
D. 25

3. Which of the following is true about the negative binomial distribution?

A. It is always symmetric around the mean
B. When r = 1, it becomes the geometric distribution
C. The variance is always less than the mean
D. It only applies when p > 0.5