The OpenD Programming Language

fp_negativeBinomialPMF

Computes the negative binomial probability mass function (PMF) directly with extended floating point types (e.g. Fp!128), which provides additional accuracy for extreme values of k, r, or p.

@safe pure nothrow @nogc
T
fp_negativeBinomialPMF
(
T
)
(
const size_t k
,
const size_t r
,
const T p
)
if (
is(T == Fp!size,
size_t size
)
)

Parameters

k size_t

value to evaluate PMF (e.g. number of "heads")

r size_t

number of successes until stopping

p T

true probability

Examples

fp_binomialPMF provides accurate values for large values of n

import mir.bignum.fp: Fp, fp_log;
import mir.test: shouldApprox;

1.fp_negativeBinomialPMF(1_000_000, Fp!128(0.75)).fp_log!double.shouldApprox == negativeBinomialLPMF(1, 1_000_000, 0.75);

See Also

Meta