Use this function to create a new ddf object by passing the support and
the corresponding probabilities as vectors to it.
Details
This function makes sure that your ddf objects are "clean" by ensuring the
following two conditions:
The passed support is ordered in ascending order.
Duplicates within the support are removed and the probabilities of the affected elements are simply summed up.
Elements of the passed "support" that have probability 0 are removed as they then, by definition, are not contained in the support.
If the probabilities aren't supplied, they are distributed uniformly over the specified support.
Examples
# Create ddf object for an ordinary six-sided dice
dice <- ddf(1:6, desc = "Distribution modelling a six-sided dice")
dice
#> Distribution modelling a six-sided dice
#>
#> Support:
#> [1] 1 2 3 4 5 6
#>
#> Probabilities:
#> [1] 0.1666667 0.1666667 0.1666667 0.1666667 0.1666667 0.1666667
# Create ddf object for an unfair coin toss without custom description
coin_toss <- ddf(c(1, 2), c(1 / 4, 3 / 4))
coin_toss
#> A discrete distribution with finite support
#>
#> Support:
#> [1] 1 2
#>
#> Probabilities:
#> [1] 0.25 0.75
