# Simulating continuous distribution using discrete distribution

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,Nh$ be $P_0,P_1,P_2,\ldots,P_N$.

Thus, $\text{Prob}(0 < X \leq h)=P_1-P_0$, $\text{Prob}(h < X \leq 2h)=P2-P1$ and so on.

Now these probability masses are associated with a interval. We need to find a representative point of each interval, and here lays my problem.
For an interval $(a,b]$ which point should we take as the representative point? Leftmost point, rightmost point, the mid point?

Basically, given the following relation F'(t)=P(X<=t)=$1-(1-F(t))^{n}$ I need to find the expectation of X i.e E[X] where F(t) is CDF of some other random variable Y. The expression for F(t) is not known to me. I have only access to a black box that gives me a value of F(t) as output when I give a value of t as input. That's why the question of "approximating" the continuous distribution with a discrete distribution comes.

Another question is how to choose an appropriate h value (step size) given an error bound "epsilon" on the expected value. Is there any standard method already?

• Simulating seems to be the wrong word here. Approximating seems more appropriate. – cardinal Oct 28 '11 at 12:08
• What is the purpose of the intended approximation? The optimal solution may depend on the purpose. Moreover, it is rare that this form of approximation will be superior, either in terms of accuracy or computational efficiency, to methods of generating the continuous distribution itself, suggesting the intended use is unusual indeed. – whuber Oct 28 '11 at 14:17
• @whuber: Thanks for the reply. I have edited the question to make things clear. – aaaaaa Oct 29 '11 at 5:03

## 1 Answer

Thinking of extreme scenarios can be helpful. Say you use only one interval- you realize that extreme points make no sense. If you use the expectancy of each interval (under the continuous distribution), the law of total expectation will guarantee you have the right expectation. The midpoints are the solution if they are indeed the expectancy conditioning on the interval (such as uniform or symmetric distribution). [edited after @cardinal's and @whuber's comments]

• You should really reconsider your last statement. particularly the only if part. – cardinal Oct 28 '11 at 12:18
• @cardinal: true. Changed answer accordingly. – JohnRos Oct 28 '11 at 13:14
• It's hard to say what the midpoints are the "solution" to, given that we haven't any objective function to optimize. For instance, if the purpose is to reproduce the second moment of the distribution, then it's usually not the case that midpoints are best. – whuber Oct 28 '11 at 14:19
• @whuber: but the question specifically deals with the first moment. – JohnRos Oct 28 '11 at 17:11
• @whuber: The "only of" relates to the distributions for which the mid-points are the solution. You are right that there is indeed freedom in choosing the representative points, and there might be points which are not the conditional expectancy which will return the right answer. Anyhow, since the "only if" is immaterial to the answer, I will remove it. – JohnRos Oct 29 '11 at 16:56