Create a Finite Distribution
dst_finite.Rd
A finite distribution assigns probabilities to a finite collection of values. This includes categorical distributions.
Arguments
- y
<
data-masking
> Outcomes to comprise the distribution. Should either evaluate to an (atomic) vector, or be a name in the specified data.- probs
<
data-masking
> Probabilities corresponding to the outcomes iny
. Must not be negative, but must sum to 1 (unlikedst_empirical()
). Should either evaluate to a vector, or be a name in the specified data.- data
Data frame containing the outcomes
y
and/or probabilitiesprobs
. Optional.- ...
Additional arguments, currently not used.
Note
This distribution is called "finite" and not "discrete", because a discrete distribution could have an infinite amount of possible outcomes, as in the Poisson distribution.
Examples
dst_finite(1:5, probs = rep(0.2, 5))
#> [1] "finite" "dst"
#>
#> probabilities :
#> # A tibble: 5 × 2
#> location size
#> <int> <dbl>
#> 1 1 0.2
#> 2 2 0.2
#> 3 3 0.2
#> 4 4 0.2
#> 5 5 0.2