# 🔢 Bernoulli, Binomial and Poisson Counts

By Better Wise

In Module 1 you built expectation and variance from first principles ($E[X] = \sum_x x\,p(x)$ and $Var(X) = E[X^2] - E[X]^2$) and saw that they compress a whole distribution into two numbers. Almost every dataset question you will meet now starts with a count: how many clicks, how many support tickets, how many defective units. This lesson gives you three models for counts and, more importantly, a rule for choosing between them from the story behind the data.

By the end you should be able to:

- Read the data-generating story and decide whether the count is Bernoulli, binomial or Poisson.
- Compute the pmf, mean and variance for each model.
- Convert a binomial into a Poisson approximation and justify when it is safe.
- Rescale a Poisson rate when your window of time or space changes.

## One Impression, One Decision: The Bernoulli Model

Start with the smallest possible unit. A single ad impression either gets clicked or it does not. A single email either gets opened or it does not. That 0/1 outcome is a **Bernoulli** random variable with parameter $p$, the probability of success.

$$
P(X = 1) = p, \qquad P(X = 0) = 1 - p
$$

From the Module 1 definitions, $E[X] = p$ and $Var(X) = p(1 - p)$.

**Worked example.** Your click-through rate is $p = 0.02$. One impression gives $E[X] = 0.02$ and $Var(X) = 0.02 \times 0.98 = 0.0196$, so the standard deviation is $\sqrt{0.0196} = 0.14$. Note how the variance is small in absolute terms but large relative to the mean: a single Bernoulli trial is almost always a zero.

The Bernoulli model answers "what happens on one trial". It never answers "how many in total", and that is the question you usually have.

## Many Trials, One Total: The Binomial Model

Stack $n$ independent Bernoulli trials with the same $p$ and count the successes. That count is **binomial**: $X \sim \text{Binomial}(n, p)$.

$$
P(X = k) = \binom{n}{k} p^k (1-p)^{n-k}
$$

The binomial coefficient counts the orderings of $k$ successes among $n$ trials, and the rest is just the probability of any one specific ordering. Because expectation is linear, $E[X] = np$. Because the trials are independent, the variances add: $Var(X) = np(1-p)$.

**Worked example (small $n$, exact arithmetic).** A checkout page converts at $p = 0.1$. You send $n = 10$ visitors.

- $P(X = 0) = 0.9^{10} = 0.3487$
- $P(X = 2) = \binom{10}{2}(0.1)^2(0.9)^8 = 45 \times 0.01 \times 0.4305 = 0.1937$
- $P(X \ge 1) = 1 - 0.3487 = 0.6513$

So roughly one day in three you get no conversion at all from ten visitors, even though the expected count is $np = 1$.

**Worked example (large $n$).** Now $n = 1000$ impressions at $p = 0.02$, so $E[X] = 20$ and $Var(X) = 19.6$ (standard deviation about $4.4$). The probability of an entirely click-free batch is $0.98^{1000} \approx 1.7 \times 10^{-9}$. Rare events per trial, enormous trial count.

The two conditions to check before reaching for the binomial are real: a **known, fixed $n$**, and trials that are **independent with the same $p$**. If the same user sees five of your impressions, the independence clause is shaky.

## Counts in a Window With No Trial Cap: The Poisson Model

Sometimes there is no clean $n$. How many support tickets arrive between 9am and 10am? How many typos appear on a page? How many packets hit a router per second? Nobody can tell you how many "opportunities" there were. What you can measure is a **rate**: $\lambda$ events per window.

$$
P(X = k) = \frac{e^{-\lambda}\lambda^k}{k!}, \qquad k = 0, 1, 2, \dots
$$

The Poisson model has one striking property: $E[X] = \lambda$ and $Var(X) = \lambda$. Mean and variance are the same number.

**Worked example (ticket queue).** Tickets arrive at $\lambda = 6$ per hour.

- $P(X = 0) = e^{-6} = 0.0025$. An empty hour is genuinely rare.
- $P(X = 4) = \dfrac{e^{-6}6^4}{4!} = \dfrac{0.002479 \times 1296}{24} = 0.134$.
- $P(X \le 1) = e^{-6}(1 + 6) = 0.0174$. Understaffing on the assumption of "at most one ticket" fails 98% of the time.

