# UnivarLebDecDistribution-class

##### Class "UnivarLebDecDistribution"

`UnivarLebDecDistribution`

-class is a class to formalize
a Lebesgue decomposed distribution with a discrete and an
absolutely continuous part; it is a subclass to
class `UnivarMixingDistribution`

.

- Keywords
- distribution

##### Objects from the Class

Objects can be created by calls of the form
`new("UnivarLebDecDistribution", ...)`

.
More frequently they are created via the generating function
`UnivarLebDecDistribution`

.

##### Slots

`mixCoeff`

Object of class

`"numeric"`

: a vector of length 2 of probabilities for the respective a.c. and discrete part of the object`mixDistr`

Object of class

`"UnivarDistrList"`

: a list of univariate distributions containing the a.c. and discrete components; must be of length 2; the first component must be of class`"AbscontDistribution"`

, the second of class`"DiscreteDistribution"`

.`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`

fixed to

`NULL`

`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

`Symmetry`

object of class

`"DistributionSymmetry"`

; used internally to avoid unnecessary calculations.`support`

numeric vector --- the support slot of the discrete part

`gaps`

(numeric) matrix or

`NULL`

; --- the gaps slot of the absolutely continuous part

##### Extends

Class `"UnivarMixingDistribution"`

, directly;
class `"UnivariateDistribution"`

by class `"UnivarMixingDistribution"`

class `"Distribution"`

by class `"UnivariateDistribution"`

.

##### Methods

- show
`signature(object = "UnivarLebDecDistribution")`

- plot
`signature(object = "UnivarLebDecDistribution")`

- acPart
`signature(object = "UnivarLebDecDistribution")`

- acPart<-
`signature(object = "UnivarLebDecDistribution")`

- discretePart
`signature(object = "UnivarLebDecDistribution")`

- discretePart<-
`signature(object = "UnivarLebDecDistribution")`

- acWeight
`signature(object = "UnivarLebDecDistribution")`

- acWeight<-
`signature(object = "UnivarLebDecDistribution")`

- discreteWeight
`signature(object = "UnivarLebDecDistribution")`

- discreteWeight<-
`signature(object = "UnivarLebDecDistribution")`

- p.ac
`signature(object = "UnivarLebDecDistribution")`

accessor to slot`p`

of`acPart(object)`

, possibly weighted by`acWeight(object)`

; it has an extra argument`CondOrAbs`

with default value`"cond"`

which if it does not partially match (by`pmatch`

)`"abs"`

, returns exactly slot`p`

of`acPart(object)`

else weighted by`acWeight(object)`

.- d.ac
`signature(object = "UnivarLebDecDistribution")`

accessor to slot`d`

of the absolutely continuous part of the distribution, possibly weighted by`acWeight(object)`

; it has an extra argument`CondOrAbs`

which acts as the one in`p.ac`

.- q.ac
`signature(object = "UnivarLebDecDistribution")`

accessor to slot`q`

of`acPart(object)`

.- r.ac
`signature(object = "UnivarLebDecDistribution")`

accessor to slot`q`

of`acPart(object)`

.- p.discrete
`signature(object = "UnivarLebDecDistribution")`

accessor to slot`p`

of`discretePart(object)`

, possibly weighted by`discreteWeight(object)`

; it has an extra argument`CondOrAbs`

which acts as the one in`p.ac`

.- d.discrete
`signature(object = "UnivarLebDecDistribution")`

accessor to slot`d`

of`discretePart(object)`

, possibly weighted by`discreteWeight(object)`

; it has an extra argument`CondOrAbs`

which acts as the one in`p.ac`

.- q.discrete
`signature(object = "UnivarLebDecDistribution")`

accessor to slot`q`

of`discretePart(object)`

.- r.discrete
`signature(object = "UnivarLebDecDistribution")`

accessor to slot`r`

of`discretePart(object)`

.- coerce
`signature(from = "AffLinUnivarLebDecDistribution", to = "UnivarLebDecDistribution")`

: create a`"UnivarLebDecDistribution"`

object from a`"AffLinUnivarLebDecDistribution"`

object- coerce
`signature(from = "AbscontDistribution", to = "UnivarLebDecDistribution")`

: create a`"UnivarLebDecDistribution"`

object from a`"AbscontDistribution"`

object- coerce
`signature(from = "DiscreteDistribution", to = "UnivarLebDecDistribution")`

: create a`"UnivarLebDecDistribution"`

object from a`"DiscreteDistribution"`

object- Math
`signature(x = "UnivarLebDecDistribution")`

: application of a mathematical function, e.g.`sin`

or`tan`

to this discrete distribution`abs`

:`signature(x = "UnivarLebDecDistribution")`

: exact image distribution of`abs(x)`

.`exp`

:`signature(x = "UnivarLebDecDistribution")`

: exact image distribution of`exp(x)`

.`sign`

:`signature(x = "UnivarLebDecDistribution")`

: exact image distribution of`sign(x)`

.`sign`

:`signature(x = "AcDcLcDistribution")`

: exact image distribution of`sign(x)`

.`sqrt`

:`signature(x = "AcDcLcDistribution")`

: exact image distribution of`sqrt(x)`

.`log`

:`signature(x = "UnivarLebDecDistribution")`

: (with optional further argument`base`

, defaulting to`exp(1)`

) exact image distribution of`log(x)`

.`log10`

:`signature(x = "UnivarLebDecDistribution")`

: exact image distribution of`log10(x)`

.`sqrt`

:`signature(x = "UnivarLebDecDistribution")`

: exact image distribution of`sqrt(x)`

.`sqrt`

:`signature(x = "AcDcLcDistribution")`

: exact image distribution of`sqrt(x)`

.

- -
`signature(e1 = "UnivarLebDecDistribution")`

: application of `-' to this distribution- *
`signature(e1 = "UnivarLebDecDistribution", e2 = "numeric")`

