[Math] How to estimate failure probability from count until first failure

estimation-theoryprobabilitystatistics

What would be the formula to estimate the rate of failure of some test as a percentage chance of failure from the number of runs of the test until the first failure was seen?

For example, considering 0 to mean failure and 1 to mean success, the following are possible samples from which each should have an estimated failure rate:

0 (failed on first try, I would estimate failure rate to be 100%)

11110 (failed on fifth try, so answer is something less than around 20% failure rate)

1111111110 (failed on tenth try, so answer is something less than around 10% failure rate)

Working the other way around, imagine the answer was a 10% failure rate. On average, what test will the first failure be seen at? Perhaps it is $(9/10)^n$ < 5/10? What value of n do we reach a 50% chance of failure? Five tries is 59% chance of success, six tries 53%, and seven tries is 48%. Therefore, on average I think we will fail most likely on the seventh trial. So what would be formula to work backwards from 7 to get ~10%?

So what would the answer be?

(1 minus the nth root of .5) where n is the first trial to fail

Best Answer

If I understand correctly, what you have is a geometric distribution in your experiment. So what you're looking for might be the maximum likelihood parameter estimation (taken from http://en.wikipedia.org/wiki/Geometric_distribution):

$$ \hat p = (\frac{1}{n} \sum_{i=1}^{n} k_i)^{-1}$$

You get the $k_i$'s if you do your experiment n times, $k_i$ being the number of times until your test fails. So $\hat p$ is just one over the average number of trials until your test fails.