
An S4 class to represent a discrete distribution with finite support
Source:R/ddf-class.R
ddf-class.RdA discrete distribution with finite support is here represented by its probability mass function (PMF). For this, it has one slot which stores the support of the PMF as a numeric vector and another slot for storing the value of the PMF at the corresponding point in the support. There is one further slot for a description.
Details
New ddf objects are checked for validity to ensure that they fulfill basic
properties of a discrete probability distribution with finite support.
The relevant checks for this are:
Support and probability vectors must have the same length.
All probabilities have to lie between 0 (excluded) and 1 (included). Here, 0 is not included as elements of the support have, by definition, non-zero probability.
The probabilities have to sum up to approximately 1. Currently the tolerance for this is set to
1e-10.