In mathematics, rejection sampling is a basic pseudo-random number sampling technique used to generate observations from a distribution. It is also commonly called the acceptance-rejection method or "accept-reject algorithm".
Rejection sampling is based on the observation that to sample a random variable one can sample uniformly from the region under the graph of its density function.
To visualize this motivation, imagine graphing the distribution of a random variable onto a large rectangular board and throwing darts at it. Assume that the darts are uniformly distributed around the board. Now take off (reject) all of the darts that are outside the area under the curve. The remaining darts will be distributed uniformly within the area under the curve, and the x-positions of these darts will be distributed according to the random variable's density. This is because there is the most room for the darts to land where the curve is highest and thus the probability density is greatest.
The visualization as just described is equivalent to a particular form of rejection sampling where the proposal distribution is uniform (hence its graph is a rectangle). The general form of rejection sampling assumes that the board is not necessarily rectangular but is shaped according to some distribution that we know how to sample from (e.g. using inversion sampling), and which is at least as high at every point as the distribution we want to sample from, so that the former completely encloses the latter. (Otherwise, there will be parts of the curved area we want to sample from that can never be reached.) Rejection sampling works as follows:
- Sample a point (an x-position) from the proposal distribution.
- Draw a vertical line at this x-position, up to the curve of the proposal distribution.
- Sample uniformly along this line (i.e. uniformly from 0 to the value of the proposal distribution), and reject points outside of the desired distribution (i.e. greater than the value of the desired distribution at this point).
Note also that this algorithm can be used to sample from the area under any curve, regardless of whether the function integrates to 1. In fact, scaling a function by a constant has no effect on the sampled x-positions. This means that the algorithm can be used to sample from a distribution whose probability density function is only known up to a constant (i.e. whose normalizing constant is unknown), which is common in computational statistics.
Read more about Rejection Sampling: Theory, Algorithm, Examples, Drawbacks, Adaptive Rejection Sampling
Famous quotes containing the word rejection:
“What is termed Sin is an essential element of progress. Without it the world would stagnate, or grow old, or become colourless. By its curiosity Sin increases the experience of the race. Through its intensified assertion of individualism it saves us from monotony of type. In its rejection of the current notions about morality, it is one with the higher ethics.”
—Oscar Wilde (18541900)