: multiplication of this distribution by an object of class `numeric'- /
`signature(e1 = "UnivarLebDecDistribution", e2 = "numeric")`

: division of this distribution by an object of class `numeric'- +
`signature(e1 = "UnivarLebDecDistribution", e2 = "numeric")`

: addition of this distribution to an object of class `numeric'- -
`signature(e1 = "UnivarLebDecDistribution", e2 = "numeric")`

: subtraction of an object of class `numeric' from this distribution- *
`signature(e1 = "numeric", e2 = "UnivarLebDecDistribution")`

: multiplication of this distribution by an object of class `numeric'- +
`signature(e1 = "numeric", e2 = "UnivarLebDecDistribution")`

: addition of this distribution to an object of class `numeric'- -
`signature(e1 = "numeric", e2 = "UnivarLebDecDistribution")`

: subtraction of this distribution from an object of class `numeric'- +
`signature(e1 = "UnivarLebDecDistribution", e2 = "UnivarLebDecDistribution")`

: Convolution of two Lebesgue decomposed distributions. Result is again of class`"UnivarLebDecDistribution"`

, but if option`getdistrOption("withSimplify")`

is`TRUE`

it is piped through a call to`simplifyD`

, hence may also be of class`AbscontDistribution`

or`DiscreteDistribution`

.
- -
`signature(e1 = "UnivarLebDecDistribution", e2 = "UnivarLebDecDistribution")`

: Convolution of two Lebesgue decomposed distributions. The same applies as for the preceding item.

##### Internal subclass "AffLinUnivarLebDecDistribution"

To enhance accuracy of several functionals on distributions,
mainly from package distrEx,
there is an internally used (but exported) subclass
`"AffLinUnivarLebDecDistribution"`

which has extra slots
`a`

, `b`

(both of class `"numeric"`

), and `X0`

(of class `"UnivarLebDecDistribution"`

), 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 = "UnivarLebDecDistribution")`

- *
`signature(e1 = "UnivarLebDecDistribution", e2 = "numeric")`

- /
`signature(e1 = "UnivarLebDecDistribution", e2 = "numeric")`

- +
`signature(e1 = "UnivarLebDecDistribution", e2 = "numeric")`

- -
`signature(e1 = "UnivarLebDecDistribution", e2 = "numeric")`

- *
`signature(e1 = "numeric", e2 = "UnivarLebDecDistribution")`

- +
`signature(e1 = "numeric", e2 = "UnivarLebDecDistribution")`

- -
`signature(e1 = "numeric", e2 = "UnivarLebDecDistribution")`

- -
`signature(e1 = "AffLinUnivarLebDecDistribution")`

- *
`signature(e1 = "AffLinUnivarLebDecDistribution", e2 = "numeric")`

- /
`signature(e1 = "AffLinUnivarLebDecDistribution", e2 = "numeric")`

- +
`signature(e1 = "AffLinUnivarLebDecDistribution", e2 = "numeric")`

- -
`signature(e1 = "AffLinUnivarLebDecDistribution", e2 = "numeric")`

- *
`signature(e1 = "numeric", e2 = "AffLinUnivarLebDecDistribution")`

- +
`signature(e1 = "numeric", e2 = "AffLinUnivarLebDecDistribution")`

- -
`signature(e1 = "numeric", e2 = "AffLinUnivarLebDecDistribution")`

There also is a class union of `"AffLinAbscontDistribution"`

,
`"AffLinDiscreteDistribution"`

, `"AffLinUnivarLebDecDistribution"`

and called `"AffLinDistribution"`

which is used for functionals.

##### 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 particular methods for `"*"`

, `"/"`

,
`"^"`

(see operators-methods) and methods
`Minimum`

, `Maximum`

, `Truncate`

, and
`Huberize`

, and `convpow`

are defined for this
class union.

##### See Also

`Parameter-class`

`UnivarMixingDistribution-class`

`DiscreteDistribution-class`

`AbscontDistribution-class`

`simplifyD`

`flat.LCD`

##### Examples

```
# NOT RUN {
wg <- flat.mix(UnivarMixingDistribution(Unif(0,1),Unif(4,5),
withSimplify=FALSE))
myLC <- UnivarLebDecDistribution(discretePart=Binom(3,.3), acPart = wg,
discreteWeight=.2)
myLC
p(myLC)(0.3)
r(myLC)(30)
q(myLC)(0.9)
## in RStudio or Jupyter IRKernel, use q.l(.)(.) instead of q(.)(.)
acPart(myLC)
plot(myLC)
d.discrete(myLC)(2)
p.ac(myLC)(0)
acWeight(myLC)
plot(acPart(myLC))
plot(discretePart(myLC))
gaps(myLC)
support(myLC)
plot(as(Norm(),"UnivarLebDecDistribution"))
# }
```

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