distr (version 1.9)

DiscreteDistribution-class: Class "DiscreteDistribution"

Description

The DiscreteDistribution-class is the mother-class of the class LatticeDistribution.

Usage

DiscreteDistribution(supp, prob, .withArith=FALSE, .withSim=FALSE)
  DiscreteDistribution(supp)

Arguments

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.

Value

  • Object of class "DiscreteDistribution"

Objects from the Class

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.

synopsis

DiscreteDistribution(supp, prob, .withArith = FALSE, .withSim = FALSE)

Extends

Class "UnivariateDistribution", directly. Class "Distribution", by class "UnivariateDistribution".

Internal subclass "AffLinDiscreteDistribution"

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")}

code

"AffLinDistribution"

concept

  • discrete distribution
  • lattice distribution
  • support of a distribution
  • S4 distribution class
  • generating function

Details

If prob is missing, all elements in supp are equally weighted.

See Also

Parameter-class UnivariateDistribution-class LatticeDistribution-class AbscontDistribution-class Reals-class RtoDPQ.d

Examples

Run this code
# 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)

Run the code above in your browser using DataCamp Workspace