The OpenD Programming Language

poissonCDF

Computes the poisson cumulative distrivution function (CDF).

  1. T poissonCDF(size_t k, T lambda)
    template poissonCDF(PoissonAlgo poissonAlgo = PoissonAlgo.direct)
    @safe pure nothrow @nogc
    T
    poissonCDF
    (
    T
    )
    (
    const size_t k
    ,
    const T lambda
    )
    if (
    isFloatingPoint!T
    )
  2. template poissonCDF(string poissonAlgo)

Members

Functions

poissonCDF
T poissonCDF(size_t k, T lambda)

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