ars: Adaptive Rejection Sampler

Description Usage Arguments Value Examples

Description

Sample from a log-concave density function,potentially unnormalized, using the Adaptive Rejection Sampling method described in Gilks et al (1992)

Usage

1
ars(g, a, b, N, n_per_step = 500)

Arguments

g

input density function

a

lower bound of function domain D (could be -Inf)

b

upper bound of function domain D (could be Inf)

N

number of observations required

n_per_step

Default = 500. Number of observations between each update of the hull function

Value

A one-dimensional vector of N independent observations from the the given input density

Examples

1
2
3
4
g <- function (x) {
return(dnorm(x))
}
ars_results <- ars(g, a = -Inf, b= Inf, N = 100000)

vdchoi/ars documentation built on Jan. 1, 2021, 12:36 p.m.

Related to ars in vdchoi/ars...