algorithm for calculating CCDF (default: PoissonAlgo.direct)
import mir.math.common: approxEqual; assert(3.poissonCCDF(6.0).approxEqual(1.0 - (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.poissonCCDF!"gamma"(6.0).approxEqual(poissonCCDF(3, 6.0))); // For large values of k or lambda, can approximate with normal distribution assert(1_000_000.poissonCCDF!"approxNormal"(1_000_000.0).approxEqual(poissonCCDF!"gamma"(1_000_000, 1_000_000.0), 10e-3)); // Or closer with continuity correction assert(1_000_000.poissonCCDF!"approxNormalContinuityCorrection"(1_000_000.0).approxEqual(poissonCCDF!"gamma"(1_000_000, 1_000_000.0), 10e-3));
Computes the poisson complementary cumulative distrivution function (CCDF).