# How to estimate failure probability from count until first failure?

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

-

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.

-
Sorry I'm a noob, so if the data is 1001, it would be p=(1/4 (1+0+0+1))^-1, thus p = 2? Am I correct? – john mossel May 19 '11 at 19:37
@john: No, 1001 isn't a valid sequence. You stop when you get 0. – Rudy the Reindeer May 19 '11 at 21:20

You could probably use the Nelson-Aelen estimator.

-
That seems close, however, I only have one input stream and that formula calls for two input streams. – WilliamKF Jan 15 '11 at 22:03

I found the answer is 1/n as explained in section 3.1 over here: