arms.sample | R Documentation |
Generate a sample from a probability distribution with Adaptive Rejection Metropolis Sampling
arms.sample(target.dist, x0, sample.size, tuning=1)
target.dist |
Target distribution; see |
x0 |
Numeric vector containing initial state. |
sample.size |
Sample size requested. |
tuning |
Scale for initial envelope; see details. |
arms.sample
implements Adaptive Rejection Metropolis
Sampling (Gilks, Best, and Tan, 1995). As described by Gilks et
al, a user of ARMS must specify an initial envelope roughly
approximating the target density. This implementation attempts
to provide a simpler interface for users by generating an envelope
automatically.
To form an initial envelope for coordinate (i), four abscissae
are needed. One is x0
. The sampler tries points
with abscissae x0[i]-2^k*tuning
and x0[i]+2^k*tuning
for
whole-numbers k
until points with log densities smaller
than that at x0
are found, then chooses a fourth point
from the interior of the two found points. (Specifically, the
interval between x0
and the lowest density found point is
binary-searched until a point with log-density larger than the
found point is located.)
This scheme for defining an envelope does not depend on the current state in the dimension being sampled. For discussion of why this must be the case, see see Gilks, Neal, Best and Tan (1997).
A list with elements X
, evals
, and rejections
,
following the calling convention of compare.samplers
.
rejections
indicates how many Metropolis-Hastings proposals
were rejected.
Gilks, W. R., Best, N. G., and Tan, K. K. C. (1995) “Adaptive Rejection Metropolis Sampling within Gibbs Sampling,” Applied Statistics 44(4):455-472.
Gilks, W. R., Neal, R. M., Best, N. G., and Tan, K. K. C. (1997) “Corrigendum: Adaptive Rejection Metropolis Sampling,” Applied Statistics 46(2):541-542.
compare.samplers
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.