The OpenD Programming Language

hypergeometricLPMF

Computes the hypergeometric log probability mass function (LPMF).

@safe pure @nogc nothrow
T
hypergeometricLPMF
(
T = double
)
(
const size_t k
,
const size_t N
,
const size_t K
,
const size_t n
)
if (
isFloatingPoint!T
)

Parameters

k size_t

value to evaluate LPMF (e.g. number of correct draws of object of interest)

N size_t

total population size

K size_t

number of relevant objects in population

n size_t

number of draws

Examples

import mir.math.common: log;
import mir.test: shouldApprox;

0.hypergeometricLPMF(7, 4, 3).shouldApprox == log(0.02857143);
1.hypergeometricLPMF(7, 4, 3).shouldApprox == log(0.3428571);
2.hypergeometricLPMF(7, 4, 3).shouldApprox == log(0.5142857);
3.hypergeometricLPMF(7, 4, 3).shouldApprox == log(0.1142857);

See Also

Meta