Create a ddf object for the hypergeometric distribution with the given
parameters.
Source
This function uses stats::dhyper() to calculate the distribution
efficiently.
Details
The hypergeometric distribution models the number of successes when drawing \(n\) elements, without replacement, from a finite population of size \(N\) which contains \(K\) success states.
It has support $$\{\max(0, n+K-N), \dots, \min(n, K)\}$$ on which its probability mass function is given by $$p(k) = \frac{\binom{K}{k} \binom{N-K}{n-k}}{\binom{N}{n}}.$$
See also
Other distributions:
benford(),
bernoulli(),
beta_binomial(),
bin(),
geometric(),
negative_bin(),
negative_hypergeometric(),
pois(),
rademacher(),
unif(),
zipf()
Examples
# Model the total number of blue marbles when
# drawing 5 marbles from an urn containing
# 6 blue marbles and 20 marbles in total
hypergeometric(20, 6, 5)
#> Hypergeometric distribution with parameters N = 20, K = 6 and n = 5
#>
#> Support:
#> [1] 0 1 2 3 4 5
#>
#> Probabilities:
#> [1] 0.1291279670 0.3873839009 0.3521671827 0.1173890609 0.0135448916
#> [6] 0.0003869969
