Mirror thread on Math.SE

I have a empirical cumulative probability distribution function for a random variable. The random variable is "time to failure" and I have the full curve i.e till the probability reaches 1. 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(x)=P(X<=t) is the CDF of the random variable X where X stands for time between failure. To plot the curve of F(X) vs t I am varying t with some step size, calculating F(X) 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.

  • 2
    $\begingroup$ It is considered somewhat impolite to simultaneously post (or nearly so, in your case) the same question in multiple forums. See the various meta sites for more details. Crosspost: math.stackexchange.com/questions/61460/… $\endgroup$
    – cardinal
    Sep 3, 2011 at 4:18
  • 1
    $\begingroup$ well, it's a fact that $E(X) = \int_{0}^{\infty} \big(1-F(x) \big) dx$ for a non-negative random variable $X$ with cdf $F$. Perhaps you can use this fact while invoking the convergence of the empirical cdf to the true one to get an estimate. $\endgroup$
    – Macro
    Sep 3, 2011 at 4:25
  • $\begingroup$ @cardinal: Sorry for posting it twice. Actually, someone in math exchange has suggested me to post in stats.stackexchange as it is relevant to statistics $\endgroup$ Sep 3, 2011 at 4:40
  • $\begingroup$ You've received pretty explicit answers there, including the one that @Macro lists. Where do your remaining doubts lie? $\endgroup$
    – cardinal
    Sep 3, 2011 at 4:49
  • $\begingroup$ Let's resolve it this way -- please edit the Q to express your remaining doubts or it will be closed. $\endgroup$
    – user88
    Sep 3, 2011 at 11:26

1 Answer 1


I know this is an older question, but others may find the answer helpful.

Given the empirical CDF, $F_n(x)$, call the percent points of the CDF $\alpha$ (which range from $0$ to $1$) and their corresponding values VaR$_\alpha$ (Value at Risk). VaR$_\alpha$ is simply $F_n^{-1}(\alpha)$ You can use the fact that: $$ E(X) = \int_0^1 VaR_\alpha\;d\alpha $$

This is actually the dual of the relationship @Macro stated, however, instead of adding up vertical slices across the x-axis from $F(x)$ to $1$, you are adding horizontal slices from the y-axis to F(x) up to $y=1$. It is the same area.

To actually do the integration, I'd recommend the trapezoid rule, so given $n$ entries in the CDF we have: $$ E(X) \approx \sum_{k=0}^{n-1} \frac{VaR_{k+1} + VaR_{k}}{2}\cdot\left(\alpha_{k+1}-\alpha_{k}\right) $$

  • 2
    $\begingroup$ Given you're on a stats site, you should probably use a more conventionally-statistical term in place of VaR. At the very least, you should define it -- I don't imagine the average psych- or bio- or medical- stats person has encountered VaR. Outside of places like banking/finance and insurance, it's pretty rare to encounter it -- and even within banking vs insurance, there can be differences in how it's looked at. $\endgroup$
    – Glen_b
    Sep 5, 2013 at 2:32
  • 1
    $\begingroup$ @Glen_b that is an excellent point, thank you, and I have edited the answer to provide a more well-known definition. As someone who deals in insurance math, I appreciate that I may be guilty of thinking it its terms, which can be different from more generalized statistical terms. $\endgroup$
    – Avraham
    Sep 8, 2013 at 13:39
  • 2
    $\begingroup$ Beyond @Glen_b's point about VaR, percentiles are values of $X$, not the associated cumulative probabilities. For example, $\alpha = 0.5$ defines the median, but the median is the percentile, not $\alpha$. Some people say percent points, which may be where you are getting confused. $\endgroup$
    – Nick Cox
    Sep 8, 2013 at 23:43
  • $\begingroup$ Much obliged for the clarification of terminology. $\endgroup$
    – Avraham
    Sep 9, 2013 at 3:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.