1.3.21 · D2Probability & Statistics

Visual walkthrough — Confidence intervals

1,754 words8 min readBack to topic

Step 1 — One sample gives one dot

WHAT. We have a big pile of things (people, test images, whatever). Each thing has a number. The whole pile has a true average we cannot see — call it (the Greek letter "mu", just a name for "the real average of everything"). We grab of them at random and average those:

  • — the -th measured number (the runs from up to ).
  • — how many things we grabbed (the sample size).
  • — read "x-bar", the average of this one handful.

WHY. is our single best guess for the invisible . But it is only one guess from one handful.

PICTURE. Look at the figure: the faint cloud is the whole population. The four coloured dots are four different handfuls we could have drawn — each gives a different . The true (yellow line) sits fixed while our guesses scatter around it.

Figure — Confidence intervals

Step 2 — Repeat the grab many times: a distribution of averages

WHAT. Imagine grabbing a handful, writing down , and repeating thousands of times. Those values form their own bell-shaped histogram, called the sampling distribution of the mean.

WHY. We cannot control one , but we can describe how the whole family of 's behaves. Predicting the family lets us reason about any single member.

The Central Limit Theorem promises that for a decent-sized this histogram is a normal (bell) curve:

  • — the bell curve with that centre and that spread.
  • — the variance (spread) of one raw measurement.
  • — the variance of the average; bigger ⇒ narrower bell.

PICTURE. The bell is centred exactly on (not shifted!) and its width is the Standard Error . Watch how doubling pinches the bell narrower.

Figure — Confidence intervals

Step 3 — Slide and stretch onto a universal ruler (standardize)

WHAT. Every normal bell has a different centre and width . We convert to one master bell — centred at , width — by subtracting the centre and dividing by the width:

  • — the same quantity , but relabelled in "number of standard errors away from ."
  • The bottom is the from Step 2.

WHY. On the master bell we know exactly which points cut off any tail area — those numbers are fixed constants, not something we recompute every problem. Standardizing turns "every problem is different" into "one ruler fits all."

PICTURE. Left: three different real bells. Right: they all collapse onto one standard bell after the shift-and-squeeze. The -axis is now labelled in units.

Figure — Confidence intervals

Step 4 — Carve out the middle of the master bell

WHAT. Pick a confidence level, say . Call the leftover (the we are willing to miss). Split it into two equal tails of each. The point on the master bell that leaves in the right tail is called .

  • — the total tail probability we sacrifice (miss rate).
  • — half of it, one for each side.
  • — the ruler mark cutting off that tail; for it equals .

WHY split evenly? We have no reason to fear over-guessing more than under-guessing, so we treat both tails symmetrically. This is the same two-tailed logic used in Hypothesis Testing.

PICTURE. The shaded green middle holds of all values; the two red tails hold each. The vertical marks at are .

Figure — Confidence intervals

Step 5 — Un-standardize: flip the statement inside-out

WHAT. We now undo Step 3 algebraically to free . Start from the inequality inside the probability and multiply every part by :

Subtract , then multiply by (which flips both signs):

  • Left/right edges — random, because they carry .
  • in the middle — fixed, just trapped between two wobbling walls.

WHY. Rearranging puts (what we care about) alone in the middle, so the picture becomes "a moving bracket that either catches or misses a nailed-down target."

PICTURE. The yellow is a fixed vertical line. Blue brackets are ten repeated experiments; each bracket is wide. About nine of ten brackets straddle the yellow line — the tenth (red) misses. The brackets move; the line does not.

Figure — Confidence intervals

Step 6 — Edge case: we never actually know

WHAT. In real life the population spread is unknown. We estimate it from the same sample:

  • (not ) — Bessel's correction; one degree of freedom was spent computing , so we divide by one fewer.

Swapping for injects extra randomness, so the master bell is no longer good enough. We use a slightly fatter cousin, the t-distribution with :

WHY a fatter curve? Because can under-guess the true spread, extreme values happen more often. Fatter tails ⇒ wider critical marks ⇒ honestly wider intervals. As , the t-curve melts back into the normal.

PICTURE. Overlay: the normal (blue) and with (red). Same peak, but red has thicker tails and its mark sits further out — that extra distance is the price of not knowing .

Figure — Confidence intervals

Step 7 — Degenerate limits: what breaks the picture

WHAT & WHY. Push the knobs to extremes and watch the interval respond — this is how you sanity-check any use.

  • : and is undefined (dividing by ). One data point tells you nothing about spread → no interval.
  • : , the bracket collapses onto . Infinite data ⇒ zero uncertainty.
  • Confidence (): , bracket widens to . "Certain" only if you claim everything.
  • Skewed data / heavy outliers: the CLT bell in Step 2 is a lie; the normal shortcut fails and you should reach for Bootstrap Methods or Bayesian Credible Intervals.

PICTURE. Margin of error plotted against — a curve. Steep drop early, then flat: the "diminishing returns" of more data. The dashed asymptote sits at .

Figure — Confidence intervals

The one-picture summary

Everything at once: raw scatter → bell of averages → standard ruler → carved middle → un-flipped bracket around , with widening it when is guessed.

Figure — Confidence intervals
Recall Feynman retelling — say it to a 12-year-old

I want the real average of a giant pile, but I only get one small handful, so I take that handful's average . If I imagine grabbing handfuls over and over, their averages pile into a bell centred on the true , and the bell's width is — more data, skinnier bell. I slide-and-squeeze that bell onto a universal one centred at zero, where I know the two marks (at ) that fence in the middle . I stretch those marks back to real units and rearrange until sits alone in the middle, trapped by a bracket . The bracket wobbles from sample to sample; stays put; about of every brackets catch it. Since I never truly know , I estimate it as (dividing by ), and to pay for that extra guessing I use the slightly fatter -marks — which quietly become the normal marks again once I have lots of data.

Recall Quick self-test

Why divide by and not ? ::: Averaging cuts variance by ; the spread () is the square root of variance, so it drops by . After computing , what is "random"? ::: The two endpoints (they carry ); the true is fixed. When must you switch ? ::: When is unknown and is small (); 's fat tails pay for estimating with . What happens to the interval as ? ::: , so the interval blows up to .

Related tools that reuse this machinery: A/B Testing, Cross-validation, Hypothesis Testing.