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.” If the user has a function he or she is trying to sample from, whose functional form is well known, basically accept the sample by generating a uniform random number at any x and accept it if the value if below the value of the function at that x.

The process:

  1. Draw x uniformly from [Xmin, Xmax]

  2. Draw y uniformly from [0, Ymax]

  3. if y < f(x), accept the sample

  4. otherwise reject it

  5. repeat

roxygen2::roxygenise()

?rvsample



final4800/4800shilin documentation built on May 24, 2019, 4:08 p.m.