Description Usage Arguments Value Examples
Adaptive Rejection Sampling from log-concave density functions h(x)
1 |
h |
input the original valid probability density function we want to sample from, the function h should only takes one argument x. i.e. correct: h = function(x) {dnorm(x,0,1)}; wrong: h = function(x,mean = 0,sd = 1) {dnorm(x,mean,sd)} |
start |
lower bound of the domain of h(x) |
end |
upper bound of the domain of h(x) |
N |
sample size |
k |
number of starting points, the default is 3 |
x1 |
the right starting point, if NULL, the function will find one |
xk |
the left starting point, if NULL, the function will find one |
a vector of N sampled value from the density h(x)
1 2 3 4 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.