Build inputs from evidenceLesson 20 of 76 · 7 min
Sample the observations you have
Use empirical resampling while recognising what the sample cannot contain.
An empirical distribution assigns probability to the observed values. Sampling those values with replacement is a simple way to propagate a recorded sample into a simulation without fitting a smooth distribution.
The example uses invented daily demand observations. They are assumed representative and exchangeable: each selected day can play the same role for the future question, so its position in the list is irrelevant. Sampling with replacement makes each selected value available again; one observation can appear several times.
The empirical model cannot draw beyond the observed range. Many resamples cannot establish that unobserved extremes are impossible. For seasonality or linked days, a different model may resample whole consecutive groups of days or account explicitly for day type. Those extensions need their own evidence.
Can this empirical generator produce a demand larger than its largest input observation?
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 ↗
Observed and resampled means: 59.7 59.72 Observed range: 42 83 Resampled range: 42 83 P(demand > 80) under this empirical model: 0.1022
Read the first result
The support is inherited from the input sample. A precise simulated fraction is conditional on that empirical distribution.
Try an edit
Replace 74, 58]) with 74, 58, 150]). Select Run Python again. Compare Resampled range and P(demand > 80) under this empirical model with the first run. What did adding the invented day make possible?
Scope. The input is invented. Independent daily resampling omits trends and dependence between days.
Try a fresh case
You have observations only from quiet weekdays. What is the concern when forecasting weekends?
Need a hint?
Hint 1
Identify which future conditions the observations represent.
Hint 2
Ask what sampling with replacement can and cannot invent.