Generating Random Variates from CDF

88 Views Asked by At

Suppose I am given a CDF of a distribution, given by $F(x) \propto x + x^2 + x^4 + x^7$. How do I generate a random variable from this distribution?

1

There are 1 best solutions below

2
On BEST ANSWER

As clarinetist wrote, your CDF is not really well-defined. But I will go ahead and assume its support lies on an interval of the form $[0,a]$, i.e. $F(0)=0$ and $F(a)=1$. Then $F:[0,a] \to [0,1]$ is bijective (since it is a sum of monomial terms with coefficients equal to 1) and hence $F^{-1}$ is well-defined.

Now let $V \sim U[0,1]$ be a uniformly distributed random variable, then by the inverse probability integral transformation it holds that:

$$ F^{-1}(V) \sim F $$

In other words, you can generate your random variable $X$ as follows:

Step 1: Draw $V \sim U[0,1]$

Step 2: Let $X=F^{-1}(V)$ (e.g. by inverting $F$ numerically)