# Compute expectation from empirical CDF

I have a empirical cumulative probability distribution function for a random variable. The random variable is "time to failure". I want to know Mean Time To Failure i.e expectation of that random variable. Is there any standard method to find mean from an empirical distribution.

I am getting the empirical CDF (as discrete values) as output from a "model checking tool" which uses iterative numerical computation techniques to get those probabilities. For example, let F(t)=P(X<=t) is the CDF of the random variable X where X stands for time between failure. To plot the curve of "F(t) vs t" I am varying t with some step size, calculating F(t) for that t using the "model checking tool" and adding the points to get the curve. I can use small step size to get the more accurate curve. So, I have access to only this CDF values at different t. From this values I want to do a good estimate of mean value of X.

Now the parameters to do a good estimate will be:

1) T, the maximum value of t. We need to find this with some precision i.e if F(T1)-F(T2) is less than some epsilon we set T=T1.

2) Once we have found T we need to find suitable step size h at which we will be calculating the CDF values.

3) Suppose for t=h,2h,....,nh (where nh=T) we get the corresponding cumulative probability values from the model checking tool as P1, P2,.....,Pn then

Prob(0

a) For each interval (a,b] select the leftmost point as the representative of the interval So, E[X]=0.P1+h.(P2-P1)+2h.(P3-P2)+......+(n-1)h(Pn-Pn-1) b) For each interval (a,b] select the rightmost point as the representative of the interval So, E[X]=h.P1+2h.(P2-P1)+........+nh(Pn-Pn-1)

How should I choose those parameters?

For a non-negative random variable $X$ whose expectation exists, $$E(X) = \int_0^\infty \mathrm{Pr}(X>t) dt.$$ In the case of a non-negative integer random variable, this reduces to $$E(X) = \sum_{i=1}^\infty ~\mathrm{Pr}(X\ge i),$$ which has a very easy proof.