Investment Studio > Expressions > Functions > Statistical > HYPGEOMDIST
float hypgeomdist(integer sample_successes, integer sample_size, integer population_successes, integer population_size, boolean cumulative = FALSE)
Returns the hypergeometric probability function, used to study sampling (drawing without replacement) of a finite population consisting of two kinds of elements ("successes" and "failures").
sample_successes is the number of successes in the sample.
sample_size is the total number of elements (successes + failures) in the sample.
population_successes is the number of successes in the population.
population_size is the total number of elements in the population.
If cumulative = TRUE, the CDF (Cumulative Distribution Function) is returned (equal to the probability that sample_successes is >= a stochastic variable with hypergeometric distribution); otherwise, the PDF (Probability Density Function) is returned. If cumulative is omitted, it defaults to FALSE.
The hypergeometric PDF is
f(sample_successes, sample_size, population_successes, population_size) = combin(population_successes, sample_successes) * combin(population_size - population_successes, sample_size - sample_successes) / combin(population_size, sample_size)
and its CDF is
| sample_successes | ||
| F(sample_successes, ...) = | å | f(k, ...) |
| k = 0 |
Example
Given 13 green balls and 7 blue balls, the probability of getting exactly 2 green balls when randomly selecting 5 balls is
=hypgeomdist(2, 5, 13, 13 + 7)
» 17.6%. The probability of getting at most 2 (i.e. 0, 1, or 2) green balls is
=hypgeomdist(2, 5, 13, 13 + 7, TRUE)
» 20.7%.
See also binomdist, combin, critbinom, fact, negbinomdist, permut, prob.