Learn R Programming

Runuran (version 0.40)

unuran.cont.new: Create a UNU.RAN continuous univariate distribution object

Description

Create a new UNU.RAN object for a continuous univariate distribution. The interface might be changed in future releases. Do not use unnamed arguments!

[Advanced] -- Continuous Distribution.

Usage

unuran.cont.new( cdf=NULL, pdf=NULL, dpdf=NULL, islog=FALSE,
                 lb=NA, ub=NA, mode=NA, center=NA, area=NA, name=NA)

Arguments

cdf

cumulative distribution function. (R function)

pdf

probability density function. (R function)

dpdf

derivative of the pdf. (R function)

islog

whether the given cdf and pdf are given by their logarithms (the dpdf is then the derivative of the logarithm). (boolean)

lb

lower bound of domain; use -Inf if unbounded from left. (numeric)

ub

upper bound of domain; use Inf if unbounded from right. (numeric)

mode

mode of distribution. (numeric)

center

typical point (“center”) of distribution. If not given the mode is used. (numeric)

area

area below pdf; used for computing normalization constants if required. (numeric)

name

name of distribution. (string)

Author

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

Details

Creates an instance of class unuran.cont.

The user is responsible that the given informations are consistent. It depends on the chosen method which information must be given / are used.

References

W. H\"ormann, J. Leydold, and G. Derflinger (2004): Automatic Nonuniform Random Variate Generation. Springer-Verlag, Berlin Heidelberg.

See Also

unuran.cont, unuran.new, unuran.

Examples

Run this code
## Get a distribution object with given pdf, domain and mode
mypdf <- function (x) { exp(-x) }
distr <- unuran.cont.new(pdf=mypdf, islog=FALSE, lb=0, ub=Inf, mode=0)

## This object can now be used to create an generator object.
## 1. select a method using a Runuran function:
gen <- pinvd.new(distr, uresolution=1e-12)

## 2. directly use the UNU.RAN string API
gen <- unuran.new(distr, method="pinv; u_resolution=1e-12")

Run the code above in your browser using DataLab