Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Negative binomial distribution — f(x,k,p)
k = 4, p = 0.4
First row value = 0.0256
Mean failures μ = 6  |  Variance = 15
x (failures) f(x,k,p)
0 0.0256
1 0.06144
2 0.09216
3 0.110592
4 0.1161216
5 0.11147674
6 0.10032906
7 0.08599634
8 0.07094698
9 0.05675758
10 0.04427092
11 0.03380688
12 0.02535516
13 0.01872381
14 0.01364163
15 0.00982198
16 0.00699816
17 0.00493988
18 0.00345791
19 0.00240234

What is the negative binomial distribution?

The negative binomial distribution models the number of failures x that occur before the k-th success in a sequence of independent Bernoulli trials, where each trial succeeds with probability p. This calculator uses the "number of failures before the k-th success" parameterization, so the random variable takes values x = 0, 1, 2, ... It returns the probability mass f, the lower cumulative probability P, or the upper (survival) probability Q, and tabulates the chosen function over a range of x values.

Sequence of trials showing x failures occurring before the k-th success
The negative binomial counts the x failures that occur before the k-th success.

How to use it

Pick which function to evaluate: f (probability mass), P (lower cumulative), or Q (upper cumulative). Enter the required number of successes k (a positive integer), the per-trial success probability p (between 0 and 1), the starting x value, the step between rows, and how many rows to generate. The table lists each x and the corresponding probability; the mean and variance of the failure count are also shown.

The formula explained

The probability mass function is $$f(x,k,p) = \binom{x+k-1}{x}\,p^{k}\,(1-p)^{x}$$ where \(C\) is the binomial coefficient. The lower cumulative distribution is $$P(x,k,p) = \sum_{t=0}^{x} \binom{t+k-1}{t}\,p^{k}\,(1-p)^{t}$$ The upper cumulative (survival) function is $$Q(x,k,p) = 1 - \sum_{t=0}^{x-1} \binom{t+k-1}{t}\,p^{k}\,(1-p)^{t}$$ which equals the sum of \(f(t)\) for all \(t \ge x\). The mean number of failures is \(\frac{k(1-p)}{p}\) and the variance is \(\frac{k(1-p)}{p^{2}}\).

Advertisement
Right-skewed bar chart of negative binomial probability mass function
The PMF f(x) is right-skewed, peaking near the most likely number of failures.

Worked example

With \(k = 4\), \(p = 0.4\), find \(f(x=2)\): \(\binom{5}{2} = 10\), \(p^{4} = 0.0256\), \((0.6)^{2} = 0.36\), so $$f = 10 \times 0.0256 \times 0.36 = 0.09216$$ The lower cumulative $$P(2) = f(0)+f(1)+f(2) = 0.0256 + 0.06144 + 0.09216 = 0.1792$$ The survival $$Q(2) = 1 - P(1) = 1 - (0.0256 + 0.06144) = 0.91296$$

FAQ

Does x count successes or failures? Here x counts failures before the k-th success. Total trials would be x + k.

What if p = 1? No failures are possible, so \(f(0) = 1\) and \(f(x) = 0\) for \(x > 0\).

What if p = 0? The distribution is degenerate (infinitely many failures expected), and \(f(x) = 0\) for every finite x.

Last updated: