Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a continuous random variable $X$ (positive). I want to simulate its distribution with a discrete distribution and calculate $E[X]$ from that discrete distribution. So, the obvious approach is to divide the range of the random variable into step size of $h$. Let the CDF values at the points $0, h, 2h, \ldots$ be $P_0, P_1, P_2, \ldots$.

So, $\mathrm{Prob}(0 < X \leq h) =P_1-P_0$, $\mathrm{Prob}(h < X \leq 2h) = P_2-P_1$; and so on.

Now these probability masses are associated with a interval. We need to find a representative point of each interval. For an interval $(a,b]$ which point should we take as the representative point leftmost point, rightmost point or the mid point to get a good estimate of $E[X]$. This is my question.

share|cite|improve this question
I assume the interval is finite, say $[a,b]. We want to approximate $\int_a^b xf(x)\,dx$. If we have access to the density, any good numerical integration procedure will work, preferably a good quality program rather than your own implementation of, say, Simpson's Rule. – André Nicolas Oct 28 '11 at 5:19
No, I don't have access to the density, I only have access to the CDF values at discrete points – aaaaaa Oct 28 '11 at 8:28
up vote 1 down vote accepted

It's not very clear if to "calculate $E[X]$" means to estimate it from an estimation of the density (which is in turn approximated by a discrete density?). Anyway, mere intuition tells that if we discretized uniformly the variable domain, and if no more knowledge is assumed, the "representative point" should be taken as the middle point (not only for the computation of the mean). In this case, this strategy could be justified by comparing the true mean $$\mu_x = \int x f_x(x) dx = \sum_k \int_{k h}^{(k+1)h} x f_x(x) dx$$

with the "discretized mean" $$ \mu'_x = \sum_k x_k p_k $$

where $x_k$ is the "representative point", and we assume that $p_k$, the discrete probability function, equals the probability that $x$ fall in the respective interval $p_k = \int_{k h}^{(k+1)h} f_x(x) dx$. Then, as we want that $\mu'_x \to \mu_x$, we'd want

$$\int_a^b (x_k-x)f_x(x) dx $$

to be zero inside each interval. If we assume that the interval is small, so that we can approximate $f_x(x)$ by a constant, we get $x_k=(a+b)/2$ , i.e., the interval midpoint. More in general, the optimal $x_k$ is given by the conditional expectation of $x$, conditioned that $x$ falls inside the respective interval.

share|cite|improve this answer
Thanks for your reply. I have understood your solution of taking the midpoint of an interval as its representative point. But how should we choose a h value given an error bound "epsilon" on the expected value. Is there any standard method? – aaaaaa Oct 29 '11 at 9:42
What about starting with some step size h and then h/2,h/4 etc until we cross the error bound – aaaaaa Oct 29 '11 at 10:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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