SStatistics, Built

Stage II · Bachelor's: Methods

Part 11 of 65

Honest Intervals

Bachelor'sstarts at this level52 min of film13 chaptersprerequisites: Part 8, Part 10

What does '95% confident' promise, and which intervals keep it?

The part opens with the textbook interval for a proportion, the estimate plus or minus 1.96 standard errors, and computes its coverage exactly: it zigzags below 95% in a sawtooth, and at p = 0.005 one more observation (592 instead of 591) drops it from 94.5% to 79.2%. Neyman's definition says what was promised: coverage of at least 1 - alpha for every parameter value, a property of the procedure and not of the interval in hand. Pivots give exact intervals in the normal and exponential models, and inverting tests through Neyman's belt gives a confidence set for almost anything, including Wilson's and Clopper-Pearson's intervals for a proportion. The part then turns to what cannot be had: discrete data force a choice between a guarantee and an average, and Fieller's set for a ratio is sometimes two rays or the whole line, as it must be. It ends by separating confidence from prediction and from Bayesian credibility with Welch's two uniform draws, and by writing down the Coverage Board's protocol.

What you need. Calculus; the binomial, normal, t and chi-squared distributions of Stage I.

Hook
the broken Wald interval
Mathematics
Neyman's construction, pivots, inversion, the binomial family, Fieller, prediction and tolerance intervals
Built
the Coverage Board, formally

What you will be able to do

Bachelor's

  • Say what a 95% confidence interval promises and what it does not, and tell a confidence interval from a prediction interval.
  • Compute Wald and Wilson intervals for a proportion, and apply the rule of three after zero events.

Master's

  • Build an interval from a pivot, and derive Wilson's and Clopper-Pearson's intervals by inverting a test.
  • Compute an interval's exact binomial coverage, and explain why it jumps as p or n moves.

PhD

  • Prove the duality between level-alpha tests and confidence sets, and explain why no non-randomized interval for a binomial p has coverage exactly 95% at every p.
  • State what Gleser and Hwang's theorem requires of any honest confidence set for a ratio, and work Welch's example of a relevant subset.

Practice

  • Choose and report an interval for a rare proportion, a ratio or a new observation, saying whether its coverage is guaranteed or approximate.
  • Run a coverage check by the Board's protocol, with its Monte Carlo standard error and verdict rule.

Contents

Each chapter has a home level. Choose a track to see what to read and watch: Bachelor's 24 min · Master's 43 min · PhD 52 min · Practice 28 min.

  1. 0The sawtoothBachelor's3 min
  2. 1Neyman's promiseBachelor's5 min
  3. 2PivotsBachelor's4 min
  4. 3Inverting testsMaster's4 min
  5. 4The binomial familyBachelor's5 min
  6. 5Likelihood intervalsMaster's4 min
  7. 6DiscretenessMaster's4 min
  8. 7Ratios: FiellerPhD4 min
  9. 8Simultaneous intervalsMaster's4 min
  10. 9Prediction and toleranceBachelor's4 min
  11. 10Credible vs confidencePhD5 min
  12. 11The Coverage Board, formallyPractice4 min
  13. Recap, problems, and the road aheadAll tracks3 min

Also on this page: Lecture · Key results · Try it · Lab · Problems · Notes and sources · Build the film.

Lecture

The text of each chapter is the film's narration, as it is spoken, so you can read along or revise without the film. The pictures are in the film.

The sawtoothBachelor's3 min

Here's the most widely used confidence interval in the world: the sample proportion, plus or minus one point nine six standard errors. It's in nearly every textbook, every opinion poll's margin of error, and every spreadsheet. It goes back to Laplace, and it's usually called the Wald interval. It promises to contain the true proportion ninety-five percent of the time. Let's check, exactly. For a binomial count there are only n plus one possible outcomes, so the chance the interval covers the truth can be computed exactly, with no simulation at all.

Take a true proportion of point two. Here is the interval's exact coverage, for every sample size from ten to a hundred. The green line is the promise: ninety-five percent. The coverage is almost always below it, as low as eighty-one and a half percent, and it doesn't climb smoothly toward the promise as n grows. It zigzags, a sawtooth: up, then a sudden drop, then up again. The teeth come from discreteness. The count can only take whole values, and as n changes, the possible values of p-hat slide past the edges of the interval in jumps.

In 2001, Lawrence Brown, Tony Cai and Anirban DasGupta published a paper that showed how bad this is, and it changed how statisticians teach the subject. Their most startling example: a true proportion of half a percent. With five hundred and ninety-one observations, the Wald interval covers ninety-four and a half percent of the time, close to the promise. With five hundred and ninety-two, seventy-nine percent. One more observation, and fifteen points of coverage vanish. Even at p equals a half, where the normal approximation should be best, there are lucky and unlucky sample sizes: seventeen observations cover ninety-five percent, forty only ninety-two.

Now fix fifty observations and vary the true proportion. The coverage is a jagged comb, below the promise almost everywhere, and near zero and one, where real-world proportions often live, it collapses: a rare event with a true rate of one percent is covered less than four times in ten. Averaged over all p, it's ninety point seven percent. This part is about intervals that keep their promises: what the promise means, how to build intervals that keep it, and how the Coverage Board checks.

What it does: The Wald formula; exact coverage against n at p = 0.2 and against p at n = 50; BCD (2001); objectives.; Numbers: 81.5–95.4% at p = 0.2; 591 vs 592: 94.5% vs 79.2%; mean over the displayed p grid 90.7%

1Neyman's promiseBachelor's5 min

The theory of confidence intervals was set out by Jerzy Neyman in 1937, in a long paper with a modest title: an outline of a theory of statistical estimation based on the classical theory of probability. Laplace and Gauss had attached plus-or-minus errors to their estimates for a century, but informally. Fisher had proposed his own idea, the fiducial interval, which treated the parameter as if it had a distribution after the data; its general interpretation and uniqueness remained controversial. Neyman's move was to make the interval itself the random object, and to ask how often it would succeed.

Here's the definition. A rule that turns data into a set is a ninety-five percent confidence set if, for every possible value of the parameter, the probability that the set contains it is at least ninety-five percent. The probability is over the data. The parameter is fixed, unknown but not random. And the words for every theta matter. The promise must hold whatever the truth is, which is exactly what the Wald interval fails: it's fine for some p and terrible for others. Strictly, the guaranteed level is the worst case over all theta, called the confidence coefficient. An interval that's ninety-five percent only on average over theta hasn't kept the promise.

Here's the promise in action. The World knows the true mean height of its men: one hundred and seventy-six centimetres. Draw ten men, compute Student's t-interval, and draw it as a line. Green if it catches the truth, red if it misses. Another sample, another line. Let it rain: a hundred samples. Each interval is different, centred where its sample happened to fall. Most catch the truth; a few miss. Ninety-three out of this hundred. Over ten thousand samples, ninety-four point nine percent. For this nearly normal population the t interval is approximate; exact coverage requires independent normal draws. Confidence refers to a long-run rate of success for the procedure.

Now the hard part. You've collected your one sample and computed your one interval: say, a hundred and seventy-one point four to a hundred and eighty point two. It's very tempting to say there's a ninety-five percent chance the true mean lies in that interval. In Neyman's theory that's wrong. The mean is either in it or not; nothing about it is random any more. The ninety-five percent describes the procedure, not this particular interval. Think of a ring-toss machine that rings the peg ninety-five percent of the time. Once a ring has landed, it either rang the peg or it didn't. To put a probability on the mean itself, you need a prior distribution for it, which is the Bayesian answer of chapter ten and Part 15.

Sometimes only one side matters. A regulator wants an upper bound on a side-effect rate; an engineer wants a lower bound on a beam's strength. A one-sided confidence bound promises that the parameter is below it, or above it, with probability at least ninety-five percent. For a mean from independent normal data, that's x-bar plus t point nine five standard errors, with all five percent in one tail, so the bound is tighter than the end of the two-sided interval. Like a one-sided test, the side has to be chosen before looking at the data. It's the duality again: one-sided bounds invert one-sided tests.

