An Applied Scenario — One Second of Vibration Samples¶
Back to the motor from Part 1. The accelerometer streams 1,000 samples per second, and your threshold rule fires a 1 whenever a sample exceeds +2 g. On a healthy machine, calibration gave you (1 in 200 samples is a transient).
You decide to summarise the stream one second at a time: count how many 1s show up in each 1,000-sample window. That count is the alarm metric the operator sees.
A few obvious questions:
What count should you expect on a healthy machine?
How much can the count drift from one second to the next without anything actually being wrong?
If you see a count of 20 in one window, is that worrying — or just normal variation?
You already have all the ingredients. Each window is independent Bernoulli trials with . The thing you’re counting — successes out of trials — has a name.
Intuition¶
If a Bernoulli trial is one coin flip, the Binomial distribution answers: “If I run independent trials, each with success probability , how many successes will I get?”
Vibration window: in 1,000 samples, each with probability of crossing the threshold, how many crossings ?
Manufacturing batch: if 200 units are produced and each has probability of being defective, how many defects ?
Photon counting: if photons strike a sensor and each has probability of being detected, how many electrons ?
In every case the structure is identical: independent Bernoulli trials with the same , count the successes.
The Math¶
where is the number of ways to choose which out of trials succeed.
Mean: Variance:
Breaking the formula down:
— how many ways can exactly trials succeed out of total?
— probability that those trials all succeed
— probability that the remaining trials all fail
Multiply: total probability of exactly successes
Back to the Vibration Sensor¶
For the motor scenario:
So on a healthy machine you should see about 5 crossings per second, and a typical fluctuation of or so. A count of 7 is unremarkable. A count of 20 is roughly above the mean — that’s not normal variation, that’s a state change worth investigating.
This is a real condition-monitoring rule built from one Bernoulli trial and one sum.
Visualizing the Binomial: Shape vs. and ¶
The shape depends on both parameters.
Increasing (fix ): the distribution widens and becomes more bell-shaped. This is the first hint of the Normal approximation and the CLT (Part 5).
Varying (fix ): the peak shifts. The distribution is most symmetric when ; it becomes skewed as approaches 0 or 1.
For the motor case, and — extremely small , large . The distribution is heavily skewed and concentrated near small counts. That regime — many trials, each rare — is exactly where the Binomial morphs into the Poisson distribution (Part 3).
Simulation: Repeated Windows¶
Simulating many 1-second windows from the same machine is the empirical version of the formula. Each simulated window is one independent set of Bernoulli trials.
Why simulate when we have the formula? Simulation validates the theory and builds intuition. If simulation and formula disagree, one of them is wrong — a powerful debugging technique that survives all the way into deep learning, where closed-form answers stop existing and Monte Carlo is your only tool.
What to look for: the simulation histogram should hug the theoretical PMF. Small residual differences shrink as the number of simulated windows increases (also a CLT effect).
Where Else Binomial Counts Appear¶
| Domain | Count | ||
|---|---|---|---|
| Vibration monitoring | Samples per window | P(threshold crossing) | Crossings per window |
| Quality control | Units per batch | P(defective unit) | Defects per batch |
| A/B testing | Visitors in a bucket | P(conversion) | Conversions per bucket |
| Image thresholding | Pixels in a patch | P(intensity > T) | Bright pixels per patch |
| Photon counting | Incident photons | Quantum efficiency | Detected electrons |
The formula doesn’t care what the trial is — only that the trials are independent and share the same . When varies across trials or trials aren’t independent, you need a different model. We’ll handle that in later parts.