distr -- object orientated implementation of distributions
Distribution is introduced with slots for a
parameter and ---most important--- for the four constitutive methods
q for simulation respectively for evaluation of
density / c.d.f. and quantile function of the corresponding distribution.
Most distributions of package
DiscreteDistribution, which themselves are again subclasses of
Up to arguments referring to a parameter of the distribution (like
mean for the normal distribution), these function slots have the
same arguments as those of package
X we may call these functions as
d(X)(x, log = FALSE)
p(X)(q, lower.tail = TRUE, log.p = FALSE)
q(X)(p, lower.tail = TRUE, log.p = FALSE)
rnorm. Note that, as usual, slots
qare vectorized in their first argument, but are not on the subsequent ones. Arithmetics and unary mathematical transformations for distributions are available: For
3*X+sin(exp(-Y/4+3))have their natural interpretation as corresponding image distributions.
Arithmetics on distribution objects are understood as operations on
corresponding (independent) r.v.'s and not on distribution functions
Some functions of package
Accuracy of these arithmetics is controlled by global options which may
be inspected / set by
confer distroptions .
Distribution classes have a slot
param the class of which
is is specialized for the particualar distributions. The parameter
classes for the particular distributions have slots with names
according to the corresponding [rdpq]
AbscontDistribution and descendants have
gaps for gaps in the support.
DiscreteDistribution and descendants have
an additional slot
support, which is again specialized
to be a lattice for class
For saved objects from earlier versions, we provide the methods
to check whether the object was generated by an older version of
this package and to convert such an object to the new format,
respectively. This applies to objects of subclasses of
AbscontDistribution lacking a
gap-slot as well as to
to objects of subclasses of
LatticeDistribution lacking a
To enhance accuracy, from version 1.9 on, we also provide
AffLinLatticeDistribution, as well as the class union
AffLinDistribution, so that in particular functionals like
reflect the fact, that a distribution object of theses classes has the
same distribution as
For all particular distributions, as well as for classes
generating functions are provided, e.g.
X <- Norm(mean = 3, sd = 2).
The same goes for the space classes.
All slots should be inspected / modified by means of corresponding
accessor- /replacement functions; e.g.
mean(X) <- 3
Again to enhance accuracy, from version 2.0 on, we also provide
UnivarMixingDistribution to support mixing distributions,
UnivarLebDecDistribution, to support Lebesgue decomposed distributions
(with a discrete and an a.c. part) as well as
for corresponding affine linear transformations.
UnivarLebDecDistribution is closed under arithmetical operations
^ for pairs of independent variables
- for pairs of independent variables
+ affine linear transformations
+ truncation, huberization, min/max
which are all now available analytically.
(see Parameter classes).
[*]: there is a generating function with the same name
Math of unary (see Math) as well as
convolution are made available for distributions, see operators-methods;
in particular for convolution powers, we have method convpow.
Besides, there are
liesIn, for the
DicreteDistribution class, we have
liesInSupport, as well
as a generating function.
The "history" of distributions
obtained by chaining operations may be shortened using
RtoDPQ Default procedure to fill slots d,p,q given r for a.c. distributions RtoDPQ.d Default procedure to fill slots d,p,q given r for discrete distributions RtoDPQ.LC Default procedure to fill slots d,p,q given r for Lebesgue decomposed distributions decomposePM decomposes a distribution into positive and negative part and, if discrete, into part '0' simplifyD tries to reduce/simplify mixing distribution using that certain weights are 0 flat.LCD makes a single UnivarLebDecDistribution out of a list of UnivarLebDecDistribution with corresp. weights flat.mix makes a single UnivarLebDecDistribution out of a list of a UnivarMixingDistribution distroptions Functions to change the global variables of the package 'distr' standardMethods Utility to automatically generate accessor and replacement functions
Note: The first two numbers of package versions do not necessarily reflect package-individual development, but rather are chosen for the distrXXX family as a whole in order to ease updating "depends" information.
We thank Martin Maechler, Josef Leydold, John Chambers, Duncan Murdoch, Gregory Warnes, Paul Gilbert, Kurt Hornik, Uwe Ligges, Torsten Hothorn, and Seth Falcon for their help in preparing this package.
You may suppress the start-up banner/message completely by setting
options("StartupBanner"="off") somewhere before loading this
require in your R-code / R-session.
"StartupBanner" is not defined (default) or setting
options("StartupBanner"="complete") the complete start-up banner is
For any other value of option
(i.e., not in
only the version information is displayed.
The same can be achieved by wrapping the
call into either
As for general
packageStartupMessage's, you may also suppress all
the start-up banner by wrapping the
Demos are available --- see
- absolutely continuous distribution
- discrete distribution
- lattice distribution
- S4 classes
- arithmetics for distributions
- S4 parameter class
- S4 distribution class
- S4 space class
P. Ruckdeschel, M. Kohl, T. Stabla, F. Camphausen (2006):
S4 Classes for Distributions, R News, 6(2), 2-6.
a homepage to this package is available under
X <- Unif(2,3) Y <- Pois(lambda = 3) Z <- X+Y # generates Law of corresponding independent variables p(Z)(0.2) r(Z)(1000) plot(Z+sin(Norm()))