Questions tagged [rejection-sampling]

Rejection sampling is a basic technique used to generate observations from a distribution. [Wikipedia]

From Wikipedia:

Rejection sampling is a basic technique used to generate observations from a distribution. It is also commonly called the acceptance-rejection method or "accept-reject algorithm" and is a type of Monte Carlo method. The method works for any distribution in $\mathbb R^m$ with a density.

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 [(Neal, 2003; Bishop, 2006)]...

As a simple geometric example, suppose it is desired to generate a random point within the unit circle. Generate a candidate point $(x,y)$ where $x$ and $y$ are independent uniformly distributed between −1 and 1. If it so happens that $x^2+y^2\le1$ then the point is within the unit circle and should be accepted. If not then this point should be rejected and another candidate should be generated...

Rejection sampling can lead to a lot of unwanted samples being taken if the function being sampled is highly concentrated in a certain region, for example a function that has a spike at some location. For many distributions, this problem can be solved using an adaptive extension (see adaptive rejection sampling). In addition, as the dimensions of the problem get larger, the ratio of the embedded volume to the "corners" of the embedding volume tends towards zero, thus a lot of rejections can take place before a useful sample is generated, thus making the algorithm inefficient and impractical. See curse of dimensionality. In high dimensions, it is necessary to use a different approach, typically a Markov chain Monte Carlo method such as Metropolis sampling or Gibbs sampling.

References

- Bishop, C. (2006). 11.4: Slice sampling. Pattern Recognition and Machine Learning. Springer.
- Neal, R. M. (2003). Slice sampling. Annals of Statistics, 31(3), 705–767. Retrieved from http://people.ee.duke.edu/~lcarin/slice.pdf.

98 questions
13
votes
2 answers

Empirical distribution alternative

BOUNTY: The full bounty will be awarded to someone who provides a reference to any published paper which uses or mentions the estimator $\tilde{F}$ below. Motivation: This section is probably not important to you and I suspect it won't help you get…
10
votes
2 answers

How does the proof of Rejection Sampling make sense?

I am taking a course on Monte Carlo methods and we learned the Rejection Sampling (or Accept-Reject Sampling) method in the last lecture. There are a lot of resources on the web which shows the proof of this method but somehow I am not convinced…
Ufuk Can Bicici
  • 2,028
  • 1
  • 17
  • 26
10
votes
2 answers

How to sample from discrete distribution on the non-negative integers?

I have the following discrete distribution, where $\alpha,\beta$ are known constants: $$ p(x;\alpha,\beta) = \frac{\text{Beta}(\alpha+1, \beta+x)}{\text{Beta}(\alpha,\beta)} \;\;\;\;\text{for } x = 0,1,2,\dots $$ What are some approaches to…
9
votes
3 answers

Simulate a Bernoulli variable with probability ${a\over b}$ using a biased coin

Can someone tell me how to simulate $\mathrm{Bernoulli}\left({a\over b}\right)$, where $a,b\in \mathbb{N}$, using a coin toss (as many times as you require) with $P(H)=p$ ? I was thinking of using rejection sampling, but could not nail it down.
8
votes
3 answers

Why use rejection sampling if it still uses the distribution?

Suppose we are using rejection sampling and we want to sample from a distribution, say $p$. In order to calculate the acceptance probability, we use the ratio: $$\Pr\left(u < \frac{p(x)}{Mq(x)}\right) $$ Therefore, we still use the distribution of…
user41181
  • 123
  • 4
8
votes
3 answers

Can't understand why rejection sampling works

I want to generate sample points $\{z_i\}$ in an arbitrary 2D shape, e.g. a circle centered at the origin with radius 1. Rejection sampling says: Look at 2 uniform random variables over $[0,1]$, $X$ and $Y$. Sample $X$ and $Y$, you get $x$ and $y$,…
ToniAz
  • 211
  • 1
  • 3
8
votes
2 answers

Use of Metropolis & Rejection & Inverse Transform sampling methods

I know that the Inverse Transform method is not always a good option to sample from distributions because it is a analytical method dependent on the shape of the distribution function. For example, the inverse one dimensional Gaussian distribution…
7
votes
2 answers

How do I sample without replacement using a sampling-with-replacement function?

I vaguely recall from grad school that the following is a valid approach to do a weighted sampling without replacement: Start with an initially empty "sampled set". Draw a (single) weighted sample with replacement with whatever method you have.…
Juan
  • 173
  • 1
  • 5
6
votes
2 answers

Generating a sample from Epanechnikov's kernel

So I am really struggling with this problem and could use some help. Consider the Epanechnikov kernel given by $$f_e(x)=\frac{3}{4}\left( 1-x^2 \right)$$ According to Devroye and Gyorfi's "Nonparametric Density Estimation: The $L_1$ View", to…
cga007
  • 61
  • 2
5
votes
1 answer

How to sample $n$ observations from a multinomial distribution using binomial (or poisson) sampling?

Context I have $n$ observations which I'd like to sample with replacement for the purpose of bootstrap. A way to think about it is that we have a multinomial distribution with $n$ classes and that we'd like to draw from it $n$ items. However, due to…
5
votes
1 answer

Acceptance-Rejection Method Acceptance Probability Proof

I did not fully understand the proof of the acceptance probability. The acceptance-rejection algorithm is described as follows: suppose you have RVs $X$ and $Y$ with densities $f$ and $g$, respectively, and there exists a constant $c$ such that…
eok
  • 65
  • 6
5
votes
2 answers

Why is rejection sampling with acceptance probability 2/3 for Beta(2,2) not slower than `rbeta(N,2,2)`?

I was trying to illustrate that rejection sampling is inefficient when an alternative approach is available that does not throw away samples. (This post obviously is a candidate for migration to SO, but I feel that there might also be a statistical…
Christoph Hanck
  • 25,948
  • 3
  • 57
  • 106
5
votes
3 answers

How to choose a constant for reject sampling

When using a non-Markov Monte Carlo sampling method, for example acceptance-rejection sampling, we choose a density $\ h(x) $ and a known constant $\ c $ such that $\ ch(x) $ acts as a blanketing function for our target distribution $\pi(x) $.…
hirschme
  • 750
  • 1
  • 7
  • 21
5
votes
1 answer

Metropolis-Hastings using log of the density

Does Metropolis-Hastings work with the log of the proposal and the density to be sampled from? That is, say we want to sample from a density $\pi(x)$, using a proposal $q(x|x^{old})$, will the Metropolis-Hastings work with $\log(\pi(x))$ and…
4
votes
1 answer

Two algorithms are given for rejection sampling. I can not relate these two algorithms

Algorithm 1) Step 1:Obtain a sample $y$ from distribution $Y$ and a sample $u$ from $(0,1)$ Step 2: Check whether or not $u < f(y)/ M.g(y)$ if true accept $y$ as a sample from $f$ Else, reject the value of $y$ return to the sampling…
1
2 3 4 5 6 7