Connect via MCP →

Enter Calculation

Formula

Formula: Negative Binomial Mean and Variance Calculator

Advertisement

Results

Mean (expected failures before r successes)
5
μ = r(1 − p) / p
Successes (r) 5
Success probability (p) 0.5
Variance (σ²) 10
Standard deviation (σ) 3.1623

What this calculator does

The Negative Binomial Mean and Variance Calculator returns the first two moments of a negative binomial distribution. In the standard "failures-before-successes" parameterization, the random variable X counts the number of failures that occur before the r-th success in a sequence of independent Bernoulli trials, where each trial succeeds with probability p. Enter r and p, and the tool reports the mean, the variance, and the standard deviation of X.

How it works

Each trial is an independent success-or-failure experiment with a constant success probability p. You keep sampling until you have accumulated r successes; X is the number of failures observed along the way. Because X can be written as the sum of r independent geometric variables, each counting the failures before a single success, its mean and variance are exactly r times the mean and variance of one geometric term. This yields closed-form expressions that depend only on r and p.

Formula

Advertisement

The mean, variance, and standard deviation of X are:

$$\mu = \frac{r(1-p)}{p}$$ $$\sigma^2 = \frac{r(1-p)}{p^2}$$ $$\sigma = \sqrt{r(1-p)}\,/\,p$$

Here r is the target number of successes and p is the per-trial success probability, with 0 < p <= 1. Note that the variance is always larger than the mean by a factor of 1/p, so the negative binomial is over-dispersed relative to the Poisson.

Worked example

Suppose you need r = 5 successes and each trial succeeds with probability p = 0.5. The mean number of failures before the 5th success is 5(1 - 0.5)/0.5 = 5. The variance is 5(1 - 0.5)/0.5^2 = 2.5/0.25 = 10, so the standard deviation is sqrt(10) which is about 3.16. On average you expect roughly 5 failures, with a typical spread of about 3 failures around that mean.

FAQ

Advertisement

Which negative binomial parameterization does this use? It uses the standard "number of failures before the r-th success" convention, so the mean is r(1-p)/p. If your textbook counts total trials instead of failures, add r to the mean to convert between conventions.

Does r have to be a whole number? For the classic counting interpretation r is a positive integer, but the mean and variance formulas remain valid for any real r > 0, which is the case in the generalized (Polya) negative binomial distribution.

What happens as p approaches 1? When p is close to 1 almost every trial succeeds, so there are almost no failures and both the mean and the variance approach 0. As p gets small, failures accumulate and both moments grow rapidly.

Last updated: