Build inputs from evidenceLesson 23 of 76 · 8 min
The parameters are estimates too
Separate uncertainty about an estimated parameter from variation in future outcomes.
If a model parameter was estimated from a finite sample, treating it as known hides one source of uncertainty. A bootstrap can approximate uncertainty in a statistic by resampling independent observed units and recalculating that statistic.
Below each row is a bootstrap sample of invented independent demand days. Its mean is one bootstrap estimate of expected demand. Those means describe uncertainty in an estimated expectation under this resampling model. They are not a distribution of individual future daily demand. The percentile bootstrap interval takes the 2.5th and 97.5th percentiles of these recalculated means. It is an approximate interval for the expected demand, relying on representative independent days; small samples can give poor coverage.
For a predictive model, future outcome variation and parameter uncertainty can both matter, but they must be combined coherently. Simply adding their standard deviations or reusing the same variation twice does not create a justified model. Later Bayesian examples show another way to separate these layers.
is original day i. A starred, barred d denotes the mean from one resampled set of days. In the question, classroom clustering means pupils in the same classroom can share dependence; the independent unit may be a whole classroom.
- Original independent days
- Bootstrap whole days
- Uncertainty about a mean
bootstrap percentile interval
Will the bootstrap means have the same spread as individual daily demands?
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 ↗
Daily-demand SD: 12.239 Bootstrap SD of estimated mean: 3.666 Percentile bootstrap interval for mean: [52.8 67.1]
Read the first result
The interval is an approximate percentile-bootstrap interval for an expectation. It inherits the sample’s representativeness and independence assumptions.
Try an edit
Add observed = np.repeat(observed, 10) immediately after observed = np.array([42, 55, 61, 47, 83, 59, 66, 52, 74, 58]). Select Run Python again. Compare Daily-demand SD, Bootstrap SD of estimated mean and the Percentile bootstrap interval for mean. Why can a tighter interval from these copied rows be misleading?
Scope. A bootstrap cannot recover unobserved populations or automatically repair correlated samples. Small-sample interval coverage can be poor.
Try a fresh case
You bootstrap individual pupils although treatment was assigned to entire classrooms. What is missing?
Need a hint?
Hint 1
Find which observations share an environment or assignment.
Hint 2
Preserve that dependence in a suitable resampling design.