The DiscreteDistribution
-class is the mother-class of the class LatticeDistribution
.
Objects can be created by calls to new("DiscreteDistribution", ...)
, but more
easily is the use of the generating function "DiscreteDistribution"
.
This generating function, from version 1.9 on, has been moved to this package from package distrEx.
img
Object of class "Reals"
: the space of the image of this distribution which has dimension 1
and the name "Real Space"
param
Object of class "Parameter"
: the parameter of this distribution, having only the
slot name "Parameter of a discrete distribution"
r
Object of class "function"
: generates random numbers
d
Object of class "function"
: density/probability function
p
Object of class "function"
: cumulative distribution function
q
Object of class "function"
: quantile function
.withArith
logical: used internally to issue warnings as to interpretation of arithmetics
.withSim
logical: used internally to issue warnings as to accuracy
.logExact
logical: used internally to flag the case where there are explicit formulae for the log version of density, cdf, and quantile function
.lowerExact
logical: used internally to flag the case where there are explicit formulae for the lower tail version of cdf and quantile function
.finSupport
logical: used internally to check whether the
true support is finite; in case img
is one-dimensional, it is
of length 2 (left and right end).
Symmetry
object of class "DistributionSymmetry"
;
used internally to avoid unnecessary calculations.
Class "UnivariateDistribution"
, directly.
Class "Distribution"
, by class "UnivariateDistribution"
.
signature(.Object = "DiscreteDistribution")
: initialize method
signature(from = "DiscreteDistribution",
to = "LatticeDistribution")
: coerce method to class "LatticeDistribution"
(checks if support is a lattice)
signature(x = "DiscreteDistribution")
: application of a mathematical function, e.g. sin
or tan
to this discrete distribution
abs
: signature(x = "DiscreteDistribution")
: exact image distribution of abs(x)
.
exp
: signature(x = "DiscreteDistribution")
: exact image distribution of exp(x)
.
sign
: signature(x = "DiscreteDistribution")
: exact image distribution of sign(x)
.
sqrt
: signature(x = "DiscreteDistribution")
: exact image distribution of sqrt(x)
.
log
: signature(x = "DiscreteDistribution")
: (with optional further argument base
, defaulting to exp(1)
) exact image distribution of log(x)
.
log10
: signature(x = "DiscreteDistribution")
: exact image distribution of log10(x)
.
gamma
: signature(x = "DiscreteDistribution")
: exact image distribution of gamma(x)
.
lgamma
: signature(x = "DiscreteDistribution")
: exact image distribution of lgamma(x)
.
digamma
: signature(x = "DiscreteDistribution")
: exact image distribution of digamma(x)
.
signature(e1 = "DiscreteDistribution")
: application of `-' to this discrete distribution
signature(e1 = "DiscreteDistribution", e2 = "numeric")
: multiplication of this discrete distribution
by an object of class `numeric'
signature(e1 = "DiscreteDistribution", e2 = "numeric")
: division of this discrete distribution
by an object of class `numeric'
signature(e1 = "DiscreteDistribution", e2 = "numeric")
: addition of this discrete distribution
to an object of class `numeric'
signature(e1 = "DiscreteDistribution", e2 = "numeric")
: subtraction of an object of class `numeric'
from this discrete distribution
signature(e1 = "numeric", e2 = "DiscreteDistribution")
: multiplication of this discrete distribution
by an object of class `numeric'
signature(e1 = "numeric", e2 = "DiscreteDistribution")
: addition of this discrete distribution
to an object of class `numeric'
signature(e1 = "numeric", e2 = "DiscreteDistribution")
: subtraction of this discrete distribution
from an object of class `numeric'
signature(e1 = "DiscreteDistribution", e2 = "DiscreteDistribution")
: Convolution of two discrete
distributions. The slots p, d and q are approximated on a common grid.
signature(e1 = "DiscreteDistribution", e2 = "DiscreteDistribution")
: Convolution of two discrete
distributions. The slots p, d and q are approximated on a common grid.
signature(object = "DiscreteDistribution")
: returns the support
signature(object = "DiscreteDistribution")
: returns the
left continuous cumulative distribution function, i.e.;
\(p.l(t) = P(object < t)\)
signature(object = "DiscreteDistribution")
: returns the
right-continuous quantile function, i.e.;
\({\rm q.r}(s)=\sup\{t \,\big|\, P({\tt object}\ge t)\leq s\}\)
signature(object = "DiscreteDistribution")
: plots density, cumulative distribution and quantile
function
To enhance accuracy of several functionals on distributions,
mainly from package distrEx, from version 1.9 of this package on,
there is an internally used (but exported) subclass
"AffLinDiscreteDistribution"
which has extra slots
a
, b
(both of class "numeric"
), and X0
(of class "DiscreteDistribution"
), to capture the fact
that the object has the same distribution as a * X0 + b
. This is
the class of the return value of methods
signature(e1 = "DiscreteDistribution")
signature(e1 = "DiscreteDistribution", e2 = "numeric")
signature(e1 = "DiscreteDistribution", e2 = "numeric")
signature(e1 = "DiscreteDistribution", e2 = "numeric")
signature(e1 = "DiscreteDistribution", e2 = "numeric")
signature(e1 = "numeric", e2 = "DiscreteDistribution")
signature(e1 = "numeric", e2 = "DiscreteDistribution")
signature(e1 = "numeric", e2 = "DiscreteDistribution")
signature(e1 = "AffLinDiscreteDistribution")
signature(e1 = "AffLinDiscreteDistribution", e2 = "numeric")
signature(e1 = "AffLinDiscreteDistribution", e2 = "numeric")
signature(e1 = "AffLinDiscreteDistribution", e2 = "numeric")
signature(e1 = "AffLinDiscreteDistribution", e2 = "numeric")
signature(e1 = "numeric", e2 = "AffLinDiscreteDistribution")
signature(e1 = "numeric", e2 = "AffLinDiscreteDistribution")
signature(e1 = "numeric", e2 = "AffLinDiscreteDistribution")
There also is a class union of "AffLinAbscontDistribution"
,
"AffLinDiscreteDistribution"
, "AffLinUnivarLebDecDistribution"
and called "AffLinDistribution"
which is used for functionals.
As many operations should be valid no matter whether the operands
are of class "AbscontDistribution"
,
"DiscreteDistribution"
, or "UnivarLebDecDistribution"
,
there is a class union of these classes called "AcDcLcDistribution"
;
in partiucalar methods for "*"
, "/"
,
"^"
(see operators-methods) and methods
Minimum
, Maximum
, Truncate
, and
Huberize
, and convpow
are defined for this
class union.
Thomas Stabla statho3@web.de,
Florian Camphausen fcampi@gmx.de,
Peter Ruckdeschel peter.ruckdeschel@uni-oldenburg.de,
Matthias Kohl Matthias.Kohl@stamats.de
Parameter-class
UnivariateDistribution-class
LatticeDistribution-class
AbscontDistribution-class
Reals-class
RtoDPQ.d
# Dirac-measure at 0
D1 <- DiscreteDistribution(supp = 0)
support(D1)
# simple discrete distribution
D2 <- DiscreteDistribution(supp = c(1:5), prob = c(0.1, 0.2, 0.3, 0.2, 0.2))
plot(D2)
(pp <- p(D2)(support(D2)))
p(D2)(support(D2)-1e-5)
p(D2)(support(D2)+1e-5)
p.l(D2)(support(D2))
p.l(D2)(support(D2)-1e-5)
p.l(D2)(support(D2)+1e-5)
q(D2)(pp)
q(D2)(pp-1e-5)
q(D2)(pp+1e-5)
## in RStudio or Jupyter IRKernel, use q.l(.)(.) instead of q(.)(.)
q.r(D2)(pp)
q.r(D2)(pp-1e-5)
q.r(D2)(pp+1e-5)
Run the code above in your browser using DataLab