up | R Documentation |
Evaluates the (approximate) cumulative distribution function (CDF) of a "unuran" object for a continuous or discrete distribution.
up(obj, x)
obj |
one of
|
x |
vector of x values. (numeric) |
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):
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.
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’.
Neither the CDF nor its approximation is available in object
obj
: NA
is returned and a warning is thrown.
The generator object must not be packed (see
unuran.packed
).
Josef Leydold and Wolfgang H\"ormann unuran@statmath.wu.ac.at.
W. H\"ormann, J. Leydold, and G. Derflinger (2004): Automatic Nonuniform Random Variate Generation. Springer-Verlag, Berlin Heidelberg.
unuran.cont
,
unuran.discr
,
unuran
,
pinv.new
.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.