ars: Entrypoint for 'ars' package. Runs an adaptative rejection...

Description Usage Arguments Value

View source: R/ars.R

Description

Entrypoint for 'ars' package. Runs an adaptative rejection sampling algorithm on a given probability density and returns the specified number of samples.

Usage

1
ars(density, n_samples = 10, location = 0, scale = 1)

Arguments

density

A function closure of the density to be sampled from. Input functions must have similar behavior to dnorm, dexp, etc.

n_samples

The number of samples to sample from the distribution

location

starting point at which to initialize sampling points, default 0. Should be chosen so that location is near the mode of the distribution.

scale

value at which to space initial points (default 1). Should be chosen such that mode - (2scale), mode+(2scale) is within the support of the probability density.

Value

samples numeric vector of samples from the specified distribution


amondal2/ars documentation built on Dec. 31, 2020, 7:45 p.m.