itdr.new {Runuran}R Documentation

UNU.RAN generator based on Inverse Transformed Density Rejection (ITDR)

Description

UNU.RAN random variate generator for continuous distributions with given probability density function (PDF). It is based on the Inverse Transformed Density Rejection method (‘ITDR’).

[Universal] – Rejection Method.

Usage

itdr.new(pdf, dpdf, lb, ub, pole, islog=FALSE, ...)

Arguments

pdf probability density function. (R function)
dpdf derivative of pdf. (R function)
pole pole of distribution. (numeric)
lb lower bound of domain; use -Inf if unbounded from left. (numeric)
ub upper bound of domain; use Inf if unbounded from right. (numeric)
islog whether pdf is given as log-density (the dpdf must then be the derivative of the log-density). (boolean)
... (optional) arguments for pdf

Details

This function creates a unuran object based on “ITDR” (Inverse Transformed Density Rejection). It can be used to draw samples of a continuous random variate with given probability density function using ur.

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). Moreover, it must be monotone on its domain. The algorithm is especially designed for distributions with unbounded densities. Thus the algorithm need the position of the pole.

The derivative dpdf is essential. (Numerical derivation does not work as it results in serious round-off errors.)

The setup time of this method depends on the given PDF, whereas its marginal generation times are almost independent of the target distribution.

Author(s)

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

References

W. H"ormann, J. Leydold, and G. Derflinger (2007): Inverse transformed density rejection for unbounded monotone densities. ACM Trans. Model. Comput. Simul. 17(4), Article 18, 16 pages. DOI = 10.1145/1276927.1276931

See Also

ur, unuran.new, unuran.

Examples

## Create a sample of size 100 for a Gamma(-0.5) distribution
pdf <- function (x) { x^(-0.5)*exp(-x) }
dpdf <- function (x) { (-x^(-0.5) - 0.5*x^(-1.5))*exp(-x) }
gen <- itdr.new(pdf=pdf, dpdf=dpdf, lb=0, ub=Inf, pole=0)
x <- ur(gen,100)


[Package Runuran version 0.9.0 Index]