Generating function "DiscreteDistribution"
Description
Generates an object of class "DiscreteDistribution"
Usage
1 2 3 4 5 6 7  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())

Arguments
supp 
numeric vector which forms the support of the discrete distribution. 
prob 
vector of probability weights for the
elements of 
.withArith 
normally not set by the user, but if determining the entries 
.withSim 
normally not set by the user, but if determining the entries 
.lowerExact 
normally not set by the user: whether the 
.logExact 
normally not set by the user: whether in determining slots 
.DistrCollapse 
controls whether in generating a new discrete
distribution, support points closer together than 
.DistrCollapse.Unique.Warn 
controls whether there is a warning
whenever collapsing occurs or when two points are collapsed by a call to

.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 nonsymmetric (default) or symmetric with respect
to a center; in this case use 
Details
If prob
is missing, all elements in supp
are equally weighted.
Typical usages are
1 2 3  DiscreteDistribution(supp, prob)
DiscreteDistribution(supp)

Value
Object of class "DiscreteDistribution"
Note
Working with a computer, we use a finite interval as support which
carries at least mass 1getdistrOption("TruncQuantile")
.
Also, we require that support points have distance at least
.DistrResoltion
, if this condition fails,
upon a suggestion by Jacob van Etten, jacobvanetten@yahoo.com,
we use the global option .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 .DistrCollapse==FALSE
, we at least collapse
points according to the result of unique()
, and if after this
collapsing, the minimal distance is less than .DistrResoltion
,
we throw an error. By .DistrCollapse.Unique.Warn
,
we control, whether we throw a warning upon collapsing or not.
Author(s)
Peter Ruckdeschel peter.ruckdeschel@unioldenburg.de,
Matthias Kohl Matthias.Kohl@stamats.de
See Also
DiscreteDistributionclass
AbscontDistributionclass
RtoDPQ.d
Examples
1 2 3 4 5 6 7 8  # Diracmeasure 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)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.