ars: Adaptive Rejection Sampling

Description Usage Arguments Details Value Author(s) References Examples

Description

Method for rejection sampling for any univariate log-concave probability density function.

Usage

1
ars(myfun, m, lower, upper)

Arguments

myfun

density the user wants to sample from

m

sample size

lower

value of the lower bound

upper

value of the upper bound

Details

The method is adaptive: as sampling proceeds, the rejection envelope and the squeezing function converge to the density function. The rejection envelope and squeezing function are piecewise exponential functions forming arcs between those points of contact. The technique is intended for situations where evaluation of the density is computationally expensive.

Value

a sample of inputted length n from a density

Author(s)

Cindy Zhang, Sihan Chen, Sacha Mourier

References

Gilks, W. R, Wild, P. (1992) Adaptive Rejection Sampling for Gibbs Sampling, Applied Statistics 41:337-348

Examples

1
2
3
4
5
library(ars)

#Example: sample 500 values from the standard normal distribution
ars1 <- ars(myfun = dnorm, m = 500, lower = -6, upper = 6)
hist(ars1, breaks = 100)

mouriersacha/ars documentation built on May 24, 2019, 9:54 a.m.