Choose random inputsLesson 09 of 76 · 7 min
Count arrivals in an interval
Use a Poisson model with an explicitly scaled observation interval.
A Poisson count takes nonnegative integer values with no fixed upper limit. A homogeneous process has a constant event rate. Independent increments means counts in non-overlapping time intervals do not inform each other under the model; for example, the first half-hour's count does not change the next half-hour's distribution.
If the rate is four requests per hour, the expected count in half an hour is two. NumPy poisson takes that expected count, not a rate with unspecified units. Keep the duration conversion visible in the model.
Under this model the count variance equals its mean. Real observations with bursts, seasonality or shared causes may have more variation. Comparing empirical mean and variance is a useful diagnostic, although matching them would not prove the whole model.
is the expected number of arrivals in the chosen window; probability mass is the chance of each integer count.
For a rate of four per hour, what mean belongs in a half-hour count generator?
Write a prediction (optional)
Seeded teaching simulation
Select Run Python below with the code unchanged.
A saved draft is open. To run the published example, open Tools and select Restore example. Recover draft brings your code back.
Execution error
Technical error details
Your result
Published example output
This result comes from the original Python. Your runs appear above. Build environment ↗
Model expected count: 2.0 Sample mean / variance: 1.98 1.975 Estimated P(no arrivals): 0.138 Exact model P(no arrivals): 0.1353
Read the first result
The rate-times-duration product supplies the generator’s expected count. A larger interval changes the count distribution.
Try an edit
Replace rate_per_hour, hours = 4, .5 with rate_per_hour, hours = 4, 2. Select Run Python again. Read Model expected count and compare both P(no arrivals) values with the first run. What happens to the chance of seeing zero when the window gets longer?
Scope. A constant-rate Poisson model omits burstiness, periodicity and arrival dependence.
Try a fresh case
A generator expects a mean count. You supply an hourly rate while modelling ten minutes. What is missing?
Need a hint?
Hint 1
Write the rate’s units beside the duration.
Hint 2
Check that the product has units of events.