DiscreteDistribution-class {distr} | R Documentation |
The DiscreteDistribution
-class is the mother-class of the class LatticeDistribution
.
DiscreteDistribution(supp, prob, .withArith=FALSE, .withSim=FALSE) DiscreteDistribution(supp)
supp |
numeric vector which forms the support of the discrete distribution. |
prob |
vector of probability weights for the
elements of supp . |
.withArith |
normally not set by the user, but if determining the entries supp , prob
distributional arithmetics was involved, you may set this to TRUE . |
.withSim |
normally not set by the user, but if determining the entries supp , prob
simulations were involved, you may set this to TRUE . |
If prob
is missing, all elements in supp
are equally weighted.
Object of class "DiscreteDistribution"
Objects can be created by calls of the generating function "DiscreteDistribution"
.
This generating function, from version 1.9 on, has been moved to this package from package distrEx.
img
:"Reals"
: the space of the image of this distribution which has dimension 1
and the name "Real Space" param
:"Parameter"
: the parameter of this distribution, having only the
slot name "Parameter of a discrete distribution" r
:"function"
: generates random numbersd
:"function"
: density/probability functionp
:"function"
: cumulative distribution functionq
:"function"
: quantile function.withArith
:.withSim
:support
:"numeric"
: a (sorted) vector containing the support of the discrete
density function
Class "UnivariateDistribution"
, directly.
Class "Distribution"
, by class "UnivariateDistribution"
.
signature(.Object = "DiscreteDistribution")
: initialize method signature(x = "DiscreteDistribution")
: application of a mathematical function, e.g. sin
or
exp
(does not work with log
!), to this discrete distributionsignature(e1 = "DiscreteDistribution")
: application of `-' to this discrete distributionsignature(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 supportsignature(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.;
q.r(s)=sup{t|P(object>=t)<=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"
and
"AffLinDiscreteDistribution"
called "AffLinDistribution"
which is used for functionals.
Working with a computer, we use a finite interval as support which carries at least mass 1-getdistrOption("TruncQuantile")
.
Thomas Stabla statho3@web.de,
Florian Camphausen fcampi@gmx.de,
Peter Ruckdeschel Peter.Ruckdeschel@uni-bayreuth.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) q.r(D2)(pp) q.r(D2)(pp-1e-5) q.r(D2)(pp+1e-5)