BRAGA

02 Writing02-02 Notes02-02-400

Poisson Distribution (counts per interval)

Published 26 Oct 20266 min read
Contents
  1. 01Deep Breakdown
  2. 02Flowchart
  3. 03Real-world use
  4. 04The formula, piece by piece
  5. 05The formula in words
  6. 06Critical Concepts
  7. 07Step-by-step calculation (tiny example)
  8. 08Code examples
P(X=k)=λke−λk!P(X=k) = \frac{\lambda^k e^{-\lambda}}{k!}
(1)

, where k∈{0,1,2,… }k \in \{0, 1, 2, \dots\} and λ>0\lambda \gt 0 is the expected count per interval

Deep Breakdown

What it tells me (Situation Awareness): The Poisson distribution models how many events happen in a fixed interval of time, space or exposure when events occur independently and at a constant average rate λ\lambda. There is no fixed upper limit on the count, unlike the Binomial. Its signature property is that the mean and variance are both equal to λ\lambda, which gives me an instant diagnostic: if my count data has variance far above its mean, the plain Poisson is the wrong model (overdispersion). It is also the limit of Binomial(n,p)\text{Binomial}(n, p) when nn is large, pp is small and np=λnp = \lambda, which is why it fits rare events among many opportunities. In DA/DS: support tickets per hour, orders per minute, website errors per day, insurance claims per policy-year, goals per match, Poisson regression (GLM with log link) for count targets, capacity and staffing planning, anomaly alerts on event counts, and arrival processes in queueing models.

Flowchart

yesno, much largerEvents arriveindependently atconstant rateFix an interval:hour, day, page,policy-yearλ = expectedevents perintervalP(X=k) = λ^ke^(-λ) / k!Mean = Var = λSample variance≈ mean?Poisson modelis reasonableOverdispersion:use NegativeBinomial

Real-world use

Where it is used

Call-centre and support-ticket staffing, web traffic and order arrivals, incident and error monitoring, insurance claim frequency, rare-defect counts in manufacturing, and as the likelihood in Poisson regression for count targets (visits, purchases per customer, claims).

Problem it solves

Gives the probability of every possible count in an interval from a single number, the rate λ\lambda, so I can plan capacity ("how many agents cover 95% of hours?"), flag anomalies ("is 12 errors this hour unusual?") and model counts as a function of features.

How it solves the problem

Split the interval into many tiny slots, each with a tiny chance of one event; the Binomial over those slots converges to λke−λ/k!\lambda^k e^{-\lambda}/k!. Tail probabilities P(X≥k)P(X \ge k) quantify how surprising a count is, and quantiles give capacity targets.

Example in a business

A help desk receives on average λ=3\lambda = 3 tickets per hour. The chance of a completely quiet hour is P(X=0)=0.0498P(X=0) = 0.0498; the chance of exactly 5 tickets is 0.10080.1008. One agent can handle 5 tickets per hour, so the probability of overload in a given hour is P(X≥6)=0.0839P(X \ge 6) = 0.0839. Planning for 6 tickets covers 96.6%96.6\% of hours; the 95th percentile of the distribution is 6 and the 99th is 8, which sets the on-call threshold.

The formula, piece by piece

  • XX: count of events in one interval (0, 1, 2, ... with no upper bound).
  • kk: the specific count I am asking about.
  • λ\lambda: rate parameter, the expected number of events per interval; it scales with interval length (3 per hour means 72 per day).
  • λk\lambda^k: grows with the number of events requested.
  • k!k!: corrects for the order of the kk events not mattering.
  • e−λe^{-\lambda}: normalising constant; it is also P(X=0)P(X=0).
  • E[X]=λE[X] = \lambda and Var[X]=λVar[X] = \lambda.
  • MLE: λ^=xˉ\hat{\lambda} = \bar{x}, the sample mean count per interval.

The formula in words

"If events arrive at an average of λ\lambda per interval, the probability of exactly kk events is λk\lambda^k times e−λe^{-\lambda}, divided by k!k!." Tiny example: a store averages 0.50.5 returns per day. P(no returns today)=e−0.5=0.6065P(\text{no returns today}) = e^{-0.5} = 0.6065, so at least one return happens on 39.3%39.3\% of days.

