Skip to contents

Create a ddf object for the negative hypergeometric distribution with the given parameters.

Usage

negative_hypergeometric(N, K, r)

Arguments

N

A positive integer, the population size.

K

A non-negative integer, the number of success states in the population. Has to be less or equal to N.

r

A non-negative integer, the number of failures until the experiment is stopped. Has to be less or equal to N-K.

Value

A ddf distribution as described above.

Details

The negative hypergeometric distribution models the number of successes when drawing, without replacement, elements from a finite population of size \(N\) which contains \(K\) success states until precisely \(r\) failures have been found.

It has support \(\{0, \dots, K\}\) on which its probability mass function is given by $$p(k) = \frac{\binom{k+r-1}{k} \binom{N-r-k}{K-k}}{\binom{N}{K}}.$$

The beta-binomial distribution provides a generalization of the negative hypergeometric distribution, see beta_binomial().

See also

Other distributions: benford(), bernoulli(), beta_binomial(), bin(), geometric(), hypergeometric(), negative_bin(), pois(), rademacher(), unif(), zipf()

Examples

# Model how many blue marbles are drawn from an urn containing
# 20 marbles of which 6 are blue, when one stops as soon
# as one has found 5 non-blue marbles
negative_hypergeometric(20, 6, 5)
#> Negative hypergeometric distribution with parameters N = 20, K = 6 and r = 5 
#> 
#> Support:
#> [1] 0 1 2 3 4 5 6
#> 
#> Probabilities:
#> [1] 0.129127967 0.258255934 0.276702786 0.198658411 0.099329205 0.032507740
#> [7] 0.005417957