The Probability Integral Transform and the Accept-Reject Algorithm are two methods for generating a random variable with some desired distribution. This Shiny app demonstrates how they work, through two examples of each method.
For the Accept-Reject Algorithm (shown above), the examples demonstrated in this app are the Beta distribution and the truncated Normal distribution. A side-by-side plot shows each point that has been generated. Users have the option to generate one replicate at a time, to examine and understand the mechanics of how the algorithm is accomplishing its task, with details of each replicate given below the plots. Additionally, up to 500 replicates can be generated at once, to build towards a greater representation of points and confirm that the algorithm does in fact result in the desired distribution.
The Probability Integral Transform (not shown) is demonstrated with the Exponential distribution, and an arbitrary, unnamed distribution. In this demonstration, users again have the option to generate one replicate at a time, with side-by-side plots showing each point, and details of each replicate given below the plots. Users can also generate up to 500 replicates at once to view the overall distribution that is produced.