Choose random inputsLesson 10 of 76 · 7 min
Wait for the next event
Translate an event rate into the exponential waiting-time scale.
An exponential waiting time is nonnegative and right-skewed. For a homogeneous Poisson process of rate lambda, the waiting time to the next event has mean one divided by lambda.
NumPy’s exponential generator takes that mean scale. Passing the rate directly would invert the intended behaviour: increasing a rate should shorten waits. Use compatible time units when taking the reciprocal.
The model is memoryless: conditional on having already waited, the remaining wait has the same distribution. This can be useful for simple arrival or failure models, but is unsuitable when ageing or scheduling changes the event hazard. The empirical conditional comparison below illustrates, rather than proves, that property. Hazard means the event rate conditional on still waiting; it stays constant in this exponential model.
T is waiting time, is the event rate per time unit and E[T] is the model's mean wait.
Should increasing the arrival rate make the average wait longer or shorter?
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 ↗
Mean wait (hours): 0.3351 Mean remaining wait after 0.5 hours: 0.3297 Model mean wait: 0.3333333333333333
Read the first result
The two empirical means need not be identical. The conditional subset is smaller and has more sampling error.
Try an edit
Predict the model mean wait at twice the rate. Replace rate_per_hour = 3 with rate_per_hour = 6. Select Run Python again. Compare Model mean wait, Mean wait (hours) and Mean remaining wait after 0.5 hours. Why is the last simulated mean less stable when fewer waits survive the cutoff?
Scope. The example assumes a constant rate and independent increments; ageing and schedules need other models.
Try a fresh case
A scheduled bus is known to arrive every ten minutes. Is an exponential model automatically appropriate?
Need a hint?
Hint 1
Consider whether already waiting tells you anything about the remaining wait.
Hint 2
Compare scheduled events with a constant random hazard.