vnrou.new: UNU.RAN generator based on Multivariate Naive...

vnrou.newR Documentation

UNU.RAN generator based on Multivariate Naive Ratio-Of-Uniforms method (VNROU)

Description

UNU.RAN random variate generator for continuous multivariate distributions with given probability density function (PDF). It is based on the Multivariate Naive Ratio-Of-Uniforms method (‘VNROU’).

[Universal] – Rejection Method.

Usage

vnrou.new(dim=1, pdf, ll=NULL, ur=NULL, mode=NULL, center=NULL, ...)

Arguments

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 pdf. The domain is only set if both vertices are not NULL. Otherwise, the domain is unbounded by default. (numeric vectors)

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 mode is used. If the mode is not given either, the origin is used. (numeric vector)

...

(optional) arguments for pdf

Details

This function creates a unuran object based on the naive ratio-of-uniforms 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 non-negative 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.

Author(s)

Josef Leydold and Wolfgang H\"ormann unuran@statmath.wu.ac.at.

References

W. H\"ormann, J. Leydold, and G. Derflinger (2004): Automatic Nonuniform Random Variate Generation. Springer-Verlag, Berlin Heidelberg. Section 11.1.4.

See Also

ur, unuran.new, unuran.

Examples

## 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 set-up.
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)


Runuran documentation built on Jan. 17, 2023, 5:17 p.m.