2
$\begingroup$

I have a set of data points that I have used to generate my empirical cumulative distribution function (CDF), which looks like this (to simplify things I have reduced the number of points for this question but it shouldn't matter):

CDF

Given this data and plot, I need to somehow generate random values which follow this distribution. I admit that I am quite rusty when it comes to probability, but as far as I understand I need to first generate the probability density function (PDF), and then from there I can do what I want. Is that accurate? Or what is the best way to get what I want?

If interested in giving an example for the answer, here are the X and Y array for the data points of the ECDF plot. I am using Python but I guess a language agnostic answer would also be really helpful

x = [107.6697676209896, 430.70331251794784, 1975.0646306785532, 7793.524079329409, 27569.66699567533, 62566.73646946178, 222847.1449910263, 832591.8949493016, 2827054.7454871265, 10000733.572934577]
y = [0, 0.04812202549318534, 0.09825964339269633, 0.14190143419466905, 0.27204351414405636, 0.46590411495145756, 0.6008552899988212, 0.6796719668120879, 0.8400864397710662, 1]

Thanks a lot!

$\endgroup$
2
  • 1
    $\begingroup$ You do not need the density, but instead the inverse of the CDF (is it supposed to be linear on a log scale?) which you can apply to a uniform random variable $\endgroup$
    – Henry
    Commented Jan 22, 2022 at 1:52
  • $\begingroup$ You can as well use the density (pdf) with Metropolis algorithm: see stackoverflow.com/a/51057365/5802041 $\endgroup$
    – Jean Marie
    Commented Jan 22, 2022 at 2:24

1 Answer 1

1
$\begingroup$

Recall that for any CDF $F(t)$, let $F^{-1}(x):=\inf\{t:F(t)\geq x\}$, then given $U\sim Unif[0,1]$, $F^{-1}(U)$ has CDF $F(t)$.

$\endgroup$
1
  • 1
    $\begingroup$ For a better understanding, in the case of a continuous ascending curve as is the case here, you do not need to introduce this complicated definition :$F^{-1}(x):=\inf\{t:F(t)\geq x\}$... $\endgroup$
    – Jean Marie
    Commented Jan 22, 2022 at 2:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .