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.

Resampling inherits its support
41.251.862.573.283.802985958931.2kReference drawsDemand
41.251.862.573.283.802985958931.2kReference drawsDemand
Reference illustration. Actual resampled values from the ten invented observations. No simulated draw can create an unobserved value outside the empirical support. This cannot establish that larger real demand is impossible.

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.

Tools
About Python ↗

The code is editable. Press Ctrl+Enter or ⌘+Enter to run Python from the editor.

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?

Back to the Python editor

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?

Choose an answer
Need a hint?
Hint 1

Identify which future conditions the observations represent.

Hint 2

Ask what sampling with replacement can and cannot invent.

Your notes