The OpenD Programming Language

poissonInvCDF

Computes the poisson inverse cumulative distrivution function (InvCDF).

For algorithms PoissonAlgo.direct, PoissonAlgo.approxNormal, and PoissonAlgo.approxNormalContinuityCorrection, the inverse CDF returns the number of events (k) given the probability (p) and rate of occurence (lambda). For the Poisson.gamma algorithm, the inverse CDF returns the rate of occurence (lambda) given the probability (p) and the number of events (k).

For PoissonAlgo.direct, if the value of lambda is larger than 16, then an initial guess is made based on PoissonAlgo.approxNormalContinuityCorrection.

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

Members

Functions

poissonInvCDF
size_t poissonInvCDF(T p, T lambda)

Parameters

poissonAlgo

algorithm for calculating InvCDF (default: PoissonAlgo.direct)

Examples

import mir.math.common: approxEqual;

assert(0.15.poissonInvCDF(6.0) == 3);
// Passing `gamma` returns the rate of occurnece
assert(0.151204.poissonInvCDF!"gamma"(3).approxEqual(6));
// For large values of k or lambda, can approximate with normal distribution
assert(0.5.poissonInvCDF!"approxNormal"(1_000_000.0) == 1_000_000);
// Or closer with continuity correction
assert(0.5009974.poissonInvCDF!"approxNormalContinuityCorrection"(1_000_000.0) == 1_000_002);

See Also

Meta