Runuran-package {Runuran}R Documentation

Runuran – R interface to Universal Non-Uniform RANdom variate generators library

Description

R interface to the UNU.RAN library for Universal Non-Uniform RANdom variate generators

Details

Package: Runuran
Type: Package
Version: 0.9.0
Date: 2009-02-26
License: GPL 2 or later
Runuran provides an interface to the UNU.RAN library for universal non-uniform random number generators. It compiles three sets of functions of increasing power (and thus complexity):

[Distribution] – Generators for paricular distributions. Their syntax is similar to the corresponding R built-in functions.
[Universal] – Functions that offer an interface to a carefully selected collection of UNU.RAN methods with their most important parameters.
[Advanced] – Wrapper to the UNU.RAN string API. This gives access to all UNU.RAN methods and their variants.

We have marked all functions in their corresponding help page by one these three tags.

An introduction to Runuran with examples together with a very short survey on non-uniform random variate generation can be found in the package vignette (which can be displayed using vignette("Runuran")).

[Distribution]

These functions have similar syntax to the analogous R built-in generating functions (if these exist) but have an optional domain arguments lb and ub, i.e., these calls also allow to draw samples from truncated distributions:

ur...(n, distribution parameters, lb , ub)

Compared to the corresponding R functions these ur functions have a different behavior:

Currently generators for the following distributions are implemented.

Continuous Univariate Distributions (24):

Function Distribution
urbeta ... Beta
urburr ... Burr
urcauchy ... Cauchy
urchi ... Chi
urchisq ... Chi-square
urexp ... Exponential
urextremeI ... Gumbel (extreme value type I)
urextremeII ... Frechet (extreme value type II)
urf ... F
urgamma ... Gamma
urgig ... GIG (generalized inverse Gaussian)
urhyperbolic ... Hyperbolic
urlaplace ... Laplace
urlnorm ... Log-Normal
urlogis ... Logistic
urlomax ... Lomax
urnorm ... Normal (Gaussian)
urpareto ... Pareto (of first kind)
urplanck ... Planck
urpowerexp ... Powerexponential (Subbotin)
urrayleigh ... Rayleigh
urt ... t (Student)
urtriang ... Triangular
urweibull ... Weibull

Discrete Distributions (6):

Function Distribution
urbinom ... Binomial
urgeom ... Geometric
urhyper ... Hypergeometric
urlogarithmic ... Logarithmic
urnbinom ... Negative Binomial
urpois ... Poisson

[Universal]

These functions allow access to a selected collection of UNU.RAN methods. They require some data about the target distribution as arguments and return an instance of a UNU.RAN generator object that is implemented as an S4 class unuran. These can then be used to draw samples from the desired distribution by means of function ur. Methods that implement an inversion method can also be used for quantile function uq.

Currently the following methods are available by such functions.

Continuous Univariate Distributions:

Function Method
ars.new ... Adaptive Rejection Sampling
itdr.new ... Inverse Transformed Density Rejection
pinv.new ... Polynomial interpolation of INVerse CDF
srou.new ... Simple Ratio-Of-Uniforms method
tdr.new ... Transformed Density Rejection

Discrete Distributions:

Function Method
dari.new ... Discrete Automatic Rejection Inversion
dau.new ... Alias-Urn Method
dgt.new ... Guide-Table Method for discrete inversion

Multivariate Distributions:

Function Method
hitro.new ... Hit-and-Run with Ratio-of-Uniforms method
vnrou.new ... Multivariate Naive Ratio-Of-Uniforms method

[Advanced]

This interface provides the most flexible access to UNU.RAN. It requires three steps:

Function Type of distribution
unuran.cont.new ... continuous distributions
unuran.discr.new ... discrete distributions
unuran.cmv.new ... multivariate continuous distributions
Function
ur ... draw sample
uq ... compute quantile (inverse CDF)
unuran.details ... show unuran object

Uniform random numbers

All UNU.RAN methods use the R built-in random number generator as source of (pseudo-) random numbers. Thus the generated samples depend on the state .Random.seed and can be controlled by the R functions RNGkind and set.seed.

Warning

unuran objects cannot be saved and restored in later R sessions, nor is it possible to copy such objects to different nodes in a computer cluster. They must be newly created!

Note

The interface has been changed compared to the DSC 2003 paper.

Author(s)

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

References

J. Leydold and W. H"ormann (2000-2008): UNU.RAN User Manual, see http://statmath.wu-wien.ac.at/unuran/.

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

G.~Tirler and J.~Leydold (2003): Automatic Nonuniform Random Variate Generation in R. In: K.~Hornik and F.~Leisch, Proceedings of the 3rd International Workshop on Distributed Statistical Computing (DSC~2003), March 20–22, Vienna, Austria.

See Also

All objects are implemented as respective S4 classes unuran, unuran.distr, unuran.cont, unuran.discr, unuran.


[Package Runuran version 0.9.0 Index]