Skip to contents

A finite distribution assigns probabilities to a finite collection of values. This includes categorical distributions.

Usage

dst_finite(y, probs, data, ...)

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 in y. Must not be negative, but must sum to 1 (unlike dst_empirical()). Should either evaluate to a vector, or be a name in the specified data.

data

Data frame containing the outcomes y and/or probabilities probs. Optional.

...

Additional arguments, currently not used.

Value

An object of class c("finite", "dst").

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.

See also

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