1
$\begingroup$

I have the PDF of a distribution from which it is not possible to get a closed from for the CDF or inverse CDF. Is there a technique that would allow me to generate samples from this distribution using the PDF?

$\endgroup$
  • 1
    $\begingroup$ It depends. The normal density does not have a closed-form expression for the CDF or the inverse CDF but samples can nonetheless be generated via the Box-Muller method (among others). So, does your pdf have any nice properties that can be exploited? $\endgroup$ – Dilip Sarwate Jul 9 '14 at 17:06
2
$\begingroup$

Here is a suggestion for the case where the density function is $0$ outside the interval $[a,b]$, and is bounded by $c$ on $[a,b]$. Use a random number generator to generate random points om the rectangle with base $[a,b]$ and height $c$. If the pdf is $f(x)$, discard all points $(x,y)$ such that $y\gt f(x)$. For each point you keep, record $x$.

$\endgroup$
  • $\begingroup$ My PDF in multivariate continuous and is everywhere positive so this might not work, but it does give me some ideas! $\endgroup$ – Wintermute Jul 9 '14 at 19:04
  • 1
    $\begingroup$ Multivariate is in principle not a problem, use a "box" instead of a rectangle. In practice, there is a problem, too high a proportion of the points gets rejected, so the process can become computationally inefficient. There are lots of additional tricks, you might want to look under rejection sampling. $\endgroup$ – André Nicolas Jul 9 '14 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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