Learn R Programming

Runuran (version 0.21.0)

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

[Special Generator]

These functions have similar syntax to the analogous Rbuilt-in generating functions (if these exist) but have 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.
  • Allur...functions allow to sample from truncated versions of the original distributions. Therefore the argumentslb(lower border) andub(upper border) are available for all these functions.
  • Almost allur...functions are based on fast numerical inversion algorithms. This is important for example for generating order statistics, quasi-Monte Carlo methods or random vectors from copulas.
  • Allur...functions donotallow vectors as arguments (to be more precise: they only use the first element of the vector).

However, we recommend to use the more flexible approach described in the next sections below.

A list of all available special generators can be found in Runuran.special.generators.

[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 }

[Distribution]

Coding the required functions for particular distributions can be tedious. Thus we have compiled a set of functions that create UNU.RAN distribution objects that can directly be used with the functions from section [Universal].

A list of all available distributions can be found in Runuran.distributions.

Details

ll{ Package: Runuran Type: Package Version: 0.21.0 Date: 2014-08-28 License: GPL 2 or later } Runuran provides an interface to the UNU.RAN library for universal non-uniform random number generators. It provides a collection of so called automatic methods for non-uniform random variate generation. Thus it is possible to draw samples from uncommon distributions. Nevertheless, (some of) these algorithms are also well suited for standard distribution like the normal distribution. Moreover, sampling from distributions like the generalized hyperbolic distribution is very fast. Such distributions became recently popular in financial engineering.

Runuran compiles four sets of functions of increasing power (and thus complexity): [object Object],[object Object],[object Object],[object Object] We have marked all functions in their corresponding help page by one these four 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")).