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 fX(.)f_X(.) of interest (called the target density) up to a multiplicative constant. We use a simpler (to simulate) density fYf_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 fYf_Y are that:

(i) YY be simulate-able (the data simulation from YY be actually possible).

(ii) There is a constant cc with fX(x)fY(x)c \frac{f_X(x)}{f_Y(x)} \leq c for all xSX={x:fX(x)>0} x \in S_X=\lbrace x: f_X(x)>0 \rbrace.

(iii) fXf_X and fYf_Y have compatible supports (i.e., SXSYS_X \subseteq S_Y).

In this case, XX can be simulated as follows by Accept-Reject method. First, we generate yy from YfYY \sim f_Y and, independently, we generate uu from UU(0,1)U \sim U(0,1). If

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

then we set x=yx=y. If the inequality is not satisfied, we then discard/reject yy and uu 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


[Package AR version 1.1 Index]