ar_method: Acceptance-Rejection method

View source: R/gens.R

ar_methodR Documentation

Acceptance-Rejection method

Description

Acceptance-Rejection method

Usage

ar_method(n, f, g, rg, c)

Arguments

n

number of random numbers

f

interest density function

g

sampling density function

rg

random number generator function with distribution g

c

constant or a vector containing the end-points of the interval to be searched for the maximum constant such that f(y)/g(y)<=c for all y

Value

Vector of random numbers, with the acceptance rate and optimal c as attributes.


mnaR99/mshelpers documentation built on May 22, 2022, 6:03 a.m.