The level is a choice, and it costs width. Here is one sample of ten men, with its eighty, ninety-five and ninety-nine percent intervals. More confidence, wider interval. For an unrestricted normal mean, a hundred percent interval must almost surely be the whole real line: certain to be right, and useless. To be both confident and precise, gather more information, through more data or a less noisy design: width shrinks like one over root n, as Part 8 showed.

Intervals also plan studies. A poll's margin of error is half the width of a ninety-five percent interval for a proportion, and it's largest when p is a half. Set it to three points and solve: round up to a thousand and sixty-eight respondents under this simple random-sampling approximation, the famous poll of about a thousand that Part 8 met. Halving the margin to a point and a half needs four times the sample, over four thousand. And a common slip: the margin applies to one candidate's share. The gap between two exhaustive choices has exactly twice the standard error of one share; with other choices, the covariance determines the gap's error.

What it does: Neyman (1937); the definition; the interval rain on the World's men; what 95% does not mean; one-sided bounds; levels and widths; planning a poll.; Numbers: 93 of 100; 94.9% of 10,000; mean width 9.9 cm; n = 1,068 after rounding up for ±3%

2PivotsBachelor's4 min

The cleanest way to keep Neyman's promise is a pivot. A pivot is a function of the data and the parameter together whose distribution is the same, whatever the parameter is. Then pick two quantiles of that known distribution: the pivot lands between them with probability exactly one minus alpha for a continuous pivot; discrete quantiles can be conservative. Solve the inequalities for theta, and the set of parameters satisfying them is a confidence set. Continuous pivots with exact cutpoints give exact coverage for every theta. For independent normal data, Student's t statistic is the classic pivot: its distribution is t with n minus one degrees of freedom whatever mu and sigma are, and solving gives the t-interval of the last chapter.

The pivots of the textbook. The normal mean, by Student's t. The normal variance, by Part 8's chi-squared, divided into the sum of squares. The ratio of two independent normal samples' variances, by Snedecor's F. The exponential rate: lambda times the total waiting time is a gamma variable with shape n, whatever lambda is. And the uniform on zero to theta, the continuous tank problem: the maximum over theta has a fixed beta distribution. Simulation confirms the coverage: ninety-five point four and ninety-four point nine percent, both within Monte Carlo error. Each interval is exact, but only if its model is right: the variance interval, for example, needs normal data, as Part 8's coverage check showed.

A pivot doesn't fix the interval uniquely. Any two quantiles that enclose ninety-five percent of the pivot's distribution give a ninety-five percent interval. For the variance, the pivot is chi-squared, which is skewed. The usual choice cuts two and a half percent from each tail. But within the family using fixed pivotal cutpoints, the shortest interval for sigma squared uses different cut points, found by solving a small equation, and with ten observations it's about sixteen percent shorter, with exactly the same coverage. Equal tails remain the convention, because they're simple and they invert a two-sided test with equal error in each direction.

Back to Part 9's tanks, approximated here by independent continuous uniform draws, rather than the exact integer model without replacement. The chance that all k serials fall below a fraction u of N is u to the k. So the maximum over N is at least point zero five to the one over k with probability ninety-five percent. Solve: N lies between the maximum and the maximum times point zero five to the minus one over k. For the factory with six captured tanks and a largest serial of two hundred and fourteen, that's two hundred and fourteen to three hundred and fifty-three, and the truth, three hundred, is inside. The interval starts exactly at the largest serial seen, as it must.

Most problems have no exact pivot. In regular models an asymptotic pivot may work: the estimate minus the truth, over the estimated standard error, is approximately standard normal, so the estimate plus or minus one point nine six standard errors is an approximate ninety-five percent interval. That's a Wald interval for a regular asymptotically normal estimator, with Part 9's curvature supplying the standard error. It fails when the standard error is poorly estimated or the plug-in degenerates near a boundary. For a proportion, the estimated standard error is zero whenever the count is zero, and the interval shrinks to a point. There are two cures: invert a test that uses the standard error the null hypothesis implies, which is the next chapter, or transform to a scale where the approximation is better, like the log-odds or Fisher's z at interior values. These transformations do not fix zero counts automatically.

What it does: The recipe; five pivots and their checks; equal tails vs shortest; the tanks; the asymptotic pivot and its failures.; Numbers: rate 95.4%, F 94.9%; tanks [214, 353]; shortest σ² interval 16% shorter

3Inverting testsMaster's4 min

There's a second way to build intervals, and it works almost everywhere. For every candidate value theta-nought, run a test of whether the parameter equals theta-nought. The confidence set is every value the test doesn't reject. And conversely, rejecting whenever theta-nought falls outside a confidence set is a test. The proof is one line: the event that the true theta is in the set is the event that the data land in the true theta's acceptance region, which has probability at least one minus alpha. Tests and intervals are two views of one object.

Neyman drew this as a picture, the confidence belt. Twenty trials. For a given true p, say point three, the central equal-tail exact test at five percent accepts the counts from two to ten: those are the outcomes not too surprising if p is point three. At p equals point seven, it accepts ten to eighteen. Do that for every p, and the accepted regions sweep out a belt. Read across, the belt is a family of tests. Now read it the other way. We observed seven successes. Go up the column at x equals seven, and the p's whose belt contains seven form the interval: point one five four to point five nine two. That's the Clopper–Pearson interval, from 1934, built by inverting exact binomial tests. By the duality, its coverage is at least ninety-five percent for every p. The Wald interval for the same data is shifted down and narrower: that's where its missing coverage goes.

Every family of intervals has a belt, and comparing belts shows what goes wrong. On the left, Clopper–Pearson's belt, built from exact tests. On the right, the belt the Wald intervals imply: for each p, the counts whose Wald interval contains it. Near zero and one, Wald's belt pinches almost shut. For a small p, only a count or two is accepted, and together they carry far less than ninety-five percent of the probability. That pinch is the collapse of coverage at the edges, seen from the side.

The duality gives a richer summary than any single interval. For our seven of twenty, test every possible p-nought and plot the p-value. This is the p-value function, sometimes called the confidence curve. Cut it at point zero five, and the values above the line are the ninety-five percent interval. Cut at point five, and you get a fifty percent interval. Its maximum can be a plateau: the most compatible values under this particular test ordering. It shows every interval at every level at once, and it makes clear that the edges of a ninety-five percent interval aren't walls: values just outside are barely less compatible than values just inside.

A family of tests inverts into a confidence set, which need not be an interval. Central equal-tail exact binomial tests give Clopper–Pearson. The score test, which uses the standard error the null hypothesis implies, gives Wilson's interval. The likelihood ratio test gives the likelihood interval. The Wald test, which uses the estimated standard error, gives the Wald interval. And in a common location-shift model, inversion of a Wilcoxon rank test gives the Hodges–Lehmann interval of Part 16. The quality of the interval is the quality of the test, and the next chapter compares them.

What it does: The duality theorem; Neyman's belt at n = 20; Clopper–Pearson from it; Wald's pinched belt; the p-value function; which test gives which interval.; Numbers: x = 7: [0.154, 0.592] (Wald [0.141, 0.559])

4The binomial familyBachelor's5 min

The better intervals have been available for almost a century. In 1927 Edwin Bidwell Wilson, a mathematician and physicist who had been Gibbs's student, inverted the score test. In 1934 Charles Clopper and Egon Pearson inverted exact tests, and got an interval whose coverage never falls below ninety-five percent. In 1998 Alan Agresti and Brent Coull, in a paper with the provocative title 'Approximate is better than exact', proposed adding two successes and two failures and then using the Wald formula. And Brown, Cai and DasGupta found that the Bayesian interval from Jeffreys' prior also behaves like a good confidence interval.

Here's why Wilson's interval works. The score test divides by the standard error the null value implies, root p-nought times one minus p-nought over n, not by the estimated one. Squaring, the accepted values of p-nought satisfy a quadratic inequality, and its two roots are the interval's ends. The interval's centre isn't p-hat: it's pulled toward a half, as if z squared over two extra successes and failures had been added. Even with zero successes, the interval has positive width. Agresti and Coull's idea: z squared over two is almost two, so add two successes and two failures, and use the plain Wald formula around that centre.

Now the comparison, with exact coverage curves for fifty trials. All averages and minima here refer to the displayed parameter grid. Wald: mean ninety point seven, and a minimum off the bottom of the chart, twenty-two percent near the edges. Wilson: mean ninety-five point two, close to the promise, with dips to ninety-one near the edges. Agresti–Coull: slightly conservative, ninety-five point eight on average, and no sampled grid value below ninety-three and a half. Clopper–Pearson: always at or above ninety-five, as guaranteed, but at the price of averaging ninety-seven: it promises ninety-five and delivers more, by being wide. Jeffreys: mean ninety-five point oh, with deep dips near zero and one. And the likelihood ratio interval: mean ninety-four point eight, also dipping at the edges. All of them sawtooth, because the data are discrete. None is perfect; the Wald interval is simply the worst.

Back to the hook's picture, with the better intervals added. The Wald interval's coverage at p equals point two, as n grows. Wilson's: still a sawtooth, from ninety-two and a half to ninety-eight, but straddling the promise instead of sitting below it. Agresti–Coull, similar and a little higher. Discreteness never goes away; what changes is whether the teeth point up or down.

What do the better intervals cost? Width. At p equals a half, they're all about the same, around point two seven. At p equals point zero five, the Wald interval is the narrowest, point one zero, and Agresti–Coull and Clopper–Pearson the widest, near point one four. But the Wald interval is narrow there precisely because it's wrong there. A short interval that misses isn't a bargain. Coverage has to be checked before width means anything.

A realistic case from the World, which has a silent condition affecting just under one percent of adults. Binomial calculations approximate this survey without replacement; the sampling fraction is small. A survey of three hundred adults finds four cases. The Wald interval runs from point zero zero zero four to point zero two six; Wilson's and Clopper–Pearson's from about point zero zero four to point zero three four. All three happen to contain the truth this time. But Wald's lower end, one in twenty-eight hundred, is an artefact of forcing a symmetric interval onto a skewed problem, and its upper end is too low: exactly the pattern that makes it miss so often near zero.

Brown, Cai and DasGupta's advice has become standard. Never use the Wald interval for a proportion. For small samples, Wilson or Jeffreys; for forty or more, Agresti–Coull is fine too, and it's easy to teach. Use Clopper–Pearson when the ninety-five percent must be guaranteed for every p, as in a regulatory setting, and accept the extra width. All six are in statkit's intervals module, with a function that computes any interval's exact coverage, so you can check them yourself.

What it does: Wilson, Clopper–Pearson, Agresti–Coull, Jeffreys; Wilson's derivation; six exact coverage curves; sawtooths against n; widths; the World's rare condition; advice.; Numbers: grid means 90.7 / 95.2 / 95.8 / 96.9 / 95.0 / 94.8%; 4 of 300

5Likelihood intervalsMaster's4 min

Here's a concrete case: two successes in thirty trials. The six intervals, each a line. The Wald interval runs from zero to point one five six. Its lower end is clipped at zero, because the formula goes negative. But zero is not a plausible rate after seeing two successes. The others start between point zero zero eight and point zero one eight, and they reach higher, to about point two, because with a skewed likelihood the uncertainty is mostly upward.

Why the difference? Look at the likelihood. For two of thirty, the log-likelihood rises steeply from zero, peaks at one fifteenth, and falls slowly to the right: it's skewed. The likelihood interval takes every p where the curve is within one point nine two of its peak, half of three point eight four, by inverting the likelihood ratio test with Wilks' theorem: point zero one one to point one nine two. The Wald interval is what you'd get from the parabola that matches the curve's curvature at the peak, the dashed line. A parabola is symmetric, so it spills below zero on the left and stops short on the right. The likelihood interval follows the actual shape.

Likelihood intervals have the invariance of Part 9's maximum likelihood estimates. Change coordinates to the log-odds, the scale logistic regression uses. The likelihood interval for the log-odds is exactly the log-odds of the interval for p: the cut at one point nine two doesn't care how the parameter is labelled. The Wald interval does care. A Wald interval on the log-odds scale, transformed back, is a different interval from Wald on the p scale, and often a better interior approximation. It is undefined at zero or all successes without an additional convention. That's why software reports intervals for odds ratios on the log scale, a point Part 14 returns to on the Coverage Board.

When does the choice of method stop mattering? Take Part 9's horse kicks: a hundred and twenty-two deaths in two hundred corps-years. The Wald interval for the rate, the likelihood ratio interval, and Garwood's exact interval agree to within about a hundredth. With a hundred and twenty-two events the log-likelihood is almost exactly a parabola, which is the condition under which Wald, likelihood and exact methods agree to first order. They differ where it matters: few events, or a parameter near the edge of its range.

And the edge case where the Wald interval is most absurd: zero events. A new drug is given to a hundred patients and nobody has a serious side effect. The Wald interval is zero to zero. But the chance of zero events in n trials is one minus p to the n. For an exact one-sided ninety-five percent upper bound, set that to five percent and solve: the largest rate still consistent with seeing nothing. Since minus log point zero five is almost exactly three, the upper limit is about three over n. This differs from the two-sided Wilks likelihood cutoff. That's the rule of three: after a hundred clean patients, the side-effect rate could still be as high as three percent. James Hanley and Abby Lippman-Hand popularized it in 1983, in a paper titled 'If nothing goes wrong, is everything all right?'

What it does: Six intervals for 2 of 30; the skewed likelihood; invariance and log-odds; agreement at large n (horse kicks); the rule of three.; Numbers: LR [0.011, 0.192]; 3/n vs 1 − 0.05^(1/n)

6DiscretenessMaster's4 min

Why does every interval for a count sawtooth? Here are the twenty-one Wilson intervals for twenty trials, one for each possible count, stacked vertically. Fix a true p, the dashed line. The intervals it crosses are the outcomes that would cover it, and the coverage is their total binomial probability. Slide p. Between endpoints the set of covering outcomes stays the same and the coverage changes smoothly. But each time p crosses an endpoint, a whole outcome enters or leaves the set, and the coverage jumps. Those jumps are the teeth of the saw, and no fixed set of intervals can avoid them.

It's a theorem, not a failure of imagination. With finitely many outcomes, the coverage of any fixed family of intervals is a sum of polynomials in p that jumps at the endpoints. So it can't equal ninety-five percent for every p. Exact coverage is impossible. Wilfred Stevens showed in 1950 that it can be achieved by randomization: after seeing the data, toss a coin to decide exactly where the interval ends, just as the Neyman–Pearson lemma randomized at ties. Many applications avoid intervals that depend on an additional random draw. So we have to choose what to give up.

The Clopper–Pearson interval chooses to guarantee the promise. At twenty-five trials its coverage never dips below ninety-five percent, but its displayed grid average is ninety-seven and a half: it's too careful nearly everywhere. The mid-p version, from Henry Lancaster in 1961, counts only half the probability of the observed outcome when computing the tail. Its displayed grid coverage averages ninety-five point nine, much closer to the promise, but it dips to ninety-three. That's the choice in a nutshell: guarantee the promise everywhere, and be wide; or accept some undercoverage in exchange for shorter intervals. There is no deterministic exact ninety-five percent calibration at every p.

Counts of events, Poisson rather than binomial, have the same problem and the same cure. Frank Garwood in 1936 inverted exact Poisson tests, and the chi-squared distribution gives the limits in closed form. Its coverage, in orange, never falls below ninety-five percent. The Wald interval, the count plus or minus one point nine six root count, averages eighty-five percent over this range and is useless when the count is zero. After zero events, Garwood's two-sided upper limit is three point six nine. The rule of three instead refers to the one-sided ninety-five percent upper bound, minus log point zero five, about three.

One more exact interval, which needs independent identically distributed continuous data, but no parametric shape model. Each observation falls below the population median with probability one half, whatever the distribution. So the number below the median is binomial with probability a half, and the interval between the r-th smallest and r-th largest observations covers the median with a probability we can compute exactly. It's Part 10's sign test, inverted. With twenty observations, the sixth smallest to the sixth largest covers the median ninety-five point nine percent of the time, for any continuous distribution. But it's discrete again: the next choice in only covers eighty-eight percent, so ninety-five exactly isn't available. William Thompson published it in 1936.

Distinguish guaranteed coverage from approximate nominal coverage. The strict one, Neyman's: at least ninety-five percent for every p. Clopper–Pearson keeps it. The approximate one: close to ninety-five percent on the displayed grid, with dips that can be substantial near boundaries. Wilson, Jeffreys and mid-p do not guarantee the strict promise. And one poor approximation: far below ninety-five for whole ranges of p, which is the Wald interval. The Coverage Board's verdicts reflect this: kept within Monte Carlo error, conservative if well above, broken if well below.

What it does: Why coverage jumps; exact 95% coverage at every p is impossible without randomization; mid-p; Garwood's Poisson interval; the order-statistic median interval; guaranteed versus approximate nominal coverage.; Numbers: CP grid mean 97.5%, mid-p 95.9% (n = 25); Garwood min 95.6%, Wald 85% on average; (X₍₆₎, X₍₁₅₎) 95.9%

7Ratios: FiellerPhD4 min

Many quantities of interest are ratios of two means. In bioassay, the relative potency of two drugs, or the dose that kills half the subjects. In health economics, the extra cost per life saved. In Part 8, Laplace's people per birth. The delta method gives an estimate plus or minus one point nine six standard errors. That works when the denominator is far from zero compared with its uncertainty, and fails badly when it isn't.

Edgar Fieller's idea, in 1940, was to avoid dividing at all. At the true ratio rho, the combination y-bar minus rho x-bar has mean zero, and for jointly normal means with known covariance it's exactly normal, with a variance we can write down. So accept every rho for which this pivot is within z standard errors of zero. Squared out, that's a quadratic inequality in rho. Its solution set is Fieller's confidence set, and its coverage is exact under this known-covariance normal model. A common independent estimated variance scale uses a t cutoff instead. But a quadratic inequality doesn't always describe an interval.

Four datasets, each mean measured with a standard error of one. When x-bar is ten, far from zero, Fieller's set is an ordinary interval, almost the same as the delta method's. When x-bar is two point two, Fieller's interval is bounded but strongly skewed, from one to twenty-one, while the delta method's is symmetric and stops at four and a half: it understates how large the ratio could be. At one point seven, the denominator might plausibly be zero, and the solution of the quadratic is two rays: everything above one point one seven, and everything below minus nineteen. The ratio could be huge, of either sign. And at point eight, the confidence set is the whole line. At this confidence level no finite ratio is excluded, and Fieller's method says so, where the delta method confidently reports a finite interval.

There's a one-number summary of which case you're in. Fieller's index g is z squared times the denominator's variance over its squared estimate: one over the denominator's squared z-score, scaled. The set is bounded exactly when g is less than one, which is when the denominator is significantly different from zero. Our four cases have g of point zero four, point eight, one point three and six. A common rule in bioassay is to trust the delta method only when g is below about point zero five.

Is the infinite answer a defect? No. Leon Gleser and Jiunn Tzon Hwang proved in 1987 that under appropriate weak-identification conditions, as a ratio does when the denominator's mean is zero, every confidence procedure that keeps its promise for every parameter value must sometimes return an unbounded set. Fieller's infinite answers are honesty, not failure. Any method that always reports a finite interval for a ratio must break its promise near a zero denominator. The same theorem governs weak instruments in econometrics, and Part 37's Anderson–Rubin intervals, which can also be infinite.

What it does: Where ratios arise; Fieller's quadratic; four cases (bounded, skewed, two rays, the whole line); the g index; Gleser & Hwang (1987).; Numbers: g = 0.04, 0.79, 1.33, 6.0

8Simultaneous intervalsMaster's4 min

Part 10's multiple-testing problem has an interval version. If you report k intervals, each at ninety-five percent, the chance that all of them cover their targets is ninety-five percent to the k, if they're independent. With ten, sixty percent. If a conclusion depends on all the intervals being right at once, the individual promises aren't enough.

The Bonferroni fix works for intervals as for tests: make each one at level one minus alpha over k, and the union bound guarantees that all k hold together with probability at least one minus alpha, however they're related. For five intervals, the multiplier rises from one point nine six to two point five eight: each interval is about a third wider.

A simulation makes it concrete. Ten independent means, each with a t-interval from fifteen observations. Each interval keeps its promise, but all ten hold together only sixty percent of the time, just as point nine five to the tenth predicts. With Bonferroni's adjustment, each interval at ninety-nine and a half percent, all ten hold together ninety-five percent of the time. The price is a multiplier of three point three instead of two point one.

In the independent normal common-variance model, Henry Scheffé went further in 1953. His intervals cover every contrast among k group means simultaneously, infinitely many of them, including contrasts you only thought of after looking at the data. The multiplier comes from the F distribution, square root of k minus one times an F quantile. It's the price of fishing, paid in advance: wider intervals, but a promise that survives any amount of looking. John Tukey's method does the same for all pairwise differences, and the Working–Hotelling band of Part 12 does it for every point on a regression line.

The most beautiful simultaneous interval is a band around a whole distribution. Here's the empirical distribution function of a hundred of the World's men, Part 1's staircase. The Dvoretzky–Kiefer–Wolfowitz inequality, from 1956, with the sharp constant Pascal Massart proved in 1990, says the chance that the staircase strays more than epsilon from the true curve, anywhere at all, is at most two e to the minus two n epsilon squared. Solve for epsilon at five percent: point one three six for a hundred observations. So this band, the staircase plus and minus point one three six, contains the entire true distribution function with probability at least ninety-five percent, whatever that distribution is. Here's the truth, in green, inside it.

How much does the simultaneity matter? Over two thousand samples of a hundred men, the band contains the whole true curve ninety-five point eight five percent of the time, checking both limits at all CDF jumps. Now try the naive alternative: a separate nominal ninety-five percent Wald interval for the distribution function at each of two hundred points, and ask how often all of them hold together. Less than one percent of the time. These Wald intervals also undercover individually near the tails, so this comparison combines poor marginal calibration with multiplicity. It does not isolate simultaneity alone. The band was built for the joint promise, and Part 48 shows where its shape comes from.

What it does: 0.95ᵏ; Bonferroni; ten intervals simulated; Scheffé (1953); the DKW band on 100 heights; band vs pointwise.; Numbers: 60% vs 95%; ε = 0.136; whole-CDF band 95.85% vs 200 pointwise Wald intervals jointly 0.8%

9Prediction and toleranceBachelor's4 min

A common confusion. You've measured ten men and computed the ninety-five percent interval for the mean height. Will the next man you meet be inside it? Only half the time: forty-nine point eight percent. A prediction interval, built for the next observation, contains him ninety-five point one percent of the time. The confidence interval describes uncertainty about the average; an individual varies around the average by a whole standard deviation, not a standard error.

The new observation differs from the sample mean by its own deviation, variance sigma squared, plus the mean's error, variance sigma squared over n. Studentized, that's again a t pivot for independent normal observations. So the prediction interval is x-bar plus or minus t times s times root one plus one over n. As n grows it doesn't shrink to a point, as a confidence interval does: it settles at the mean plus or minus one point nine six standard deviations, the central ninety-five percent range of a normal population.

There's a catch. The prediction pivot needs normal data, and here the central limit theorem can't help. On the World's skewed incomes, with nineteen observations, the normal prediction interval covers the next income only ninety-three point seven percent of the time. A confidence interval for a mean is rescued by averaging; a prediction for one person has nothing to average. Predicting an individual requires knowing the shape of the population. Or does it?

Sometimes the shape problem has a simple cure. The World's incomes are roughly log-normal, so take logs, build the normal prediction interval there, and exponentiate the ends. On the raw scale, about ninety-four percent; on the log scale, ninety-five point one, right back at the promise. Unlike a confidence interval for a mean, a prediction interval transforms exactly: the new income is between e to the a and e to the b exactly when its log is between a and b. And the back-transformed interval is lopsided, long on the high side, just like incomes.

It doesn't, and the argument is one of the prettiest in statistics, due to Samuel Wilks in 1941. Nineteen observations cut the line into twenty gaps. Add a new observation from the same distribution. Among the twenty draws, the new one is equally likely to have any rank, so before observing the spacings, its rank is uniform over those twenty gaps. Conditional on the observed data, gap probabilities generally differ. It falls between the smallest and the largest of the first nineteen unless it lands in one of the two end gaps: probability eighteen in twenty, ninety percent, for every continuous distribution. On the World's incomes, simulated: eighty-nine point six. This symmetry argument, exchangeability of the new point with the old ones, is the seed of conformal prediction, Part 34.

