The OpenD Programming Language

poissonCDF

Computes the poisson cumulative distrivution function (CDF).

  1. template poissonCDF(PoissonAlgo poissonAlgo = PoissonAlgo.direct)
  2. template poissonCDF(string poissonAlgo)
    @safe pure nothrow @nogc
    template poissonCDF (
    string poissonAlgo
    )

Parameters

poissonAlgo

algorithm for calculating CDF (default: PoissonAlgo.direct)

Examples

import mir.math.common: approxEqual;

assert(3.poissonCDF(6.0).approxEqual(poissonPMF(0, 6.0) + poissonPMF(1, 6.0) + poissonPMF(2, 6.0) + poissonPMF(3, 6.0)));
// Can compute directly with upper incomplete gamma function
assert(3.poissonCDF!"gamma"(6.0).approxEqual(poissonCDF(3, 6.0)));
// For large values of k or lambda, can approximate with normal distribution
assert(1_000_000.poissonCDF!"approxNormal"(1_000_000.0).approxEqual(poissonCDF!"gamma"(1_000_000, 1_000_000.0), 10e-3));
// Or closer with continuity correction
assert(1_000_000.poissonCDF!"approxNormalContinuityCorrection"(1_000_000.0).approxEqual(poissonCDF!"gamma"(1_000_000, 1_000_000.0), 10e-3));

See Also

Meta