The OpenD Programming Language

binomialInvCDF

Computes the binomial inverse cumulative distribution function (InvCDF).

Additional algorithms may be provided for calculating InvCDF that allow trading off time and accuracy. If approxPoisson is provided, the default is PoissonAlgo.direct, which is different from binomialPMF and binomialCDF PoissonAlgo.gamma is not supported.

  1. template binomialInvCDF(BinomialAlgo binomialAlgo = BinomialAlgo.direct, PoissonAlgo poissonAlgo = PoissonAlgo.direct)
  2. template binomialInvCDF(string binomialAlgo, string poissonAlgo = "direct")
    @safe pure nothrow @nogc
    template binomialInvCDF (
    string binomialAlgo
    string poissonAlgo = "direct"
    )

Parameters

binomialAlgo

algorithm for calculating CDF (default: BinomialAlgo.direct)

poissonAlgo

algorithm for poisson approximation (default: PoissonAlgo.direct)

Examples

assert(0.15.binomialInvCDF(6, 2.0 / 3) == 3);
// For large values of `n` with `p` not too extreme, can approximate with normal distribution
assert(0.5.binomialInvCDF!"approxNormal"(1_000_000, 0.55) == 550_000);
// Or closer with continuity correction
assert(0.500401.binomialInvCDF!"approxNormalContinuityCorrection"(1_000_000, 0.55) == 550_000);
// Poisson approximation is better when `p` is low
assert(0.5026596.binomialInvCDF!"approxPoisson"(1_000_000, 0.01) == 10_000);

See Also

Meta