ars: Adaptive Rejection Sampler

Description Usage Arguments Details Examples

Description

Sample points from a distribution using an adaptive rejection sampler. Based upon: Gilks, W., & Wild, P. (1992). Adaptive Rejection Sampling for Gibbs Sampling. Journal of the Royal Statistical Society.

Usage

1
ars(n, f, starting_points, dfunc, interval)

Arguments

n

the number of samples that you'd like taken from the distribution.

f

the function used to determine the distribution from which you'll sample

starting_points

the starting points used for the initialization step of the ars algorithm.

dfunc

the derivative of the function.

interval

the boundary limit of the distribution.

Details

Adaptive rejection sampling can be beneficial when sampling from certain distributions by reducing the number of evaluations that must occur. It reduces the evaluations by assuming log-concavity for any input function, and because it doesn't need to update for new envelope and squeeze functions every iteration. ARS is particularly useful in Gibbs Sampling, where calculations are complicated but usually log-concave.

Examples

1
2
# testing on normal distribution
res_samples <- ars(n = 1000, f = dnorm)

tfaulk13/ars documentation built on May 21, 2019, 10:13 a.m.