This is an old version, view current version.
13.4 Hypergeometric Distribution
13.4.1 Probability Mass Function
If a∈N, b∈N, and N∈{0,…,a+b}, then for n∈{max, \text{Hypergeometric}(n~|~N,a,b) = \frac{\normalsize{\binom{a}{n} \binom{b}{N - n}}} {\normalsize{\binom{a + b}{N}}}.
13.4.2 Sampling Statement
n ~
hypergeometric
(N, a, b)
Increment target log probability density with hypergeometric_lpmf(n | N, a, b)
dropping constant additive terms.
13.4.3 Stan Functions
real
hypergeometric_lpmf
(int n ~|~ int N, int a, int b)
The log hypergeometric probability mass of n successes in N trials
given total success count of a and total failure count of b
int
hypergeometric_rng
(int N, int a, int2 b)
Generate a hypergeometric variate with N trials, total success count
of a, and total failure count of b; may only be used in transformed data and
generated quantities blocks