Learn R Programming

distr (version 2.9.5)

DiscreteDistribution: Generating function "DiscreteDistribution"

Description

Generates an object of class "DiscreteDistribution"

Usage

DiscreteDistribution(supp, prob, .withArith=FALSE, .withSim=FALSE, 
                       .lowerExact = TRUE, .logExact = FALSE,
             .DistrCollapse = getdistrOption("DistrCollapse"),
             .DistrCollapse.Unique.Warn = 
                  getdistrOption("DistrCollapse.Unique.Warn"),
             .DistrResolution = getdistrOption("DistrResolution"),
             Symmetry = NoSymmetry())

Value

Object of class "DiscreteDistribution"

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.

.lowerExact

normally not set by the user: whether the lower.tail=FALSE part is calculated exactly, avoing a ``1-.''.

.logExact

normally not set by the user: whether in determining slots d,p,q, we make particular use of a logarithmic representation to enhance accuracy.

.DistrCollapse

controls whether in generating a new discrete distribution, support points closer together than .DistrResolution are collapsed.

.DistrCollapse.Unique.Warn

controls whether there is a warning whenever collapsing occurs or when two points are collapsed by a call to unique() (default behaviour if .DistrCollapse is FALSE)

.DistrResolution

minimal spacing between two mass points in a discrete distribution

Symmetry

you may help R in calculations if you tell it whether the distribution is non-symmetric (default) or symmetric with respect to a center; in this case use Symmetry=SphericalSymmetry(center).

Author

Peter Ruckdeschel peter.ruckdeschel@uni-oldenburg.de,
Matthias Kohl Matthias.Kohl@stamats.de

Details

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

Typical usages are


    DiscreteDistribution(supp, prob)
    DiscreteDistribution(supp)
  

See Also

DiscreteDistribution-class AbscontDistribution-class RtoDPQ.d

Examples

Run this code
# Dirac-measure at 0
D1 <- DiscreteDistribution(supp = 0)
D1
# simple discrete distribution
D2 <- DiscreteDistribution(supp = c(1:5), prob = c(0.1, 0.2, 0.3, 0.2, 0.2))
D2

plot(D2)

Run the code above in your browser using DataLab