AR-package {AR} | R Documentation |

## Another Look at the Acceptance-Rejection Method

### Description

There are many distributions for which the inverse transform method and even
general transformations will fail to be able to generate the required random
variables. For these cases, we must turn to indirect methods; that is, methods
in which we generate a candidate random variable and only accept it subject
to passing a test. This class of methods is extremely powerful
and will allow us to simulate from virtually any distribution; see (Robert and Casella, 2010) for more detailes.
These so-called `Accept-Reject methods`

only require us to know the functional
form of the density `f_X(.)`

of interest (called the target density) up to a
multiplicative constant. We use a simpler (to simulate) density `f_Y`

, called the
instrumental or candidate density, to generate the random variable for which
the simulation is actually done. The constraints we impose on this candidate
density `f_Y`

are that:

(i) `Y`

be simulate-able (the data simulation from `Y`

be actually possible).

(ii) There is a constant `c`

with ` \frac{f_X(x)}{f_Y(x)} \leq c `

for all ` x \in S_X=\lbrace x: f_X(x)>0 \rbrace`

.

(iii) `f_X`

and `f_Y`

have compatible supports (i.e., `S_X \subseteq S_Y`

).

In this case, `X`

can be simulated as follows by Accept-Reject method. First, we generate `y`

from `Y \sim f_Y`

and,
independently, we generate `u`

from `U \sim U(0,1)`

. If

`u \leq \frac{f_X(y)}{c \ f_Y(y)},`

then we set `x=y`

. If the inequality is not satisfied, we then discard/reject `y`

and
`u`

and start again (Robert and Casella, 2010).

### Details

Package `AR`

provides a useful tool for teaching students to understand the theoritical idea behind the `Accept-Reject method`

. This package works with only one function, i.e. function `AR.Sim`

which can generate random sample/vector on the basis of the `Accept-Reject method`

.

### Author(s)

Abbas Parchami

Maintainer: Abbas Parchami <parchami@uk.ac.ir>

### References

Iacus, S.M., Simulation and Inference for Stochastic Differential Equations: With R Examples, Springer, New York (2008).

Jones, O., Maillardet, R, Robinson, A., Introduction to Scientific Programming and Simulation Using R, Chapman & Hall/CRC, Boca Raton (2009).

Robert, C.P., Casella, G., Introducing Monte Carlo Methods with R, New York: Springer (2010).

Vasishth, S., Broe, M., The Foundations of Statistics: A Simulation-based Approach, Springer (2010).

Wikipedia, the free encyclopedia, Rejection sampling, https://en.wikipedia.org/wiki/Rejection_sampling

*AR*version 1.1 Index]