Description Usage Arguments Value Examples
This function returns a vector with n elemtns from a continus random variable
1 | rejectionSampler(n, pdf, lower, upper, C)
|
n |
number of observations. n must be an integer >0 |
pdf |
a function that is the pdf of the distribution. |
lower |
lower and upper limits of the of the distribution. Must be finite such that P(a ≤ X ≤ b \cap a ≤ Y ≤ b) = 1. |
C |
a numeric such that f(x,y) ≤ C for all values of x. |
lower |
lower and upper limits of the distribution |
data.frame of random deviate pairs
1 2 3 | rejectionSampler(n = 1000, pdf = mypdf, lower = 0, upper = 2, C = 1)
this is an exact bounds so that the pdf integrates to 1
rejectionSampler(n = 1000, pdf = normpdf, lower = -100, upper = 100, C = 1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.