A third kind of interval makes a third kind of promise. A tolerance interval is one that, with confidence gamma, contains at least a proportion P of the whole population. It's the engineer's interval: ninety-five percent confident that ninety-nine percent of the bolts are within these limits. So there are three distinct promises: about a parameter, a confidence interval; about one future observation, a prediction interval; about most of the population, a tolerance interval. Confusing them is among the most common errors in applied work. Wilks' order statistics give distribution-free tolerance limits as well.

What it does: CI vs PI for the next man; the PI pivot; skewed incomes; the log scale; Wilks (1941); tolerance intervals.; Numbers: 49.8% vs 95.1%; incomes 93.7%, log scale ≈ 95%; order statistics 89.6% vs 90%

10Credible vs confidencePhD5 min

The interpretation that chapter one forbade has a home: Bayesian inference. Give the parameter a prior distribution, and Bayes' rule turns the likelihood into a posterior distribution for p given the data. With Jeffreys' prior, the posterior for a proportion is a beta distribution, and its middle ninety-five percent gives an equal-tailed credible interval. Chapter four's recommended Jeffreys interval modifies the endpoints at zero and all successes; those modified boundary intervals are not exactly equal-tailed posterior intervals. For that interval, the statement there's a ninety-five percent probability that p lies in it is correct, as a statement about the posterior. Part 15 builds this properly. The question here is how the two kinds of interval relate.

Judge Bayesian intervals by Neyman's standard: fix the true p and ask how often the ninety-five percent credible interval contains it. The Jeffreys interval: ninety-five point oh percent on average over the displayed grid. With a flat prior instead, ninety-five point two. On average they behave like good confidence intervals, and for large samples the two theories agree almost exactly: under regularity, identifiability and a suitable positive prior, the Bernstein–von Mises theorem of Part 53 says the posterior becomes the same normal curve that Part 9's asymptotics give the estimator. At the edges, though, the prior matters. At p equals point zero one, the flat-prior interval covers ninety-one percent of the time, Jeffreys' ninety-nine.

A Bayesian interval has the same freedom as a pivot interval. After two successes in thirty, the Jeffreys posterior is skewed. Its equal-tailed ninety-five percent interval cuts two and a half percent from each tail. The highest posterior density interval instead collects the most probable values first; it's the shortest set with ninety-five percent probability, and here it starts much closer to zero. But it isn't invariant: on the log-odds scale the highest-density set is a different set of p's. Equal tails are invariant, which is one reason Brown, Cai and DasGupta used them.

But the two ideas can part company sharply, and Bernard Welch gave the classic example in 1939. Take two draws from a uniform distribution of width one, centred on an unknown theta. The interval between them contains theta exactly when the two draws fall on opposite sides of it, which happens half the time. So it's a fifty percent confidence interval. Now suppose the two draws are more than a half apart. Each is within a half of theta, so theta must be between them. In this case we know, with certainty, that this fifty percent interval is right. And conditional on their range being less than a half, the interval is right one third of the time. This averages over that subset, rather than giving a probability for a particular observed pair. The confidence level is the same, fifty percent, in both cases.

The simulation confirms it. Overall, the interval covers theta half the time. A quarter of the time the draws are at least a half apart, and then it covers every time. Three quarters of the time they're closer, and then it covers a third of the time. A quarter times one plus three quarters times a third is a half. The fifty percent average hides two completely different situations, and once you've seen the data, you know which one you're in. Reporting fifty percent confidence for an interval you know is right seems perverse. This is the conditionality principle: inference should be judged by the situation you're actually in, an idea Fisher called relevant subsets, which Part 46 develops.

Confidence is a property of a procedure: it holds for every value of the parameter, needs no prior, but can ignore what a particular sample reveals. Credibility is a property of a particular interval given the data: it conditions on everything observed, but it needs a prior, and its probability statement holds on average over that prior. In regular problems with plenty of data they agree, and the Coverage Board judges both kinds by the same frequentist test, as Part 26 does for hierarchical models.

What it does: The Jeffreys posterior; frequentist coverage of credible intervals; HPD vs equal tails; Welch (1939); the moral.; Numbers: unmodified equal-tailed Jeffreys posterior: grid mean 95.0%, flat 95.2%; at p = 0.01: 98.6% vs 91.1%; Welch 0.5 = 0.25 × 1 + 0.75 × ⅓

11The Coverage Board, formallyPractice4 min

Since Part 8, every promise in the series has gone through the same check. Here it is, formally, using Part 7's ADEMP framework for simulation studies. The aim: does this method keep its promise in this setting? The data: drawn from the World, the synthetic population whose truth we know exactly, or from a model we state. The estimand: the exact population value. The method: computed exactly as a user would, with no peeking at the truth. And the performance measure: the coverage, or for a test the false-alarm rate, over a fixed number of seeded replications, reported with its Monte Carlo standard error, alongside the mean width.

The achieved coverage is the fraction of replications in which the interval caught the truth. It's a proportion, so its Monte Carlo standard error, evaluated at the nominal level, is root point nine five times point zero five over R: with ten thousand replications, a fifth of a percentage point. The verdict: kept if within three Monte Carlo standard errors of the promise; broken if further below; conservative if further above. With three standard errors, a method whose coverage equals the nominal level is falsely called broken about once in seven hundred rows.

How many replications does a row need? Choose the precision first. The Monte Carlo standard error is root point nine five times point zero five over R, so R is that product over the squared standard error you want. With ten thousand, the standard error is a fifth of a point, and the three-standard-error cutoff is about point six five percentage points. A true coverage just below that cutoff can still escape detection; resolution is not guaranteed power. That's the resolution of every verdict on it. And every row uses fixed, published seeds, so anyone can regenerate the board exactly with one command.

Here's the board with Part 11's rows, a proportion of five percent and fifty trials, the kind of rare-event setting where it matters. Wald: ninety-one point four. Broken. Wilson: ninety-six point one, conservative at this particular p. Agresti–Coull, also ninety-six point one, conservative. Clopper–Pearson: ninety-eight point six. Conservative, as designed. And Jeffreys, eighty-seven point eight: broken, because p equals point zero five happens to sit in one of its dips near the edge. A single row is a spot check at one point of a sawtooth; the coverage curves of chapter four give the whole picture. Then the prediction interval for a new man's height: ninety-five point oh. Kept. And for a new income: ninety-three point nine. Broken, because the pivot needed normal data.

Four parts in, the board has a pattern. Exact theory keeps exact promises: z and t in their normal models, and permutation tests under exchangeability. Welch's t approximation is not exact under unequal variances. Plugging in an estimate without paying for its uncertainty breaks them: Wald, and z with s. Assumptions about shape break them in the tails, as skewed incomes did to t, to F and to prediction. And habits break them, like peeking. Every part from here on adds rows, and Part 65 reads the whole board.

What it does: ADEMP; the Monte Carlo SE and verdict rule; choosing R; Part 11's rows; four lessons.; Numbers: SE 0.22% at R = 10,000

Recap, problems, and the road aheadAll tracks3 min

Part eleven in thirteen lines. The textbook interval for a proportion fails in a sawtooth, ninety-four and a half percent at one sample size, seventy-nine at the next. Neyman's promise is coverage of at least one minus alpha for every parameter value, and the ninety-five percent belongs to the procedure, not to the interval in hand. Pivots give exact intervals; inverting tests gives confidence sets for almost anything, through Neyman's belt. For proportions, use Wilson, Agresti–Coull, Clopper–Pearson or Jeffreys; likelihood intervals follow the likelihood's shape, and after zero events the rule of three applies. Discrete data force a choice between a guarantee and an average. Fieller's ratio sets can be the whole line, and must be. Several promises at once need Bonferroni, Scheffé or the DKW band. Prediction is not confidence. Credible and confidence intervals agree under regular large-sample conditions and part company in Welch's example. And the Coverage Board's protocol is now written down.

