Let be proportional to the target probability density function, with . Define the ratio-of-uniforms method through the regionDraw uniformly with respect to area on and return . To prove its law, change variables from to . The Jacobian determinant is , and the allowed interval for is . ConsequentlyThe joint density of is therefore on that interval. Integrating out givesFor an already normalized density, and the region has area . The name refers to the two coordinates of a uniformly sampled region; drawing two unrelated uniforms on arbitrary intervals and taking their ratio would not give the target law.
The region usually has a curved boundary, so sampling uniformly inside it directly is inconvenient. Rejection sampling replaces it by an easily sampled envelope, usually a rectangle. Choose finite bounds withThen up to null boundaries. A general rectangle algorithm uses only independent uniform deviates: draw on , set , , and return if ; otherwise repeat. If a numerical generator returns , discard that draw before division. No knowledge of is required to run the method. Its acceptance rate is the ratio of the two areas:More generally the same area ratio applies to any finite-area envelope sampled uniformly. A change in the proportionality constant of scales both ratio coordinates and their areas consistently.
Finite rectangle bounds are a real condition, not a consequence of integrability alone. For instance is integrable, but is unbounded. A finite-area envelope for a ratio-of-uniforms region gives a general extension: choose a finite-area open envelope containing , decompose it up to null boundaries into countably many disjoint rectangles, and select a rectangle with probability proportional to its area using a uniform draw and cumulative probabilities. Use two more uniforms to sample within it, then apply the same acceptance test. This samples the envelope uniformly and has acceptance . Such envelopes exist for every finite-area measurable ; obtaining usable bounds or an effective rectangle decomposition is density-specific. The finite-rectangle version above is the usual practical implementation.
For , use the unnormalized normal density . Its ratio region isThe bound on is one because is maximized at zero. To bound , maximize for . Its derivative vanishes at , giving . Thus the normal ratio-of-uniforms envelope is , .
Draw independent , set and , and accept precisely whenreturning . Equivalently compare logarithms to avoid underflow. Since , the region area is and the rectangle area is . ThereforeIt is independent of the normal scale. In the diagram the vertical coordinate is normalized by , so the same shape works for every positive scale.
Normal ratio-of-uniforms region and its minimum axis-aligned rejection rectangle
. Details. Articles by others on the same topic
There are currently no matching articles.
