ar_method | R Documentation |
Acceptance-Rejection method
ar_method(n, f, g, rg, c)
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 |
Vector of random numbers, with the acceptance rate and optimal c as attributes.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.