Rejection Method Experiment

Distribution graph


This applet simulates values from a random variable with a specified continuous special distribution using the rejection method. The probability density function \(f\) of the selected distribution is shown in both graphs. In the left graph, a bounding rectangle is also shown. On each run,a random point \((X, Y)\) is generated which is uniformly distributed on the bounding rectangular region. If \(Y \le f(X)\), the point is accepted and \(X\) is the simulated value. If \(Y \gt f(X)\), the point is rejected. On each run, the values of \(X\) and \(Y\) are recorded, and the value of a Boolean variable \(R\) which takes the value 1 if the point is accepted and 0 if the point is rejected. As the experiment runs, the empirical density and moments of the simulated distribution are shown in the right graph and recorded in the right table. The distribution table on the right also records \(N\), the number of accepted points. The following distributions can be chosen with the selection box:

In each case, the parameters can be set with the input controls.