Library / Probability distributions / PRD-46
Probability distributions
Failures before a target: expected number
Expected number of failures before the rth success: r times the odds of failing, (1 − p)/p.
- Ref
- PRD-46
- Rev
- v1
- Field
- Probability distributions
- Result
- E[X]
The expected number of failures before the rth success is r(1 − p)/p: r times the odds of failing on a single trial. Add r to get the expected total number of trials, r/p.
Expected number of failures before the rth success: r times the odds of failing, (1 − p)/p.
Calculator
- Expected total trials, r/p7.5
- Odds of failing on one trial, (1 − p)/p1.5
- Standard deviation of the failures3.354
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.
- At a 40 % success rate, reaching 3 successes takes about 4.5 failures first, 7.5 trials in all.
- Halving the success probability roughly doubles the failures: the effect is steep when p is small.
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 | 0.1579 | 57 | 56.84 | +10% | −15.2 % |
| r Target number of successes r | 1 to 10 | 1.5 | 15 | 13.5 | +1 | +33.3 % |
Sweep of Success probability p
| Success probability p | Expected failures |
|---|---|
| 0.05 | 57 |
| 0.1625 | 15.46 |
| 0.275 | 7.909 |
| 0.3875 | 4.742 |
| 0.5 | 3 |
| 0.6125 | 1.898 |
| 0.725 | 1.138 |
| 0.8375 | 0.5821 |
| 0.95 | 0.1579 |
Sweep one variable
Variables and how each one contributes
Expected 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 4.5 to 6.
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 −18.5 %, from 4.5 to 3.667.
Worked example with the values above
- Odds of failing: (1 − p)/p = 0.6 / 0.4 = 1.5.
- Multiply by r = 3.
- E[X] = 4.5 failures.
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
A mean, variance or percentile is calculated from fitted parameters, and the uncertainty in those parameters passes straight through. A distribution fitted to a small sample can have parameters that are far from the truth, especially in the tails and for the variance, so quote the result together with the sample size it rests on.
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