
Last chance! 50% off unlimited learning
Sale ends in
The RejectionSampling
function implements rejection sampling
of a target density given a proposal density.
RejectionSampling(Model, Data, mu, S, df=Inf, logc, n=1000, CPUs=1, Type="PSOCK")
This is a model specification function. For more
information, see LaplaceApproximation
.
This is a list of data. For more information, see
LaplaceApproximation
.
This is a mean vector
This is a convariance matrix
This is a scalar degrees of freedom parameter
This is the logarithm of the rejection sampling constant.
This is the number of independent draws to be simulated from the proposal density.
This argument accepts an integer that specifies the number
of central processing units (CPUs) of the multicore computer or
computer cluster. This argument defaults to CPUs=1
, in which
parallel processing does not occur.
This argument specifies the type of parallel processing to
perform, accepting either Type="PSOCK"
or
Type="MPI"
.
The RejectionSampling
function returns an object of class
rejection
, which is a matrix of accepted, independent,
simulated draws from the target distribution.
Rejection sampling (von Neumann, 1951) is a Monte Carlo method for
drawing independent samples from a distribution that is proportional
to the target distribution,
Here, the target distribution, Model
function. The sampling distribution, mu
, S
, and df
) are used
to create random draws, Model
specification function. The evaluations of the target distribution,
sampling distribution, and the constant are used to create a
probability of acceptance for each draw, by comparing to a vector of
Before beginning rejection sampling, a goal of the user is to find the
bounding constant, LaplaceApproximation
to find the modes of the
parameters of interest, and using the resultant LP
, the mode
of the logarithm of the joint posterior distribution, as
The RejectionSampling
function performs one iteration of
rejection sampling. Rejection sampling is often iterated, then called
the rejection sampling algorithm, until a sufficient number or
proportion of
Extensions of rejection sampling include Adaptive Rejection Sampling (ARS) (either derivative-based or derivative-free) and Adaptive Rejection Metropolis Sampling (ARMS), as in Gilks et al. (1995). The random-walk Metropolis algorithm (Metropolis et al., 1953) combined the rejection sampling (a method of Monte Carlo simulation) of von Neumann (1951) with Markov chains.
Parallel processing may be performed when the user specifies
CPUs
to be greater than one, implying that the specified number
of CPUs exists and is available. Parallelization may be performed on a
multicore computer or a computer cluster. Either a Simple Network of
Workstations (SNOW) or Message Passing Interface (MPI) is used. With
small data sets and few samples, parallel processing may be slower,
due to computer network communication. With larger data sets and more
samples, the user should experience a faster run-time.
This function is similar to the rejectsampling
function in the
LearnBayes
package.
Gilks, W.R., Best, N.G., Tan, K.K.C. (1995). "Adaptive Rejection Metropolis Sampling within Gibbs Sampling". Journal of the Royal Statistical Society. Series C (Applied Statistics), Vol. 44, No. 4, p. 455--472.
Metropolis, N., Rosenbluth, A.W., Rosenbluth, M.N., and Teller, E. (1953). "Equation of State Calculations by Fast Computing Machines". Journal of Chemical Physics, 21, p. 1087-1092.
von Neumann, J. (1951). "Various Techniques Used in Connection with Random Digits. Monte Carlo Methods". National Bureau Standards, 12, p. 36--38.
dmvn
,
dmvt
,
IterativeQuadrature
,
LaplaceApproximation
,
LaplacesDemon
, and
VariationalBayes
.
# NOT RUN {
library(LaplacesDemon)
### Suppose an output object of class laplace is called Fit:
#rs <- RejectionSampling(Model, MyData, mu=Fit$Summary1[,1],
# S=Fit$Covar, df=Inf, logc=Fit$LP.Final, n=1000)
#rs
# }
Run the code above in your browser using DataLab