Learn R Programming

Runuran (version 0.40)

Runuran.special.generators: Generators for distributions based on methods from the UNU.RAN library

Description

Generators for particular distributions. Their syntax is similar to the corresponding R built-in functions.

Arguments

Author

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

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. However, we found that this approach is a little bit confusing for the beginner.

Thus we have prepared easy-to-use sampling functions for standard distributions to facilitate the use of the package. All these functions share a similar syntax and naming scheme (only u is prefixed) with their analogous R built-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)

These functions also show the interested user how we used the more powerful functions. We recommend to directly use these more flexible functions. Then one has faster marginal generation times and one may choose the best generation method for one's application.

Currently generators for the following distributions are implemented.

Continuous Univariate Distributions (24):

FunctionDistribution
urbeta...Beta
urburr...Burr
urcauchy...Cauchy
urchi...Chi
urchisq...Chi-squared
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):

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

See Also

Runuran-package, Runuran.distributions.

Examples

Run this code
## draw a sample of size 100 from a
## gamma distribution with shape parameter 5
x <- urgamma(n=100, shape=5)

## draw a sample of size 100 from a
## half normal distribution
x <- urnorm(n=100, lb=0, ub=Inf)

Run the code above in your browser using DataLab