PoissonDistribution
Represents the Poisson distribution, defined by its average rate of occurrence.
The Poisson distribution models the number of events occurring in a fixed interval of time or space, assuming events happen independently and at a constant average rate. Classic examples include the number of emails received per hour, the number of typos on a page, or the number of customers arriving at a store in an hour. It is often used as an approximation to the binomial distribution when the number of trials is large and the probability of success is small. The support is the set of all non-negative integers {0, 1, 2, ...}.
The CDF and survival function use the regularized incomplete gamma function for numerical stability. Sampling uses Knuth's algorithm for small rates and a normal approximation for large rates.
Example:
val dist = PoissonDistribution(rate = 4.0)
dist.pmf(3) // 0.1954... (probability of exactly 3 events)
dist.cdf(3) // 0.4335... (probability of 3 or fewer events)
dist.quantileInt(0.5) // 4 (median)
dist.mean // 4.0
dist.variance // 4.0 (mean and variance are equal)Functions
Returns the quantile (inverse CDF) for the given probability p as an integer.