Hi, I have a dataset where I have Cumulative probability distribution of discrete values. I want to convert this to a Prob. Distribution function which I can further use for sampling. Can someone guide me regarding this.

Thanks

asked Feb 02 at 14:58

gaurav's gravatar image

gaurav
1111


3 Answers:

I am assuming that you really have the discrete CDF - F(x_i) - and not the discrete PDF. A discrete CDF is defined on a series of 'n' partitions of the interval (0,1): [0,F(x1) ], [F(x1), F(x2)], [F(x2), F(x3) ] .... [F(x{n-1}, 1] . Sampling from this discrete CDF is just a matter of choosing a value y ~Uniform(0,1) and determining which partition the value y falls into.

To sample from the discrete PDF: p(x1), p(x2), ...., p(xn) where Sum[p(xi)] = 1, partition into subintervals [0,p1], [p1, p1+p2], [p1+p2, p1+p2+p3],... [ etc. , 1]. Then generate a value of y ~Uniform(0,1) and determining which X_i partition the value y falls into.

The length of the partitions in the first paragraph correspond to the discrete PDF in the second paragraph, which I think is what Andreas was getting at, i.e. p1=F(x1), p1+p2 = F(x2), etc.

answered Feb 02 at 18:01

Aengus%20Robinson's gravatar image

Aengus Robinson
21551114

oh yeah that is obviously the discrete analogon to what I wrote below...

(Feb 02 at 18:02) Andreas Mueller

Disregard my previous comment. To get the distribution, simply "derive" the CDF. So if you have a discrete CDF c_1, ... c_n, the distribution is given by c_1, c_2 - c_1, ... c_n - c_(n-1).

answered Feb 02 at 15:47

Andreas%20Mueller's gravatar image

Andreas Mueller
1817133671

edited Feb 02 at 15:48

I you have the CDF, that might be even better to sample from the distribution. At least if you can invert it. Just sample a random uniform variable from [0, 1] and map it through the in inverse of the CDF. What you get will be distributed according to your distribution. See wikipedia. [edit]Err. I forgot a bit the part about "discrete". Sorry. That applies obviously only to continuous variables :-/ [edit]

This answer is marked "community wiki".

answered Feb 02 at 15:40

Andreas%20Mueller's gravatar image

Andreas Mueller
1817133671

edited Feb 02 at 15:45

Your answer
toggle preview

powered by OSQA

User submitted content is under Creative Commons: Attribution - Share Alike; Other things copyright (C) 2010, MetaOptimize LLC.