**Rates scale with the window.** The same process over 30 minutes has $\lambda = 3$, so $P(X = 0) = e^{-3} = 0.050$. Always convert the rate to the window you are asking about before computing.

**Poisson as a limit of the binomial.** With $n = 1000$ and $p = 0.02$, the exact binomial gives $P(X = 0) = 0.98^{1000} \approx 1.68 \times 10^{-9}$, while Poisson with $\lambda = np = 20$ gives $e^{-20} \approx 2.06 \times 10^{-9}$. The approximation is excellent because $n$ is large and $p$ is small. That is the standard rule: use it when $n$ is large, $p$ is small, and $\lambda = np$ stays moderate.

Independent Poisson counts also add: if weekday tickets are Poisson(6) and weekend tickets are Poisson(2), the two-day total is Poisson(8).

## Choosing the Model From the Story

```mermaid
flowchart TD
    Q["❓ What are you counting?"] --> Fixed{"Fixed number of trials n?"}
    Fixed -->|"Yes, n = 1"| Bern["🎯 Bernoulli<br/>one 0/1 outcome, parameter p"]
    Fixed -->|"Yes, n > 1"| Bin["🎲 Binomial<br/>successes in n trials"]
    Fixed -->|"No fixed n"| Window{"Measurable rate per window?"}
    Window -->|"Yes"| Pois["⏱️ Poisson<br/>events per unit time or space"]
    Window -->|"No"| Reframe["Reframe the question<br/>before modelling"]
```

A quick sanity check on the cloze facts below: Bernoulli variance _____, binomial variance _____, and the Poisson pmf _____. The Poisson mean and variance both equal _____, and the binomial converges to it when $n$ is large, $p$ is small, with _____ held fixed.

## Practice: Three Count Questions

Pick the model and compute. Answers are hidden below.

1. A factory tests 50 circuit boards; each fails with probability 0.04. What is the distribution of the number of failures, and its mean?
2. A call centre receives 4 calls per minute on average. What is the probability of zero calls in a given minute?
3. A user opens your app once and either completes onboarding or does not. What is the distribution?

**Show the answers**

1. Binomial: 50 independent trials, fixed $n$, common $p$. Mean $= 50 \times 0.04 = 2$ failures, variance $= 2 \times 0.96 = 1.92$.
2. Poisson with $\lambda = 4$: $P(X = 0) = e^{-4} = 0.0183$.
3. Bernoulli with parameter $p$ equal to the onboarding completion rate; a binomial with $n = 1$.

## Field Notes on Count Models

- **Check independence before you trust the binomial.** Repeat impressions to the same user, or clustered traffic from one campaign, break the fixed-$p$ assumption. The count is then overdispersed: variance exceeds $np(1-p)$.
- **Overdispersion is your Poisson alarm.** If you measure the sample variance of your counts and it is far above the sample mean, the Poisson model will understate uncertainty. Report that mismatch instead of hiding it.
- **Never compare a rate to a count.** A rate of 6 per hour is not the probability of 6 events. Convert the window first.
- **Small $p$ with huge $n$ is the Poisson sweet spot.** It is also the case where hand-computing binomial coefficients goes wrong, so switch deliberately.
- **Bernoulli is binomial with $n=1$.** Do not treat them as different families; the formulas line up.

## What to Carry Forward

Counts come in three flavours: one trial (Bernoulli), a fixed number of trials (binomial), and a rate over a window with no trial cap (Poisson). In each case the mean and variance tell you immediately whether the model fits the scale of your data, and the Poisson approximation lets you move between the last two. Next, in **Gaussian and Exponential Models**, we leave counts behind and ask what happens when the quantity you measure is a continuous value, or a waiting time between events whose count is Poisson.## Quick Recall Deck

Lock the distinctions in place before moving on. Fill each blank from memory, then check yourself:

A single trial with two outcomes (success or failure) is a _____ random variable.
A binomial count of successes in n independent trials with constant success probability p has mean _____ and variance _____.
The Poisson distribution has a single parameter lambda, and both its mean and its variance equal _____.
If events arrive at rate lambda per unit time, the count in a window of length t is Poisson with parameter _____.
The binomial is well approximated by a Poisson when n is large, p is small, and np stays _____.

Front: What does a Bernoulli random variable model?
Back: One trial with two outcomes, success with probability p and failure with probability 1 - p.

Front: Bernoulli mean and variance
Back: Mean p, variance p(1 - p).