Where it comes back. Inverted tests give the intervals of regression in Part 12 and of generalized linear models in Part 14. Profile likelihood intervals return in Part 22, bootstrap intervals in Part 16, and simultaneous bands for regression lines and curves in Parts 12 and 29. Wilks' order statistics grow into conformal prediction in Part 34; credible intervals into Bayesian data analysis; and Fieller's unbounded sets into the weak-instrument problem of Part 37.

Six problems, with full solutions in the README. Wilson after zero successes; the exponential pivot; the rule of three; confidence versus prediction; a Fieller set; and the arithmetic of Welch's example. Pause here if you want to try them.

The books and papers this part follows: Casella and Berger, Lehmann and Romano, Agresti on categorical data, Hahn and Meeker's Statistical Intervals, and Wasserman, with the papers from Wilson in 1927 to Brown, Cai and DasGupta in 2001.

Eleven parts of sixty-five, and the start of Stage II: methods. We can estimate, test and give honest intervals for one quantity at a time. But most questions are about relationships: how one variable changes with another. In 1801 a new planet, Ceres, was lost behind the sun, and the young Gauss found it again with a method he had invented for fitting orbits to noisy observations. Part 12: least squares.

Where it goes next. Inverted tests give the intervals of regression (Part 12) and of GLMs (Part 14); profile likelihood returns in Part 22, bootstrap intervals in Part 16, Wilks's order statistics as conformal prediction in Part 34, credible intervals in Part 15, and Fieller's unbounded sets as the weak-instrument problem of Part 37. Every later part adds rows to the Coverage Board.

Key results

The part's results in one place, for revision.

Neyman's promise\(\displaystyle P_\theta\bigl(\theta\in C(X)\bigr)\ \ge\ 1-\alpha\quad\allowbreak \text{for }\allowbreak \text{every }\theta\)
Duality\(\displaystyle C(x)=\{\theta_0:\ x\in A(\theta_0)\},\qquad\allowbreak A(\theta_0)\text{ the }\allowbreak \text{acceptance }\allowbreak \text{region }\allowbreak \text{of }\allowbreak \text{a }\allowbreak \text{level-}\alpha\text{ test }\allowbreak \text{of }\theta=\theta_0\)
Wilson's interval\(\displaystyle \frac{\hat p+\frac{z^2}{2n}}{1+\frac{z^2}{n}}\ \pm\ \frac{z}{1+\frac{z^2}{n}}\sqrt{\frac{\hat p(1-\hat p)}{n}+\frac{z^2}{4n^2}}\)
Fieller's set\(\displaystyle \bigl\{\rho:\ (\bar y-\rho\bar x)^2\le z^2\,(v_y-2\rho\,c_{xy}+\rho^2 v_x)\bigr\},\qquad\allowbreak \text{bounded }\allowbreak \text{iff } g=\frac{z^2 v_x}{\bar x^2}<1\)
Prediction interval\(\displaystyle \bar x\ \pm\ t_{n-1,\,1-\alpha/2}\; s\,\sqrt{1+\tfrac{1}{n}}\)
DKW band\(\displaystyle P\Bigl(\sup_t\bigl|\hat F_n(t)-F(t)\bigr|>\varepsilon\Bigr)\le 2e^{-2n\varepsilon^2}\)

Try it

Lab 11 · The sawtooth: exact coverage of intervals for a proportion

Sum the binomial probabilities of the outcomes whose interval contains the true p, for three intervals, and confirm one point of each curve by drawing ten thousand samples.

Figure produced by Lab 11: The sawtooth: exact coverage of intervals for a proportion
Produced by the lab below, seed 0, in 0.8 s.
python -m videos.stats.labs 11 needs numpy, scipy, matplotlib · download lab11.py · source on GitHub
Wald, p = 0.005: n = 591, n = 592  94.5%, 79.2%   (the film: 94.5%, 79.2%)
Wald, n = 50, p = 0.05             exact 91.99%   simulated 91.86%   grid mean 90.7%   grid minimum 22.2%
Wilson, n = 50, p = 0.05           exact 96.22%   simulated 96.16%   grid mean 95.2%   grid minimum 91.1%
Clopper-Pearson, n = 50, p = 0.05  exact 98.82%   simulated 98.75%   grid mean 96.9%   grid minimum 95.3%
Wald, p = 0.2, n = 10..100         from 81.5% to 95.4%   (the film: 81.5% to 95.4%)

Coverage is a sum over n + 1 outcomes, so it jumps whenever p crosses an interval's end: Wald breaks the promise, Wilson keeps it on average, Clopper-Pearson keeps it everywhere and pays in width.
The code (64 lines; it asserts its own result)
"""Lab 11: compute the exact coverage of the Wald, Wilson and Clopper-Pearson intervals, and check it by simulation."""

import numpy as np

from videos.coursekit import labs
from explainer.stats.kit import intervals as iv

TITLE = "The sawtooth: exact coverage of intervals for a proportion"
GOAL = ("Sum the binomial probabilities of the outcomes whose interval contains the true p, for three intervals, "
        "and confirm one point of each curve by drawing ten thousand samples.")
TASKS = [
    "Add iv.jeffreys and iv.agresti_coull to the curves at n = 50. Which of them dips below 93%, and where?",
    "Set alpha = 0.01. Does the Wald interval's shortfall at p = 0.05 grow or shrink?",
    "Find the smallest n at which the Wald interval's exact coverage at p = 0.1 stays above 94% for every larger n up to 2,000.",
]


def run(seed=0):
    rng = np.random.default_rng(seed)
    lab = labs.Lab()
    methods = (("Wald", iv.wald, labs.RED), ("Wilson", iv.wilson, labs.BLUE), ("Clopper-Pearson", iv.clopper_pearson, labs.GREEN))

    # Brown, Cai and DasGupta's example: one more observation
    c591, c592 = float(iv.binom_coverage(iv.wald, 591, 0.005)[0]), float(iv.binom_coverage(iv.wald, 592, 0.005)[0])
    lab.row("Wald, p = 0.005: n = 591, n = 592", f"{c591:.1%}, {c592:.1%}   (the film: 94.5%, 79.2%)")
    assert abs(c591 - 0.945) < 0.001 and abs(c592 - 0.792) < 0.001, "the 591/592 example"

    # coverage against p at n = 50, exactly, and at one p by simulation
    n, p0, reps = 50, 0.05, 10_000
    ps = np.linspace(0.005, 0.995, 397)
    curves = {name: iv.binom_coverage(f, n, ps) for name, f, _ in methods}
    x = rng.binomial(n, p0, reps)
    for name, f, _ in methods:
        table = np.array([f(k, n) for k in range(n + 1)])
        sim = float(np.mean((table[x, 0] <= p0) & (p0 <= table[x, 1])))
        exact = float(iv.binom_coverage(f, n, p0)[0])
        se = np.sqrt(exact * (1 - exact) / reps)
        lab.row(f"{name}, n = 50, p = 0.05", f"exact {exact:.2%}   simulated {sim:.2%}   "
                                             f"grid mean {curves[name].mean():.1%}   grid minimum {curves[name].min():.1%}")
        assert abs(sim - exact) < 4 * se + 1e-9, f"{name}: the simulation agrees with the exact sum"
    assert curves["Clopper-Pearson"].min() >= 0.95, "Clopper-Pearson keeps Neyman's promise at every p"
    assert curves["Wald"].mean() < 0.92 and curves["Wald"].min() < 0.5, "Wald is far below 95% near 0 and 1"
    assert abs(curves["Wilson"].mean() - 0.95) < 0.01 and curves["Wilson"].min() < 0.95, "Wilson: 95% on average, not everywhere"

    # coverage against n at p = 0.2
    ns = np.arange(10, 101)
    saw = {name: np.array([iv.binom_coverage(f, int(m), 0.2)[0] for m in ns]) for name, f, _ in methods}
    lab.row("Wald, p = 0.2, n = 10..100", f"from {saw['Wald'].min():.1%} to {saw['Wald'].max():.1%}   (the film: 81.5% to 95.4%)")
    assert abs(saw["Wald"].min() - 0.815) < 0.001 and abs(saw["Wald"].max() - 0.954) < 0.001
    assert np.sum(np.diff(saw["Wald"]) < -0.01) >= 5, "coverage does not rise steadily with n: it has teeth"
    lab.note = ("Coverage is a sum over n + 1 outcomes, so it jumps whenever p crosses an interval's end: Wald breaks "
                "the promise, Wilson keeps it on average, Clopper-Pearson keeps it everywhere and pays in width.")

    fig, ax = labs.figure(2, size=(11, 4.2))
    for name, _, color in methods:
        ax[0].plot(ps, curves[name], color=color, lw=1.1, label=name)
        ax[1].plot(ns, saw[name], color=color, lw=1.3, marker="o", ms=2.5, label=name)
    for a in ax:
        a.axhline(0.95, color=labs.MUTED, ls="--", lw=1)
    ax[0].set(title="Exact coverage against p, n = 50", xlabel="true proportion p", ylabel="coverage", ylim=(0.8, 1.003))
    ax[1].set(title="Exact coverage against n, p = 0.2", xlabel="sample size n", ylim=(0.8, 1.003))
    ax[0].legend(loc="lower center")
    lab.fig = fig
    return lab

