algorithm for calculating InvCDF (default: PoissonAlgo.direct)
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);
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.