Section 18.3.3

Mean boot bars with 95% confidence intervals

Definition

A mean bar chart with 95% confidence intervals §11.18 is a figure in which each bar’s height is a sample mean §11.12, here the mean boot duration of one software build over nn boots, and an error bar §18.1.11 drawn through the top of the bar marks a 95% confidence interval: a range produced by a method that encloses the true mean in 95% of repeated experiments. The half-width is the distance from the mean to either end of the interval. Each interval describes one bar, not the difference between two bars.

Where it fits

Main entry: Standard error (§11.15).

The standard error entry explains the standard error (SE) of a mean: the typical distance between one sample mean and the true mean, measured as the standard deviation §11.14 that the sample mean would show across repeated experiments. The true mean is the mean over all boots that the build could produce under the same conditions. A symmetric interval has half-width h=c×SEh = c \times \mathrm{SE}. The multiplier cc is 1.96 under the normal approximation, which treats the sample mean as following the bell-shaped normal distribution; the central limit theorem §15.45 justifies it for a mean of many independent values. For a small sample, the t distribution, which allows for the standard deviation being estimated from the same sample, gives a larger multiplier, about 2.045 for n=30n = 30. A reader who knows cc recovers SE=h/c\mathrm{SE} = h / c from each bar.

Write A‾\bar{A} and B‾\bar{B} for the mean boot durations of builds A and B. Their difference A‾−B‾\bar{A} - \bar{B} is a new estimand §11.2, a new quantity to estimate, and it has its own standard error SEA−B\mathrm{SE}_{A-B}: SEA−B2=SEA2+SEB2−2Cov(A‾,B‾),\mathrm{SE}_{A-B}^2 = \mathrm{SE}_A^2 + \mathrm{SE}_B^2 - 2\,\mathrm{Cov}(\bar{A}, \bar{B}), where Cov(A‾,B‾)\mathrm{Cov}(\bar{A}, \bar{B}) is the covariance §15.44 of the two means: a measure, in squared time units, of how much they rise and fall together across repeated experiments. Boots measured as two separate groups give independent means and a covariance of 0. A paired design §11.7, which matches each boot of A with a boot of B under the same conditions, such as the same board and the same session, usually gives a positive covariance and so a smaller standard error. The figure shows neither the design nor the covariance.

In an invented example, build A boots in a mean of 105 ms (milliseconds) with SEA=3\mathrm{SE}_A = 3 ms, and build B in a mean of 100 ms with SEB=2\mathrm{SE}_B = 2 ms. With c=1.96c = 1.96, the bars show half-widths hA=1.96×3=5.88h_A = 1.96 \times 3 = 5.88 ms and hB=1.96×2=3.92h_B = 1.96 \times 2 = 3.92 ms, and the difference is 105−100=5105 - 100 = 5 ms.

A correlation always lies between −1-1 and +1+1, so whatever the design, SEA−B\mathrm{SE}_{A-B} lies between |SEA−SEB||\mathrm{SE}_A - \mathrm{SE}_B| and SEA+SEB\mathrm{SE}_A + \mathrm{SE}_B. With one shared multiplier, the half-width of the difference therefore lies between |hA−hB||h_A - h_B| and hA+hBh_A + h_B, here between 1.96 ms and 9.80 ms. That range is all that the two error bars determine.

All data in this entry’s examples are invented.

Limits and common mistakes

A 95% confidence interval for a mean does not contain 95% of the individual boots. Because SE=s/n\mathrm{SE} = s / \sqrt{n}, where ss is the standard deviation of single boots, ss is 30≈5.5\sqrt{30} \approx 5.5 times the standard error when n=30n = 30.

Overlap of two intervals is not a test. With independent groups and equal standard errors ee, two 95% intervals stop overlapping only when the means differ by more than 2×1.96e=3.92e2 \times 1.96\,e = 3.92\,e. A two-sided hypothesis test §11.22 at the 5% level, which declares a difference when a difference at least as large as the observed one would occur less than 5% of the time if the true means were equal, already declares one once the difference exceeds 1.96×2e≈2.77e1.96 \times \sqrt{2}\,e \approx 2.77\,e. Overlapping intervals can therefore hide a difference that the data support.

The multiplier must be known. With small samples, the t multiplier of the difference depends on both sample sizes and on the design, so it can differ from the multiplier of each bar. An interval made by the bootstrap, which resamples the recorded boot durations, can be asymmetric and then has no single half-width.

A bar is an absolute duration. The time that a change adds is the difference between two bars, and only an interval for that difference supports a statement about it. A mean from one figure and a median §11.13 from another, or two durations that start or stop at different events, measure different quantities and cannot be subtracted.

Questions answered

Can you infer a confidence interval for the difference from two half-widths?

Not exactly: two half-widths bound the confidence interval for the difference but do not determine it. The missing quantity is the covariance of the two mean estimates, a measure of how much they vary together, which depends on how the experiment was designed and does not appear in the figure.

Adding the half-widths gives a range that is never narrower than the correct interval under the normal approximation, but usually much wider, so it is not a 95% interval. Subtracting the ends of one interval from the opposite ends of the other gives the same range. The correct route uses the raw measurements: for paired runs, an interval computed from the per-pair differences; for independent groups, the half-width cSEA2+SEB2c\sqrt{\mathrm{SE}_A^2 + \mathrm{SE}_B^2}; or a bootstrap that resamples whole pairs or each group separately.

Related entries: Correlation and covariance (§15.44), Confidence interval (§11.18), Paired design (§11.7), Confidence intervals, whiskers, and uncertainty semantics (§18.1.11).