up function

Distribution function for "unuran" object

Distribution function for "unuran" object

Evaluates the (approximate) cumulative distribution function (CDF) of a "unuran" object for a continuous or discrete distribution.

up(obj, x)

Arguments

  • obj: one of

    • a distribution object of class "unuran.cont"

      that contains the CDF, or

    • a distribution object of class "unuran.discr"

      that contains the CDF, or

    • a generator object (class "unuran") that contains a CDF or implements method PINV .

  • x: vector of x values. (numeric)

Details

The routine evaluates the cumulative distribution function of a distribution stored in a UNU.RAN distribution object or UNU.RAN generator object.

For the computation of the CDF the following alternatives are tried (in the given order):

  1. The CDF is available in object obj: the function is evaluated and the result is returned.

    Important:

    In this case routine up just evaluates the CDF but ignores the boundaries of the domain of the distribution, i.e., it does not return 0 and 1, resp., outside the domain unless the implementation of the CDF handles this case correctly. This behavior is in particular important when Runuran

    built-in distributions are truncated by explicitly setting the domain boundaries.

  2. Object obj is a generator object that implements method PINV : In this case an approximate value for the CDF is returned. The approximation error is about one tenth of the requested uresolution for method PINV .

  3. Neither the CDF nor its approximation is available in object obj: NA is returned and a warning is thrown.

Note

The generator object must not be packed (see unuran.packed).

See Also

unuran.cont, unuran.discr, unuran, pinv.new.

References

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

Author(s)

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

Examples

## Create an UNU.RAN distribution object (for standard Gaussian) ## and evaluate distribution function for some points distr <- udnorm() up(distr, 1.5) up(distr, -3:3) ## Create an UNU.RAN generator object (for standard Gaussian) ## and evaluate distribution function of underyling distribution unr <- tdrd.new(udnorm()) up(unr, 1.5) up(unr, -3:3) ## Create an UNU.RAN generator object that does not contain ## the CDF but implements method PINV. unr <- pinv.new(pdf=function(x){exp(-x)}, lb=0,ub=Inf) up(unr, 0:5)
  • Maintainer: Josef Leydold
  • License: GPL (>= 2)
  • Last published: 2025-04-07