What is rejection sampling used for?

What is rejection sampling used for?

Rejection sampling is a Monte Carlo algorithm to sample data from a sophisticated (“difficult to sample from”) distribution with the help of a proxy distribution. What is Monte Carlo? If a method/algorithm uses random numbers to solve a problem it is classified as a Monte Carlo method.

How does rejection sampling work?

Acceptance-Rejection sampling is a way to simulate random samples from an unknown (or difficult to sample from) distribution (called the target distribution) by using random samples from a similar, more convenient probability distribution. A random subset of the generated samples are rejected; the rest are accepted.

How to do rejection sampling for a proposal?

Rejection sampling works as follows: 1 Sample a point on the x-axis from the proposal distribution. 2 Draw a vertical line at this x-position, up to the maximum y-value of the probability density function of the proposal distribution. 3 Sample uniformly along this line from 0 to the maximum of the probability density function.

When do you repeat the rejection sampling algorithm?

The algorithm can be repeated until the desired number of samples from the target density ff has been accepted. As a simple example, suppose we wanted to generate samples from a N(0, 1)N (0,1) density. We could use the t2t2 distribution as our candidate density as it has heavier tails than the Normal.

Which is an example of rejection sampling visualization?

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).

When to reject a sample in probability density function?

Sample uniformly along this line from 0 to the maximum of the probability density function. If the sampled value is greater than the value of the desired distribution at this vertical line, reject the x-value and return to step 1; else the x-value is a sample from the desired distribution.