Last updated 5 years ago
Suppose we want to simulate pseudo random numbers from the following distribution, which I came across in ,
where a,b>0a, b>0a,b>0 and p∈(0,1)p\in (0,1)p∈(0,1).
provided a very elegant solution.
Note that
the distribution FFF is the distribution of
since
Thus, the R code to simulate is simple to be
x = pmin(rexp(n, a), rexp(n, b/(p+1))^(1/(p+1)))