Front: What are the two parameters of a binomial distribution?
Back: n, the number of independent trials, and p, the success probability on each trial.

Front: Binomial probability of exactly k successes
Back: C(n, k) * p^k * (1 - p)^(n - k).

Front: What assumption must hold for a binomial count to be valid?
Back: Trials are independent and share the same success probability p.

Front: How is a Bernoulli variable related to a binomial?
Back: A Bernoulli is a binomial with n = 1.

Front: What is the single parameter of a Poisson distribution?
Back: Lambda, the expected number of events in the observation window.

Front: Poisson probability of exactly k events
Back: e^(-lambda) * lambda^k / k!.

Front: Signature property of the Poisson distribution
Back: Mean equals variance, both equal to lambda.

Front: When is the Poisson a good approximation to the binomial?
Back: When n is large, p is small, and np is moderate and roughly constant.

Front: How do you rescale a Poisson rate to a different window?
Back: Multiply the rate by the window length: lambda * t. Rates are not probabilities.

Front: What does overdispersion tell you about a count model?
Back: Sample variance far above the mean (or above np(1-p)) means independence or constant-p fails and the model understates uncertainty.

Front: Do Poisson counts over disjoint windows add?
Back: Yes. The sum of independent Poisson counts is Poisson with the summed rates.

---

## Contents

Part of [🎲 Mathematics for Machine Learning 3: Probability and Statistics for Data-Driven Models](https://everwise.study/courses/mathematics-for-machine-learning-3-probability-and-statistics-for-data.md)

- **🎲 Probability Foundations for Data**
  - [🧩 Axioms, Conditional Probability and Independence](https://everwise.study/courses/mathematics-for-machine-learning-3-probability-and-statistics-for-data/probability-axioms-conditional-independence.md)
  - [📊 Expectation and Variance on a Real Dataset](https://everwise.study/courses/mathematics-for-machine-learning-3-probability-and-statistics-for-data/expectation-variance-worked-dataset.md) (sign-in required)
  - [🔗 Covariance, Correlation and Dependence](https://everwise.study/courses/mathematics-for-machine-learning-3-probability-and-statistics-for-data/covariance-correlation-dependence.md)
  - [✅ Checkpoint: Probability Foundations](https://everwise.study/courses/mathematics-for-machine-learning-3-probability-and-statistics-for-data/checkpoint-probability-foundations.md)
- **📈 Distributions and Bayes' Rule**
  - [🔢 Bernoulli, Binomial and Poisson Counts](https://everwise.study/courses/mathematics-for-machine-learning-3-probability-and-statistics-for-data/bernoulli-binomial-poisson-count-data.md) — this lesson
  - [🔔 Gaussian and Exponential Models](https://everwise.study/courses/mathematics-for-machine-learning-3-probability-and-statistics-for-data/gaussian-exponential-continuous-data.md)
  - [🧠 Bayes' Rule and Base Rates](https://everwise.study/courses/mathematics-for-machine-learning-3-probability-and-statistics-for-data/bayes-rule-base-rates.md)
  - [🧪 Checkpoint: Distributions and Bayes](https://everwise.study/courses/mathematics-for-machine-learning-3-probability-and-statistics-for-data/checkpoint-distributions-and-bayes.md)
- **🎯 Estimation and Inference**
  - [⚙️ Maximum Likelihood and MAP Estimation](https://everwise.study/courses/mathematics-for-machine-learning-3-probability-and-statistics-for-data/maximum-likelihood-map-estimation.md)
  - [⚖️ Bias-Variance Tradeoff in Practice](https://everwise.study/courses/mathematics-for-machine-learning-3-probability-and-statistics-for-data/bias-variance-tradeoff-practice.md)
  - [📐 Sampling, Confidence Intervals and Hypothesis Tests](https://everwise.study/courses/mathematics-for-machine-learning-3-probability-and-statistics-for-data/sampling-confidence-intervals-hypothesis-tests.md) (premium content)
  - [🏁 Checkpoint: Estimation and Inference](https://everwise.study/courses/mathematics-for-machine-learning-3-probability-and-statistics-for-data/checkpoint-estimation-and-inference.md) (premium content)
- [Course cheatsheet](https://everwise.study/courses/mathematics-for-machine-learning-3-probability-and-statistics-for-data/cheatsheet.md) (premium content)
