Stellar Grove · Concrete Mathematical Modelling
How sure is the predicted wait?
A day of observations pins down the arrival and service rates fairly well. How precisely does that pin down the wait?
Chapter 8 · Using a model: choice and estimation. A worked example rebuilt from the chapter's topic in Mike Mesterton-Gibbons, *A Concrete Approach to Mathematical Modelling*; the scenario and numbers are our own illustration, not the book's text. The day of observations is simulated from known rates, so the estimates can be checked against the truth.
Headline: Rates estimated to within about ±16% give a predicted wait of 2.7 minutes, but the 95% interval runs from 1.4 to 6 minutes: each 1% error in λ moves the wait by 2.4%, and that multiplier explodes as utilisation nears 1.
- 2.7 minestimated mean wait (truth 3)
- 1.4–695% bootstrap interval for the wait (minutes)
- 0%of bootstrap resamples where the estimated queue is unstable
The problem
An analyst times one checkout lane for a day: 148 customers, recording the gap since the previous arrival and each service time. The M/M/1 model then predicts the mean wait . How much should the store trust that number?
Estimating the inputs
For exponential times the maximum-likelihood rate is the reciprocal of the mean, with an exact interval from the chi-square distribution:
Arrivals: a minute (0.261–0.361); services: (0.445–0.615). Estimated utilisation .
Propagating the uncertainty
Two ways to carry input uncertainty to the output. The delta method linearises the formula; on the log scale (waits are positive and skewed):
That gives 1.4–5 minutes. The bootstrap resamples the observed gaps and service times 4,000 times and recomputes the wait each time: 1.4–6 minutes. In 0% of resamples and the model predicts an ever-growing queue.
Try it
Precision of the predicted wait
The band is the approximate 95% interval (delta method) for the wait, given how many customers were observed.
Key findings
- Precise inputs, imprecise output. λ and μ are each known to about ±16%, yet the wait is uncertain by a factor of 4.6 from low to high. The elasticity of to is = 2.4 at , and it would be 10 at ρ = 0.9 (try the sliders).
- The two methods agree roughly (delta 1.4–5, bootstrap 1.4–6); the bootstrap is the more honest one when the formula is this nonlinear.
- Decide what precision you need before collecting data. Quadrupling the sample roughly halves the log-scale interval (try the 'customers observed' slider); at low utilisation far fewer observations suffice.
Truth checks
| Check | Result |
|---|---|
| 95% interval for λ covers 0.3 | pass |
| 95% interval for μ covers 0.5 | pass |
| Bootstrap interval for the wait covers the true 3 min | pass |
import numpy as np
from books.concrete_mathematics import estimation as es
rng = np.random.default_rng(8)
gaps = rng.exponential(1 / 0.3, 400)
gaps = gaps[np.cumsum(gaps) <= 480]
service = rng.exponential(1 / 0.5, gaps.size)
wq = lambda l, m: l / (m * (m - l)) if l < m else np.nan
print([round(x, 1) for x in es.bootstrap(lambda g, s: wq(g.size / g.sum(), s.size / s.sum()), gaps, service, n=4000, rng=1)])
# → [2.7, 1.4, 6.4]
Assumptions and extensions
- The model is right. These intervals cover parameter uncertainty only; if service times are not exponential, the M/M/1 formula is biased as well as noisy (Chapter 4's validation comes first).
- Independent observations. Arrivals that cluster (busy periods) carry less information than their count suggests.
estimation.propagatedoes the Monte Carlo version from a parameter covariance, useful when only published estimates and standard errors are available.