Description Usage Arguments Details Author(s) References See Also Examples
UNU.RAN random variate generator for continuous multivariate distributions with given probability density function (PDF). It is based on the Multivariate Naive RatioOfUniforms method (‘VNROU’).
[Universal] – Rejection Method.
1 
dim 
number of dimensions of the distribution. (integer) 
pdf 
probability density function. (R function) 
ll,ur 
lower left and upper right vertex of a rectangular
domain of the 
mode 
location of the mode. (numeric vector) 
center 
point in “typical” region of distribution,
e.g. the approximate location of the mode. If omitted the

... 
(optional) arguments for 
This function creates a unuran
object based on the naive
ratioofuniforms method (‘VNROU’), i.e., a bounding rectangle
for the acceptance region is estimated and use for sampling proposal
points.
It can be used to draw samples of a continuous random vector with
given probability density function using ur
.
The algorithm works with unimodal distributions provided that the tails are not too “high” in every direction.
The density must be provided by a function pdf
which must
return nonnegative numbers and which need not be normalized (i.e., it
can be any multiple of a density function).
The center
is used as starting point for computing the bounding
rectangle. Alternatively, one also could provide the location the
mode
. However, this requires its exact position whereas
center
allows any point in the “typical” region of the
distribution.
The setup can be accelerated when the mode
is given.
Josef Leydold and Wolfgang H\"ormann [email protected].
W. H\"ormann, J. Leydold, and G. Derflinger (2004): Automatic Nonuniform Random Variate Generation. SpringerVerlag, Berlin Heidelberg. Section 11.1.4.
ur
, unuran.new
, unuran
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  ## Create a sample of size 100 for a Gaussian distribution
mvpdf < function (x) { exp(sum(x^2)) }
gen < vnrou.new(dim=2, pdf=mvpdf)
x < ur(gen,100)
## Use mode of Gaussian distribution to accelerate setup.
mvpdf < function (x) { exp(sum(x^2)) }
gen < vnrou.new(dim=2, pdf=mvpdf, mode=c(0,0))
x < ur(gen,100)
## Gaussian distribution restricted to the rectangle [1,2]x[1,2]
## (don't forget to provide a point inside domain using 'center')
mvpdf < function (x) { exp(sum(x^2)) }
gen < vnrou.new(dim=2, pdf=mvpdf, ll=c(1,1), ur=c(2,2), center=c(1.5,1.5))
x < ur(gen,100)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.