Critical Concepts

  • Mean equals variance: the one-parameter model forces Var=λVar = \lambda. Real data (e.g. purchases per customer) is often overdispersed; use the Negative Binomial or a quasi-Poisson model then.
  • Rate scales with exposure: if λ\lambda is per hour, the count over tt hours is Poisson(λt)\text{Poisson}(\lambda t). In Poisson regression this is the log-exposure offset.
  • Sum of Poissons: independent Poisson(λ1)+Poisson(λ2)=Poisson(λ1+λ2)\text{Poisson}(\lambda_1) + \text{Poisson}(\lambda_2) = \text{Poisson}(\lambda_1 + \lambda_2), so channel-level rates add up to a total rate.
  • Binomial limit: Binomial(n,p)≈Poisson(np)\text{Binomial}(n, p) \approx \text{Poisson}(np) when nn is large and pp is small (e.g. fraud cases among many transactions).
  • Exponential waiting times: in a Poisson process, the time between events follows an Exponential distribution with mean 1/λ1/\lambda.
  • Zero inflation: many structural zeros (customers who never buy) call for zero-inflated or hurdle models.
  • Normal approximation: for large λ\lambda (say above 20), X≈Normal(λ,λ)X \approx \text{Normal}(\lambda, \lambda).

Step-by-step calculation (tiny example)

Step 1: Set up λ=3\lambda = 3 tickets per hour, want P(X=5)P(X = 5).

Step 2: Numerator λ5=35=243\lambda^5 = 3^5 = 243, e−3=0.049787e^{-3} = 0.049787, product =243×0.049787=12.0983= 243 \times 0.049787 = 12.0983.

Step 3: Divide by 5! 5!=1205! = 120, so P(X=5)=12.0983/120=0.1008P(X=5) = 12.0983 / 120 = 0.1008.

Step 4: Overload probability P(X≤5)=0.04979+0.14936+0.22404+0.22404+0.16803+0.10082=0.91608P(X \le 5) = 0.04979 + 0.14936 + 0.22404 + 0.22404 + 0.16803 + 0.10082 = 0.91608, so P(X≥6)=1−0.91608=0.0839P(X \ge 6) = 1 - 0.91608 = 0.0839.

Code examples

Beginner example (Python)

python
from scipy.stats import poisson

lam = 3
dist = poisson(lam)
print(f"P(X=0) = {dist.pmf(0):.4f}")    # 0.0498
print(f"P(X=5) = {dist.pmf(5):.4f}")    # 0.1008
print(f"P(X>=6) = {dist.sf(5):.4f}")    # 0.0839
print(f"95th / 99th percentile: {dist.ppf(0.95):.0f} / {dist.ppf(0.99):.0f}")   # 6 / 8
print(f"Mean = {dist.mean():.1f} | Var = {dist.var():.1f}")   # 3.0 | 3.0

Beginner example (R)

r
lam <- 3
cat(sprintf("P(X=5) = %.4f\n", dpois(5, lambda = lam)))           # 0.1008
cat(sprintf("P(X>=6) = %.4f\n", 1 - ppois(5, lambda = lam)))      # 0.0839
cat(sprintf("95th percentile = %d\n", qpois(0.95, lambda = lam))) # 6

Professional example (Python)

python
import numpy as np
from scipy.stats import nbinom, poisson


def count_model_report(counts: np.ndarray, coverage: float = 0.95) -> dict[str, float]:
    """Fit a Poisson rate, test for overdispersion, and give a staffing threshold.

    Args:
        counts: Event counts per interval (e.g. tickets per hour).
        coverage: Share of intervals the capacity should cover.

    Returns:
        Dict with lambda_hat, dispersion ratio and capacity quantiles.
    """
    lam_hat = counts.mean()
    dispersion = counts.var(ddof=1) / lam_hat   # about 1 for Poisson data
    return {
        "lambda_hat": float(lam_hat),
        "dispersion_ratio": float(dispersion),
        "poisson_capacity": float(poisson.ppf(coverage, lam_hat)),
        "empirical_capacity": float(np.quantile(counts, coverage)),
    }


rng = np.random.default_rng(42)
hours = 24 * 90   # one quarter of hourly data

# Case 1: genuinely Poisson ticket arrivals
tickets = rng.poisson(lam=3.0, size=hours)
print("Poisson data:", {k: round(v, 3) for k, v in count_model_report(tickets).items()})

# Case 2: overdispersed counts (busy and quiet hours mixed), same mean of 3
r = 2.0
bursty = nbinom.rvs(r, r / (r + 3.0), size=hours, random_state=rng)
print("Bursty data: ", {k: round(v, 3) for k, v in count_model_report(bursty).items()})
# Dispersion ratio well above 1 -> Poisson under-estimates the capacity needed

Source: domain knowledge

#probability-statistics#statistical-operations-and-random-variables#common-discrete-distributions

Keyboard shortcuts

Single keys, ignored while typing in a field or with Cmd, Ctrl or Alt held.

0
Home
1 2 3 4
Work, Writing, Tools, About
j / k
Next / previous section on this page
n / p
Next / previous project or essay
u
Up one level
l
Deutsch
t
Light or dark theme
?
This list
Esc
Close