I am attempting to do a discrete approximation using subintervals of a PDF's 99% CI. I understand that to generate samples from this distribution to use in my program, one can take the inverse of the distributions CDF and sample from that. The CDF I am attempting this on is:
$F(x) = 1-(3x+1)\exp -3x , \text{for} x \ge 0 $
Given the PDF, $f(x) = 9x\exp -3x , \text{for} x \ge 0$
Any help on how I can do this would be massively appreciated, I am struggling with the algebra. Further any help on an easier way to generate samples from this distribution would also be hugely appreciated.
Since $\frac{1-F}{e}=(-3x-1)\exp(-3x-1)$, $x=-\frac{W(\frac{1-F}{e})+1}{3}$ where $W$ is the Lambert $W$ function. However, the easiest way to sample this distribution is to sum two $\lambda=3$ Exponential variables, as you can prove from moment generating functions (or, if you know enough about complex numbers to be more rigorous, characteristic functions).