ars: Perform Adaptive Rejection Sampling

Description Usage Arguments Value

View source: R/modular_functions.R

Description

ars calculates a given number of n random samples from a given density f, initialized at the given abscissae x_abs.

Usage

1
ars(n, x_abs = NULL, f, f_params = NULL, supp = c(-Inf, Inf))

Arguments

n

The number of samples to return

x_abs

A numeric vector of length k for k > 1, representing the abscissae.

f

A function representing the target sampling distribution.

f_params

A list of any associated parameters of f.

supp

The support of f, as a two-membered numeric vector. Default is c(-Inf, Inf)

Value

A named list containing vals: the collection of n samples, k: the count of abscissae added, i: the total number of samples attempted, and m: the amount of rejected samples.


bsearchinger/ARS documentation built on Dec. 19, 2021, 12:44 p.m.