Runuran.distributions: UNU.RAN distribution objects

Runuran.distributionsR Documentation

UNU.RAN distribution objects

Description

Create objects for particular distributions suitable for using with generation methods from the UNU.RAN library.

Details

Runuran provides an interface to the UNU.RAN library for universal non-uniform random number generators. This is a very flexible and powerful collection of sampling routines, where the user first has to specify the target distribution and then has to choose an appropriate sampling method.

Creating an object for a particular distribution can be a bit tedious especially if the target distribution has a more complex density function. Thus we have compiled a set of functions that provides ready-to-use distribution objects. Moreover, using these object often results in faster setup time than objects created with pure R code.

These functions share a similar syntax and naming scheme (only ud is prefixed) with analogous R built-in functions that provide density, distribution function and quantile:

ud...(distribution parameters, lb , ub)

Currently generators for the following distributions are implemented.

Continuous Univariate Distributions (26):

Function Distribution
udbeta ... Beta
udcauchy ... Cauchy
udchi ... Chi
udchisq ... Chi-squared
udexp ... Exponential
udf ... F
udfrechet ... Frechet (Extreme value type II)
udgamma ... Gamma
udghyp ... Generalized Hyperbolic
udgig ... Generalized Inverse Gaussian
udgumbel ... Gumbel (Extreme value type I)
udhyperbolic ... Hyperbolic
udig ... Inverse Gaussian (Wald)
udlaplace ... Laplace (double exponential)
udlnorm ... Log Normal
udlogis ... Logistic
udlomax ... Lomax (Pareto of second kind)
udmeixner ... Meixner
udnorm ... Normal (Gaussian)
udpareto ... Pareto (of first kind)
udpowerexp ... Powerexponential (Subbotin)
udrayleigh ... Rayleigh
udslash ... Slash
udt ... t (Student)
udvg ... Variance Gamma
udweibull ... Weibull (Extreme value type III)

Discrete Distributions (6):

Function Distribution
udbinom ... Binomial
udgeom ... Geometric
udhyper ... Hypergeometric
udlogarithmic ... Logarithmic
udnbinom ... Negative Binomial
udpois ... Poisson

Author(s)

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

See Also

Runuran-package.

Examples

## Create an object for a gamma distribution with shape parameter 5.
distr <- udgamma(shape=5)
## Create the UNU.RAN generator object. use method PINV (inversion).
gen <- pinvd.new(distr)
## Draw a sample of size 100
x <- ur(gen, 100)
## Compute some quantiles for Monte Carlo methods
x <- uq(gen, (1:9)/10)

## Analogous for half normal distribution
distr <- udnorm(lb=0, ub=Inf)
gen <- pinvd.new(distr)
x <- ur(gen, 100)
x <- uq(gen, (1:9)/10)

## Analogous for a generalized hyperbolic distribution
distr <- udghyp(lambda=-1.0024, alpha=39.6, beta=4.14, delta=0.0118, mu=-0.000158)
gen <- pinvd.new(distr)
x <- ur(gen, 100)
x <- uq(gen, (1:9)/10)

## It is also possible to compute density or distribution functions.
## However, this might not work for all generator objects.
##    Density
x <- ud(gen, 1.2)
##    Cumulative distribution function
x <- up(gen, 1.2)


Runuran documentation built on Jan. 17, 2023, 5:17 p.m.