ArticleslgStudy

mathematics

Rejection sampling

Rejection sampling is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Rejection sampling rather than just read about it. In short: In numerical analysis and computational statistics, 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 exact simulation method.

Rejection sampling — main illustration
Rejection sampling — illustration

Key takeaways

  • Rejection sampling belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Rejection sampling to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Rejection sampling from memory before moving on to harder problems.

Reference excerpt

In numerical analysis and computational statistics, 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 exact simulation method. The method works for any distribution in R m {\displaystyle \mathbb {R} ^{m}} with a density. Rejection sampling is based on the observation that to sample a random variable in one dimension, one can perform a uniformly random sampling of the two-dimensional Cartesian graph, and keep the samples in the region under the graph of its density function. Note that this property can be extended to N-dimension functions.

Algorithmic Definition The algorithm, which was used by John von Neumann and dates back to Buffon and his needle, draws a sample from a (target) probability density function f ( x ) {\displaystyle f(x)} , which is proportional to f ∝ ( x ) {\displaystyle f_{\varpropto }(x)} , using draws from a simpler (proposal) probability density g ( x ) {\displaystyle g(x)} as follows: Rejection Sampling

Input Target density f ( x ) = f ∝ ( x ) ∫ f ∝ ( y ) d y {\displaystyle f(x)={\frac {f_{\varpropto }(x)}{\int f_{\varpropto }(y)dy}}} , proposal density g ( x ) {\displaystyle g(x)} , constant M {\displaystyle M} such that f ∝ ( x ) ≤ M g ( x ) {\displaystyle f_{\varpropto }(x)\leq Mg(x)} for all x {\displaystyle x} . Algorithm

Sample X ∼ g ( x ) {\displaystyle X\sim g(x)}

Sample U ∼ U n i f ( 0 , 1 ) {\displaystyle U\sim \mathrm {Unif} (0,1)} , independently of X {\displaystyle X} . Compute likelihood ratio W = f ∝ ( X ) g ( X ) {\displaystyle W={\dfrac {f_{\varpropto }(X)}{g(X)}}} . If W < M × U {\displaystyle W<M\times U} , reject X {\displaystyle X} and repeat from step 1. Otherwise, accept and output X {\displaystyle X} . Output A sample X {\displaystyle X} drawn from f {\displaystyle f} . The algorithm will take an average of M ∫ f ∝ ( y ) d y {\displaystyle {\frac {M}{\int f_{\varpropto }(y)dy}}} rejections to obtain a sample.

Detailed Description To visualize the motivation behind rejection sampling, imagine graphing the probability density function (PDF) 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 remove 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 {\displaystyle 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 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 the density of some proposal distribution (not necessarily normalized to 1 {\displaystyle 1} ) that we know how to sample from (for example, using inversion sampling). Its shape must be 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 would be parts of the curved area we want to sample from that could never be reached. Rejection sampling works as follows:

… excerpt ends here. Continue reading the full article.

Illustrations

Rejection sampling: Visual example of rejection sampling. In this case 
  
    
      
        U
      
    
    {\displaystyle U}
  
 ends up in the rejection zone, therefore 
  
    
      
        X
      
    
    {\displaystyle X}
  
 is rejected.
Visual example of rejection sampling. In this case U {\displaystyle U} ends up in the rejection zone, therefore X {\displaystyle X} is rejected.

Worked examples

Example 1 — a first encounter with Rejection sampling

Start with the simplest possible case. Write down what Rejection sampling claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Rejection sampling before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Rejection sampling ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Rejection sampling

In research
Rejection sampling appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Rejection sampling in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Rejection sampling is common in secondary-school and first-year university syllabi. It links to neighbouring topics Monte Carlo methods, Non-uniform random numbers, so understanding it makes those chapters shorter.
In everyday life
Look for Rejection sampling outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Rejection sampling in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Rejection sampling means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Rejection sampling out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Rejection sampling in simple terms?

In numerical analysis and computational statistics, 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 exact simulation method.

Why does Rejection sampling matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Rejection sampling?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Rejection sampling.

Tags

  • Monte Carlo methods
  • Non-uniform random numbers

Keep exploring