# DiscreteDistribution-class

##### Class "DiscreteDistribution"

The `DiscreteDistribution`

-class is the mother-class of the class `LatticeDistribution`

.

- Keywords
- distribution

##### Note

Working with a computer, we use a finite interval as support which
carries at least mass `1-getdistrOption("TruncQuantile")`

.
Also, we require that support points have distance at least
`getdistrOption("DistrResoltion")`

, if this condition fails,
upon a suggestion by Jacob van Etten, `getdistrOption("DistrCollapse")`

to
decide whether we use collapsing or not. If we do so, we collapse support
points if they are too close to each other, taking
the (left most) median among them as new support point which accumulates
all the mass of the collapsed points.
With `getdistrOption("DistrCollapse")==FALSE`

, we at least collapse
points according to the result of `unique()`

, and if after this
collapsing, the minimal distance is less than `getdistrOption("DistrResoltion")`

,
we throw an error. By `getdistrOption("DistrCollapse.Unique.Warn")`

,
we control, whether we throw a warning upon collapsing or not.

##### Objects from the Class

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

##### Extends

Class `"UnivariateDistribution"`

, directly.
Class `"Distribution"`

, by class `"UnivariateDistribution"`

.

##### Internal virtual superclass "AcDcLcDistribution"

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.

##### concept

- discrete distribution
- lattice distribution
- support of a distribution
- S4 distribution class

##### See Also

`Parameter-class`

`UnivariateDistribution-class`

`LatticeDistribution-class`

`AbscontDistribution-class`

`Reals-class`

`RtoDPQ.d`

##### Examples

```
# 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)
```

*Documentation reproduced from package distr, version 2.3.1, License: LGPL-3*