Learn R Programming

Runuran (version 0.10.1)

Runuran-package: 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

Arguments

pkg

Runuran

code

uq

[Distribution]

These functions have similar syntax to the analogous Rbuilt-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 Rfunctions these ur functions have a different behavior:

  • --
{ur functions are often much faster for large samples (e.g., a factor of about 5 for the $t$ distribution). For small samples they are slow.} --{All ur functions allow to sample from truncated versions of the original distributions. Therefore the arguments lb (lower border) and ub (upper border) are available for all these functions.} --{Allmost all ur functions are based on fast numerical inversion algorithms. This is important for example for generating order statistics or random vectors from copulas.} --{All ur functions do not allow vectors as arguments (to be more precise: they only use the first element of the vector).}

tabular

  • lcl
  • lcl
  • lcl
  • lcl

emph

  • Function
  • Function
  • Function
  • generation method
  • draw samples
  • Function

tab

[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: lcl{ 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: lcl{ Function Method dari.new ... Discrete Automatic Rejection Inversion dau.new ... Alias-Urn Method dgt.new ... Guide-Table Method for discrete inversion } Multivariate Distributions: lcl{ 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:
  • 1.
{ Create a unuran.distr object that contains all required information about the target distribution. We have three types of distribuions:}

itemize

  • 2.

dQuote

method string

item

3.

Uniform random numbers

All UNU.RAN methods use the Rbuilt-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 Rsessions, nor is it possible to copy such objects to different nodes in a computer cluster.

However, unuran objects for some generation methods can be packed, see unuran.packed. Then these objects can be handled like any other Robject (and thus saved and restored).

All other objects must be newly created in a new Rsession! (Using a restored object does not work as the unuran is then broken.)

Details

ll{ Package: Runuran Type: Package Version: 0.10.1 Date: 2009-08-06 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): [object Object],[object Object],[object Object]

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.