Put uncertainty to workLesson 17 of 30 · 7 min

Ninety-five out of what?

Distinguish confidence-procedure coverage from the behaviour of an individual interval.

The previous interval came from one sample. To see the meaning of coverage, repeat the entire sampling-and-interval procedure from a population whose mean you know.

The simulation draws independent normal samples with population mean 100 ms. Each sample creates a new 95% t interval. An interval covers when its lower end is no greater than 100 and its upper end is no less. A miss does not by itself show the implementation is broken; misses are part of the procedure.

The fraction covering 100 fluctuates because the simulation itself is finite. The plot shows only the first thirty intervals; colour and an x marker identify misses. Increasing simulation count estimates the method's coverage more precisely under this model. It does not validate the model for your measurements.

What counts as covering?
Run1231201621938090100110120Interval for mean (ms)
Run1231201621938090100110120Interval for mean (ms)
3 covering intervals and 3 misses selected from the seeded reference to illustrate the definition. Across all 500 independent normal samples, the 95% procedure covered the true mean in 96.0% of runs. The population mean stays fixed at 100 ms.

Would you expect every interval in the first 30 to contain the true mean?

Write a prediction (optional)

Run the prepared example

This page puts the example in the Python editor. Select Run Python with the code unchanged.

Seeded simulation

Editor tools
About Python ↗

Ctrl+Enter or ⌘+Enter runs the code.

What to compare

Find Coverage fraction and Mean interval width (ms). The plot shows the first 30 intervals. Is the fraction based on those 30 or the full count in Intervals?

Published example output

The site ran the original code to produce this reference. Build environment ↗

Confidence level: 95%
Intervals: 500 Covering true mean: 480
Coverage fraction: 0.96
Mean interval width (ms): 18.76
The first 30 intervals from the seeded simulation all happen to cross the 100 ms true mean.
Open full-size figure ↗

The fraction counts all 500 samples. The first 30 in this seeded plot happen to cover the true mean. The reference illustration deliberately selects examples of both outcomes, so it cannot show how often they occur.

Change and run again

Change confidence_level from 0.95 to 0.99 and select Run Python again. Compare Coverage fraction and Mean interval width (ms) with the first run. Both runs use the same seeded samples. Return to the Python editor

What this example supports. The demonstration uses independent normal sampling, where the t procedure has its stated coverage. It says nothing about biased sampling or correlated measurements.

Try a fresh case

You run 100 valid experiments using a 95% confidence procedure. Must exactly 95 intervals cover the mean?

Choose an answer

Hints for this question
  1. Think of another repeated random count, such as coin tosses.
  2. Separate an expected proportion from an exact count.
Your notes