Runuran-package {Runuran} | R Documentation |
R interface to the UNU.RAN library for Universal Non-Uniform RANdom variate generators
Package: | Runuran |
Type: | Package |
Version: | 0.5 |
Date: | 2007-08-01 |
License: | GPL 2 or later |
This package provides an interface to the UNU.RAN library for universal non-uniform random number generators.
It provides the following two main calls:
unuran.new(dist,method)
unuran.new
.
unuran.sample(unuran.object,sample.size)
unuran.sample
.
It uses the R built-in uniform random number generator.
The Runuran package makes use of the string API of UNU.RAN,
i.e., distributions and methods are described as strings and passed
directly to UNU.RAN. The Runuran uses S4 classes to implemented
this interface to UNU.RAN.
Alternatively distributions can also be passed by
means of S4 classes that contain the required information.
See unuran.new
for a short introduction to the interface.
Additionally there are some shortcuts that allow provide an easy to
use interface: urdgt
and urdau
for
discrete distributions with given probability vectors,
and urtdr
for log-concave distributions with given
density function.
To facilitate the use of the package for standard distributions the package also includes direct generation functions for approximately 30 standard distributions.
For continuous univariate distributions these calls are:
urbeta
,
urburr
,
urcauchy
,
urchi
,
urchisq
,
urexp
,
urextremeI
,
urextremeII
,
urf
,
urgamma
,
urgig
,
urhyperbolic
,
urlaplace
,
urlnorm
,
urlogis
,
urlomax
,
urnorm
,
urpareto
,
urplanck
,
urpowerexp
,
urrayleigh
,
urt
,
urtriang
, and
urweibull
.
For discrete distributions these are:
urbinom
,
urgeom
,
urhyper
,
urlogarithmic
,
urnbinom
, and
urpois
.
All these calls 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 slightly different behavior.
ur
functions are often much faster (e.g. a factor) of
about 5 for the t distribution when the sample size is
large. For small samples the ur
functions are slow.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 ur
functions.ur
functions are based on fast numerical
inversion algorithms. This is important for example for generating
order statistics or random vectors from copulas.ur
functions do not allow vectors as
arguments (to be more precise: they only use the first element of
the vector).The interface has been changed compared to the DSC 2003 paper.
Josef Leydold and Wolfgang H"ormann unuran@statmath.wu-wien.ac.at.
J. Leydold and W. H"ormann (2000-2007): 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.
unuran
, unuran.new
,
unuran.sample
, unuran.distr
.