Library / Probability distributions / PRD-45
Probability distributions
Failures before a target: exact probability
Probability of exactly x failures before the rth success in independent trials that each succeed with probability p.
- Ref
- PRD-45
- Rev
- v1
- Field
- Probability distributions
- Result
- P
The probability of exactly x failures before the rth success is C(x + r − 1, x) p^r (1 − p)^x. The count x is of failures only; the total number of trials is x + r. This is the negative binomial distribution, a count model that is more spread out than a Poisson count of the same mean.
Probability of exactly x failures before the rth success in independent trials that each succeed with probability p.
Calculator
- Expected failures, r(1 − p)/p4.5
- Total trials for these failures, x + r5
- Probability of no failures, p^r0.064
What drives the result
Each variable is moved across its typical range while the others stay at the values above. The longest bar is the key driver.
- The chance of exactly 2 failures before 3 successes at p = 0.4 is 13.8 %.
- That sequence takes 5 trials in total, against an average of 7.5.
Chart data as tables
Ranked variables
| Variable | Typical range | Lowest result | Highest result | Swing () | Local step | Change in result |
|---|---|---|---|---|---|---|
| p Success probability p | 0.05 to 0.95 | 6.769e-4 | 0.2071 | 0.2065 | +10% | +15.9 % |
| r Target number of successes r | 1 to 10 | 0.002076 | 0.144 | 0.1419 | +1 | −33.3 % |
| x Failures x | 0 to 20 | 5.405e-4 | 0.1382 | 0.1377 | +1 | −2.22e-14 % |
Sweep of Failures x
| Failures x | Probability of exactly x failures |
|---|---|
| 0 | 0.064 |
| 2.5 | 0.1405 |
| 5 | 0.1045 |
| 7.5 | 0.05603 |
| 10 | 0.02554 |
| 12.5 | 0.01056 |
| 15 | 0.004092 |
| 17.5 | 0.001514 |
| 20 | 5.405e-4 |
Sweep one variable
Variables and how each one contributes
Probability of exactly x failures
What the equation gives you. Everything else feeds it.
Target number of successes r
The target number of successes (a whole number, at least 1). A larger target needs more failures along the way on average. Raising it by 1 (to 4) moves the result by −33.3 %, from 0.1382 to 0.09216.
Success probability p
The probability of success on each trial (0 to 1). Trials are independent. A higher success probability cuts the number of failures sharply. Raising it by 0.05 (to 0.45) moves the result by +19.6 %, from 0.1382 to 0.1654.
Failures x
The number of failures before the target is reached (a whole number, 0 or more). Moves the failure count at which the probability is read. Raising it by 1 (to 3) moves the result by −2.22×10−14 %, from 0.1382 to 0.1382.
Worked example with the values above
- Ways to arrange the failures among the first x + r − 1 trials: C(4, 2) = 6.
- Probability factors: p^r = 0.064 and (1 − p)^x = 0.36.
- P = 0.13824.
Assumptions and limits
- Independent trials with the same success probability p, run until the rth success.
- r is a whole number and 0 < p < 1.
Common mistakes
- Forgetting that x counts failures only: the total number of trials is x + r.
- Assuming a constant p when it drifts, for example when attempts improve with practice.
- Using a Poisson model for counts that are more spread out than their mean.
Statistics and uncertainty
The inputs are parameters, usually fitted to data, and their estimation error carries into the result. The probability or density is a smooth function of the parameters, so the sweep chart shows how sensitive it is: where the curve is steep, a small error in a parameter makes a large difference. The formula treats the parameters as exact, so it gives no confidence interval on its own.
Where it is used
- Counting failed attempts before a target number of passes in testing.
- Overdispersed count data, where the variance exceeds the mean.
Maths you need
- Combinations: ways of choosing items, C(n, k)
- Independent trials: each outcome unaffected by the others