Now change it

  1. Add iv.jeffreys and iv.agresti_coull to the curves at n = 50. Which of them dips below 93%, and where?
  2. Set alpha = 0.01. Does the Wald interval's shortfall at p = 0.05 grow or shrink?
  3. Find the smallest n at which the Wald interval's exact coverage at p = 0.1 stays above 94% for every larger n up to 2,000.

Problems, with solutions

Try each problem before opening its solution.

1. Wilson after zero successes. Find the 95% Wilson interval for 0 successes in 20 trials, and compare it with Wald's.

Solution

With p̂ = 0 and z = 1.96, the centre is (z²/2)/(n + z²) = 1.921/23.84 = 0.0806. The half-width is z√(z²/(4n²))/(1 + z²/n) = 0.0806. So the interval is [0, 0.161]. The Wald interval is [0, 0]: it claims certainty from twenty observations.

2. The exponential pivot. Show that \(\lambda\sum X_i \sim \mathrm{Gamma}(n, 1)\) for exponential data, and give the 95% interval for \(\lambda\) when \(n = 5\), \(\sum x_i = 10\).

Solution

λXᵢ ~ Exp(1), and a sum of n independent Exp(1) variables is Gamma(n, 1), whatever λ is. So P(G₀.₀₂₅ ≤ λΣXᵢ ≤ G₀.₉₇₅) = 0.95 and λ ∈ [G₀.₀₂₅/Σxᵢ, G₀.₉₇₅/Σxᵢ]. With n = 5 the quantiles are 1.623 and 10.242. For Σxᵢ = 10 the interval is [0.162, 1.024].

3. Zero events in 200. No adverse events in 200 patients: give the one-sided 95% upper limit exactly, and by the rule of three.

Solution

The exact upper limit solves (1 − p)²⁰⁰ = 0.05, giving p = 1 − 0.05^(1/200) = 0.01487. The rule of three gives 3/200 = 0.015.

4. Confidence vs prediction. Ten men: \(\bar x = 176\), \(s = 7\). Give the 95% confidence interval for \(\mu\) and the 95% prediction interval for the next man.

Solution

t₉,₀.₉₇₅ = 2.262.

  • CI: 176 ± 2.262 · 7/√10 = 176 ± 5.0 = [171.0, 181.0].
  • PI: 176 ± 2.262 · 7 · √1.1 = 176 ± 16.6 = [159.4, 192.6].

5. Fieller. \(\bar x = 4\), \(\bar y = 8\), independent, each with SE 1: find Fieller's 95% set for \(\mu_y/\mu_x\), and the delta-method interval.

Solution

(ȳ − ρx̄)² ≤ z²(1 + ρ²) gives (16 − 3.84)ρ² − 64ρ + (64 − 3.84) ≤ 0. The roots are (64 ± √(4096 − 4 · 12.16 · 60.16))/24.32, so ρ ∈ [1.225, 4.039]. The set is bounded because g = 3.84/16 = 0.24 < 1. The delta method gives 2 ± 1.96 · √(1 + 4)/4 = [0.904, 3.096], which is symmetric and too far left.

6. Welch's example. Welch's example: for \(X_1, X_2 \sim U(\theta - \tfrac12, \theta + \tfrac12)\), show \(P(|X_1 - X_2| \ge \tfrac12) = \tfrac14\), and that the coverage given \(|X_1 - X_2| < \tfrac12\) is \(\tfrac13\).

Solution

Take θ = 0. D = X₁ − X₂ has the triangular density 1 − |d| on [−1, 1], so P(|D| ≥ ½) = 2∫_{½}^{1}(1 − d) dd = ¼.

  • If |D| ≥ ½, both draws are within ½ of θ and more than ½ apart, so θ lies between them: the interval certainly covers.
  • The unconditional coverage is P(X₁ < θ < X₂ or X₂ < θ < X₁) = ½. Then ½ = ¼ · 1 + ¾ · c, so c = ⅓.

Notes and sources

Where it comes back

Idea Returns in
intervals by inverting tests 12, 14, 46
likelihood and profile intervals 14, 22
bootstrap intervals 16, 47
simultaneous bands 12, 29, 48
prediction, conformal 19, 34, 57
credible intervals 15, 26, 53
Fieller, weak identification 37, 46
the Coverage Board every part; 65

Sources

  • Foundations. J. Neyman, Phil. Trans. A 236 (1937); R. A. Fisher, Proc. Camb. Phil. Soc. 26 (1930).
  • Proportions.
    • E. B. Wilson, JASA 22 (1927).
    • C. Clopper & E. S. Pearson, Biometrika 26 (1934).
    • A. Agresti & B. Coull, Am. Stat. 52 (1998).
    • L. Brown, T. Cai & A. DasGupta, Stat. Sci. 16 (2001).
  • Counts and discreteness.
    • F. Garwood, Biometrika 28 (1936).
    • W. Stevens, Biometrika 37 (1950).
    • H. Lancaster, JASA 56 (1961).
    • W. Thompson, Ann. Math. Stat. 7 (1936).
    • J. Hanley & A. Lippman-Hand, JAMA 249 (1983).
  • Ratios. E. Fieller, JRSS B 16 (1954); L. Gleser & J. T. Hwang, Ann. Stat. 15 (1987).
  • Simultaneous and prediction.
    • H. Scheffé, Biometrika 40 (1953).
    • A. Dvoretzky, J. Kiefer & J. Wolfowitz, Ann. Math. Stat. 27 (1956); P. Massart, Ann. Prob. 18 (1990).
    • S. Wilks, Ann. Math. Stat. 12 (1941).
  • Credible vs confidence. B. L. Welch, Ann. Math. Stat. 10 (1939).
  • Simulation protocol. T. Morris, I. White & M. Crowther, Stat. Med. 38 (2019).
  • Textbooks.
    • G. Casella & R. Berger, Statistical Inference (2nd ed., 2002), ch. 9.
    • E. Lehmann & J. Romano, Testing Statistical Hypotheses (4th ed., 2022).
    • A. Agresti, Categorical Data Analysis (3rd ed., 2013).
    • G. Hahn & W. Meeker, Statistical Intervals (2nd ed., 2017).
About this partfrom its README

Part 11 of a sixty-five-part course in statistics, from a first course to a PhD (see the series plan and the syllabus), and the first part of Stage II, Bachelor's: Methods. Part 10 asked whether an effect is real. This part asks how big it is, and what "95% confident" promises.

It opens with the textbook (Wald) interval for a proportion. Its exact coverage zigzags below 95% as n grows. At p = 0.005 it covers 94.5% with n = 591 and 79.2% with n = 592 (Brown, Cai & DasGupta 2001). From there the part covers:

  • Neyman's definition, and the interval rain;
  • pivots, including the continuous IID approximation to the tank problem's [214, 353], and shortest vs equal-tailed intervals;
  • Neyman's belt and the test–interval duality;
  • the binomial family, with exact coverage curves;
  • likelihood intervals and the rule of three;
  • discreteness, mid-p, Garwood's Poisson interval and the order-statistic median interval;
  • Fieller's ratio sets, which can be the whole line (and must be, by Gleser & Hwang);
  • simultaneous intervals (Bonferroni, Scheffé, the DKW band);
  • prediction and tolerance intervals, with Wilks' order statistics;
  • credible vs confidence intervals, with Welch's 1939 paradox;
  • the Coverage Board's protocol, stated formally.

