How to generate random variables given the PDF?

701 Views Asked by At

Suppose a probability density function (PDF) is defined on $[a, b]$ and we can generate only one uniformly distributed variable. For any given PDF, find $Y = f(X)$ such that $Y$ is distributed according to the given PDF.

For example: $Y = f(A, B) = \sqrt{-2 \log(A)} \cos(2 \pi B)$ is normally distributed if $A, B \sim U[0, 1]$.

1

There are 1 best solutions below

0
On BEST ANSWER

If $g$ denotes some PDF then $F(x)=\int_{-\infty}^xg(t)\;d(t)$ is its corresponding CDF.

For every CDF $F$ we can prescribe the function $\Phi:(0,1)\to\mathbb R$ prescribed by:$$\Phi(u)=\inf(\{x\in\mathbb R\mid F(x)\geq u\})$$

If further $U$ is a random variable with uniform distribution on $(0,1)$ then it can be shown that the CDF of random variable $X:=\Phi(U)$ is $F$.