Negative Binomial PMF Calculator
The probability of exactly k failures before the r-th success, with success probability p.
What this page computes
Evaluates P(X = k) = C(k + r − 1, k)·p^r·(1 − p)^k: the chance that the r-th success is preceded by exactly k failures.
How to use it
Type the Required successes r, Success probability p, Failures k and press Run. r ≥ 1 is the required number of successes, 0 < p < 1 the success probability, and k ≥ 0 counts failures. The support starts at 0 because the r-th success may be immediate. With r = 5, p = 0.5, k = 3 failures, the page prints P(X = 3) = 0.136719.
Running it
C(k + r − 1, k)·p^r·(1 − p)^k, evaluated in logarithms so a large failure count stays finite. Every figure is computed in this browser tab: nothing is uploaded and nothing is stored.
Evaluates P(X = k) = C(k + r − 1, k)·p^r·(1 − p)^k: the chance that the r-th success is preceded by exactly k failures. With r = 5, p = 0.5, k = 3 failures, the page prints P(X = 3) = 0.136719.
C(k + r − 1, k)·p^r·(1 − p)^k, evaluated in logarithms so a large failure count stays finite. The printed result is accurate to log-gamma arithmetic, about 1e-14 relative for ordinary inputs; no table is read and nothing is simulated.
How to use this negative binomial distribution calculator
Type each value below and press Run. The page prints the point probability and the parameter line it used, so the answer can be checked against the formula rather than taken on trust.
The inputs this page reads are Required successes r (whole number, at least 1); Success probability p (strictly between 0 and 1); Failures k (whole number, at least 0).
The parameterisation
r ≥ 1 is the required number of successes, 0 < p < 1 the success probability, and k ≥ 0 counts failures. The support starts at 0 because the r-th success may be immediate.
The numeric method
C(k + r − 1, k)·p^r·(1 − p)^k, evaluated in logarithms so a large failure count stays finite.
The printed value is accurate to log-gamma arithmetic, about 1e-14 relative for ordinary inputs. The page returns the point probability only; it does not also print a test statistic, a p-value or a decision.
What to Expect
Best for
- the chance of a run of failures before a fixed success count
- over-dispersed count modelling
Not ideal for
- a cumulative probability, which is the negative binomial CDF page
- a fixed number of trials, which is binomial
What this tool keeps
- Double-precision arithmetic in your own browser
- The same inputs always produce the same output
Common errors
- r must be a whole number of at least 1, p strictly between 0 and 1, and k a whole number of at least 0.
Example use cases
- quality runs to a success quota
- insurance claim counts
Sample input
r = 5, p = 0.5, k = 3 failures.
Sample output
P(X = 3) = 0.136719.
Who this is for
- students
- actuarial analysts
Frequently asked questions
Which parameterisation does this page use?
r ≥ 1 is the required number of successes, 0 < p < 1 the success probability, and k ≥ 0 counts failures. The support starts at 0 because the r-th success may be immediate.
How is the result computed?
C(k + r − 1, k)·p^r·(1 − p)^k, evaluated in logarithms so a large failure count stays finite. The result is accurate to log-gamma arithmetic, about 1e-14 relative for ordinary inputs.
What inputs are refused?
r must be a whole number of at least 1, p strictly between 0 and 1, and k a whole number of at least 0.
Is anything uploaded?
No. Every number is computed by JavaScript in this page from the values you typed; nothing is posted, stored or logged.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.