Exact pivot claims require the stated IID model: normal samples for t, chi-squared and F (independent samples for F), exponential waiting times for the rate, and jointly normal means with known covariance for the displayed z-Fieller sets. The World's height intervals are model approximations. Wilson, Agresti–Coull, Jeffreys and Wilks likelihood intervals have approximate nominal coverage, not a uniform 95% guarantee. Means and minima of coverage curves refer to the displayed parameter grid, not a confidence coefficient over the whole parameter space.

The DKW simulation checks the exact sup distance between the sample and finite-World CDFs over all jump points and both limits. The pointwise comparison checks 200 nominal Wald intervals; those also fail marginally in the tails, so the comparison does not isolate multiplicity. The credible-interval comparison uses the unmodified equal-tailed Jeffreys posterior, distinct from the boundary-modified interval recommended for frequentist coverage. The rule of three is a one-sided 95% bound; the two-sided Poisson zero-event bound is 3.69.

Every number on screen is computed in compute.py or inline in a scene:

  • Binomial and Poisson coverages are exact sums over the outcomes.
  • Heights, incomes and the screening condition come from the World (seed 1662).
  • Everything else is a seeded simulation.

Built in this part:

  • statkit.intervals (explainer/stats/kit/intervals.py): Wald, Wilson, Agresti–Coull, Clopper–Pearson, Jeffreys and likelihood-ratio intervals for a proportion; binom_coverage and binom_width (exact); the t, variance and rate pivots; Fieller; the DKW band; prediction intervals; Wilks' order-statistic coverage. It is tested in tests/test_stats_kit_intervals.py (against SciPy, and coverage against simulation).
  • IntervalRain (in explainer/stats/viz.py): intervals falling against the truth, with a running tally.

The Coverage Board gains seven rows, all simulated (R = 10,000 draws, seed 11000; the exact sums at p = 0.05, n = 50 are 91.99% for Wald and 88.53% for Jeffreys, each about two Monte Carlo SEs above its simulated row):

Method Setting Achieved Verdict
Wald proportion 0.05, n = 50 91.41% broken
Wilson proportion 0.05, n = 50 96.05% conservative
Agresti–Coull proportion 0.05, n = 50 96.05% conservative
Clopper–Pearson proportion 0.05, n = 50 98.58% conservative
Jeffreys proportion 0.05, n = 50 87.78% broken (p = 0.05 falls in one of its dips)
t prediction interval a new man's height, n = 10 95.03% kept
t prediction interval a new income, n = 19 93.89% broken
Chapter notes
# Chapter What it does Numbers
0 The sawtooth The Wald formula; exact coverage against n at p = 0.2 and against p at n = 50; BCD (2001); objectives. 81.5–95.4% at p = 0.2; 591 vs 592: 94.5% vs 79.2%; mean over the displayed p grid 90.7%
1 Neyman's promise Neyman (1937); the definition; the interval rain on the World's men; what 95% does not mean; one-sided bounds; levels and widths; planning a poll. 93 of 100; 94.9% of 10,000; mean width 9.9 cm; n = 1,068 after rounding up for ±3%
2 Pivots The recipe; five pivots and their checks; equal tails vs shortest; the tanks; the asymptotic pivot and its failures. rate 95.4%, F 94.9%; tanks [214, 353]; shortest σ² interval 16% shorter
3 Inverting tests The duality theorem; Neyman's belt at n = 20; Clopper–Pearson from it; Wald's pinched belt; the p-value function; which test gives which interval. x = 7: [0.154, 0.592] (Wald [0.141, 0.559])
4 The binomial family Wilson, Clopper–Pearson, Agresti–Coull, Jeffreys; Wilson's derivation; six exact coverage curves; sawtooths against n; widths; the World's rare condition; advice. grid means 90.7 / 95.2 / 95.8 / 96.9 / 95.0 / 94.8%; 4 of 300
5 Likelihood intervals Six intervals for 2 of 30; the skewed likelihood; invariance and log-odds; agreement at large n (horse kicks); the rule of three. LR [0.011, 0.192]; 3/n vs 1 − 0.05^(1/n)
6 Discreteness Why coverage jumps; exact 95% coverage at every p is impossible without randomization; mid-p; Garwood's Poisson interval; the order-statistic median interval; guaranteed versus approximate nominal coverage. CP grid mean 97.5%, mid-p 95.9% (n = 25); Garwood min 95.6%, Wald 85% on average; (X₍₆₎, X₍₁₅₎) 95.9%
7 Ratios: Fieller Where ratios arise; Fieller's quadratic; four cases (bounded, skewed, two rays, the whole line); the g index; Gleser & Hwang (1987). g = 0.04, 0.79, 1.33, 6.0
8 Simultaneous intervals 0.95ᵏ; Bonferroni; ten intervals simulated; Scheffé (1953); the DKW band on 100 heights; band vs pointwise. 60% vs 95%; ε = 0.136; whole-CDF band 95.85% vs 200 pointwise Wald intervals jointly 0.8%
9 Prediction and tolerance CI vs PI for the next man; the PI pivot; skewed incomes; the log scale; Wilks (1941); tolerance intervals. 49.8% vs 95.1%; incomes 93.7%, log scale ≈ 95%; order statistics 89.6% vs 90%
10 Credible vs confidence The Jeffreys posterior; frequentist coverage of credible intervals; HPD vs equal tails; Welch (1939); the moral. unmodified equal-tailed Jeffreys posterior: grid mean 95.0%, flat 95.2%; at p = 0.01: 98.6% vs 91.1%; Welch 0.5 = 0.25 × 1 + 0.75 × ⅓
11 The Coverage Board, formally ADEMP; the Monte Carlo SE and verdict rule; choosing R; Part 11's rows; four lessons. SE 0.22% at R = 10,000
12 Outro Recap, payoffs, problems, references, the Transcript. —

Companion material in this repository

The syllabus's plan for this partfrom SYLLABUS.md, the plan of record
  1. Hook. The Wald interval's exact coverage zigzagging below 95% as n changes (Brown, Cai & DasGupta 2001).
  2. Neyman (1937). P_θ(θ ∈ C(X)) ≥ 1 − α for all θ; IntervalRain.
  3. Pivots. Normal μ and σ², ratios of variances, exponential rates.
  4. Inverting tests. Neyman's belt (BeltConstruction); the duality.
  5. The binomial family. Wilson (1927) by inverting the score test; Agresti–Coull; Clopper–Pearson; Jeffreys; exact coverage curves.
  6. Likelihood intervals. Wald vs profile; log-odds; the rule of three.
  7. Discreteness. Exact coverage impossible; mid-p.
  8. Fieller (1940, 1954). Ratios: bounded, the whole line, or two rays (Part 46 proves this is unavoidable).
  9. Simultaneous intervals. Bonferroni; Scheffé (1953); the DKW band.
  10. Prediction and tolerance intervals. Wilks' (1941) order-statistic limits, the ancestor of conformal (Part 34).
  11. Credible vs confidence. Where they agree and where they part (Welch 1939).
  12. The Coverage Board, formally. The protocol of §3; rows from Parts 8–11.
  13. Outro.

Built: statkit.intervals; board.py in full.

Build the film

python -m videos.stats.stats11.compute        # the part's numbers, into .cache/stats11
python tools/build.py stats11                  # render and assemble the film
EXPLAINER_TTS=silent python tools/qa_scene.py stats11 Hook   # one chapter, silent, with a contact sheet

Scenes: videos/stats/stats11. Setup: see the course page. Source of these notes: the README and the scenes' narration.

Build it
python -m videos.stats.stats11.compute         # once (about a minute; cached in .cache/stats11)
python tools/build.py stats11 -q l             # fast 480p preview
python tools/build.py stats11                  # 1080p30 -> renders/stats11.mp4
python tools/qa_scene.py stats11 Binomial
python tools/lecture_length.py stats11 --floor 50