Checking that your intervals actually cover
Today let's check whether a 95% confidence interval actually covers the truth 95% of the time, the way its label says.
Picture a clinic's walk-in desk. Every patient's wait, in minutes, gets logged at the front desk. Most patients wait only a few minutes, but a few wait much longer, so the wait times are skewed, pulled hard to the right by that long tail. Across every patient who could ever walk through that door, the true average wait is 4 minutes.
In real work you would never know that true average ahead of time. Not knowing it is exactly why anyone reaches for a confidence interval in the first place. But to check whether a 95% interval's label is honest, this lesson needs to know the true answer before building anything.
Draw a small sample of 5 wait times, and build the usual 95% interval for the average wait from that one sample. Now repeat the whole thing 60 times over: 60 fresh samples of 5 wait times each, 60 intervals. If the 95% on the label means what it says, only about 3 of those 60 should miss the true average.
Here is what 60 of them actually look like, drawn from a population skewed the same way the clinic's wait times are.
50 of those 60 touch the true value marked on the chart. 10 miss it outright, and every single one was built the exact same honest way, with the exact same 95% formula. So what happened to the other 10? That is exactly what this lesson is about.
One sample, one interval, and no way to tell if it covers
Before asking why some of those sixty missed, build one confidence interval the usual way, using one real sample of the clinic's wait times, so there's something concrete on the page to ask the question about.
Five wait times came back: 0.79, 2.64, 1.13, 0.15, 1.89 minutes. xbar, the sample mean, is their average: 1.32 minutes. se, the standard error, is how much that average would move around if you kept drawing fresh samples of 5 and recomputing the mean each time: 0.43 here.
The interval itself is built the usual way: take the sample mean, then add and subtract a margin of error. That margin is qnorm(0.975), the normal distribution's cutoff that leaves 2.5% in each tail, multiplied by the standard error. Because that margin comes from the normal distribution, this kind of interval is called a z interval, and its two ends, 0.47 and 2.17, are exactly xbar minus and plus that one margin.
Look at where that interval sits: 0.47 to 2.17. The true average wait is 4 minutes, and 4 is nowhere inside that range. This one interval, built the honest way with the correct formula, missed.
So this one interval cannot tell you whether its own recipe is trustworthy. It is a single outcome, and a single outcome of even an honest recipe is sometimes going to miss. What you need is not one interval, but a way to check the recipe itself.