SStatistics, Built

Stage IV · PhD Core

Part 46 of 65

The Theory of Testing and Confidence

PhDstarts at this level57 min of film14 chaptersprerequisites: Part 10, Part 11, Part 45

When is a test optimal, and what can an interval honestly promise?

The part opens with the Behrens-Fisher problem: two normal samples with unequal, unknown variances. Fisher's fiducial test, Neyman's objection, Welch's approximation and Linnik's negative results frame the question of whether a test of exact size exists, and a simulation shows the pooled t test rejecting a true null 30% of the time. The Neyman-Pearson theory is then built in full: the lemma with randomization, Karlin-Rubin for monotone likelihood ratios, and unbiased tests by Neyman structure, drawn slice by slice so that each value of the nuisance statistic spends exactly alpha. Invariance proves the t test optimal, and the likelihood ratio test is taken to a boundary, where Chernoff's mixture replaces Wilks. The part turns to confidence sets: inversion gives the Clopper-Pearson belt, Gleser and Hwang show that a ratio needs unbounded sets (Fieller covers 95% where the delta method covers 78%), and Feldman and Cousins repair limits for a bounded parameter. It ends with closed testing, recognizable subsets, the Berger-Sellke bounds on what a p-value of 0.05 can mean, and the Kolmogorov-Smirnov test with estimated parameters.

What you need. Part 45's decision theory (risk sets, sufficiency, completeness) and exponential families; the tests and intervals of Parts 10 and 11.

Hook
the Behrens–Fisher problem
Mathematics
Neyman–Pearson in general, MLR, UMPU via Neyman structure, invariance and Hunt–Stein, Wilks and Chernoff's boundary, optimal confidence sets, Gleser–Hwang, closed testing, conditional inference
Built
a Neyman-structure visualizer

What you will be able to do

Bachelor's

  • Explain the Behrens-Fisher problem and why the pooled t test fails when the small sample has the large variance.
  • Say what a test's size and power are, and why a discrete test needs randomization to spend exactly alpha.

Master's

  • Construct the randomized most powerful test for a binomial and show it is UMP one-sided by monotone likelihood ratio.
  • Invert a family of tests into a confidence set and compute its exact coverage.
  • Apply closed testing with Bonferroni and with Simes local tests to a set of p-values.

PhD

  • Prove the Neyman-Pearson lemma with its necessity part, and Karlin-Rubin.
  • Prove that similar tests have Neyman structure when the nuisance statistic is boundedly complete, and derive the UMPU two-sided test from its two side conditions.
  • State the Gleser-Hwang theorem and Chernoff's boundary limit, with the conditions each needs.

Practice

  • Report a ratio (an LD50, an instrumental-variable estimate) with Fieller's set, and say what an unbounded set means.
  • Use Welch's test by default for two means, and Feldman-Cousins rather than flip-flopping for a signal above a known background.
  • Translate a p-value into a bound on the posterior probability of the null before calling it evidence.

Contents

Each chapter has a home level. Choose a track to see what to read and watch: Bachelor's 7 min · Master's 19 min · PhD 57 min · Practice 19 min.

  1. 0The Behrens-Fisher problemBachelor's5 min
  2. 1The Neyman-Pearson lemma in generalPhD4 min
  3. 2Monotone likelihood ratio and Karlin-RubinPhD4 min
  4. 3Unbiased tests and Neyman structurePhD6 min
  5. 4InvariancePhD4 min
  6. 5The likelihood ratio testPhD4 min
  7. 6Confidence sets by inversionPhD4 min
  8. 7Impossibility: Fieller and Gleser-HwangPhD5 min
  9. 8Bounded parameters: Feldman-CousinsPractice4 min
  10. 9Simultaneous inferencePractice4 min
  11. 10Conditional inferencePhD3 min
  12. 11p-values and evidencePractice5 min
  13. 12Goodness of fit, rigorouslyPhD4 min
  14. Recap, problems, and the road aheadAll tracks2 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. A dashed box stands for a number the film computes when it is rendered (hover over it to see what is computed); the README's figures for each chapter, where it lists them, follow the chapter's text.

The Behrens-Fisher problemBachelor's5 min

The oldest open sore in testing. Two normal samples, with variances that are unequal and unknown: are their means equal? Walter Behrens proposed a test in 1929, and in 1935 Fisher derived it again from his fiducial argument. Neyman and Maurice Bartlett objected: the test's chance of a false rejection is not exactly alpha for every ratio of the two variances, so it does not have exact frequentist size alpha. Fisher replied that it did not need to be. Bernard Welch's approximation, with estimated degrees of freedom, became the practical answer. In the 1960s Yuri Linnik established impossibility results for classical Behrens–Fisher rejection regions under additional shape and regularity restrictions. These do not rule out every exact randomized test. This part is the theory behind that quarrel: what an optimal test is, and what an interval can promise.

Here is what is at stake, by simulation, at a nominal five percent. With equal sizes and equal variances, the pooled and Welch tests are near five percent, while the fiducial test is conservative in this experiment. With equal sizes and unequal variances, the pooled t test drifts a little. But give the small sample the large variance, and the pooled test rejects a true null thirty percent of the time; swap them, and it almost never rejects. Welch's test stays near five percent throughout; the fiducial test is often conservative and is also close to five percent in the most unbalanced noisy-small-sample setting. Sampling noise is visible at twenty thousand replications. Neither is exact: their sizes move with the unknown ratio of the variances.

Fisher's statistic divides the difference in means by the natural standard error. Fiducially, he treated it as a weighted difference of two independent t variables, weighted by an angle phi that measures how much of the standard error comes from each sample. The critical value then depends on phi: with five and twenty-five observations it runs from the t quantile with twenty-four degrees of freedom to the one with four. With ten each, the curve is symmetric and dips in the middle. For this particular fiducial rejection rule, its null probability depends on the true variance ratio. A data-dependent critical value alone does not establish a failure of exactness.

Real data rarely make the choice matter as much as the simulation. Old Faithful's eruptions: those followed by a recorded wait of under seventy minutes last minutes on average, those followed by longer waits minutes. Welch's statistic is about on estimated degrees of freedom, and the pooled test agrees: with hundreds of eruptions and similar spreads, there is no contest. The long-wait group has eruptions about two minutes longer. This is a descriptive association; the usual Welch interval additionally assumes independent normal samples, which a time-ordered geyser series need not provide. The Behrens–Fisher problem bites with small, unbalanced samples, which is exactly where exactness is hardest.

The precise question is whether a similar test exists: one whose size is exactly alpha for every pair of variances. Linnik's negative results concern specified classes of nonrandomized rejection regions and their regularity, not every smooth test function. For example, rejecting with probability alpha independently of the data is smooth and exactly similar, but has no power advantage. Nontrivial exact constructions require attention to their own restrictions. Welch offers a practical approximation; the fiducial rule has its own frequentist size function; Bayesian analysis specifies priors. None of these labels alone supplies an exact similar test. This part builds the theory that tells us when exact, optimal tests exist, as for the t test, and what can and cannot be promised when they do not.

Two promises are due. Part ten built tests that keep their size, and judged them by that alone; chapters one to five ask which level-alpha test is most powerful, and prove that the t test is optimal among unbiased and invariant tests. Part eleven built intervals with good coverage; chapters six to ten construct optimal confidence sets, show that some problems need infinite intervals, and ask what coverage means for the data set in hand.

Numbers: pooled size 30% or 0.06%; Welch ≈ 5%; Old Faithful t = 39.5 on 196 df

1The Neyman-Pearson lemma in generalPhD4 min

The Neyman–Pearson lemma in general: the most powerful test, and why it exists. A test, in general, is a function phi giving the probability of rejecting at each data point: one for reject, zero for accept, and possibly something in between. Its size is its mean under the null, its power its mean under the alternative. For a simple null against a simple alternative, Neyman and Pearson's test rejects where the likelihood ratio f one over f nought exceeds a constant k, accepts where it falls below, and randomizes on the boundary. If its size is alpha, its power is at least that of any other test of size at most alpha. And for every alpha, k and gamma can be chosen to make the size exactly alpha.

The proof is one line. Where f one exceeds k f nought, phi star is one, so phi star minus phi is at least zero; where it falls short, phi star is zero and the difference is at most zero. Either way the product is non-negative. Integrate. The power of phi star minus that of phi is at least k times the difference in sizes, which is non-negative. If phi is also most powerful, the integral must be zero, so phi agrees with phi star almost everywhere, with respect to the dominating measure, where f one differs from k times f nought: the lemma's form is necessary as well as sufficient.

A discrete example. Twenty trials; the null says the success probability is point three, the alternative point five. The likelihood ratio increases with the number of successes, so the most powerful test rejects for large counts. To have size exactly five percent it rejects at or more, and at exactly it rejects with probability , a coin flip of its own. Without the randomization, the available sizes jump from percent to percent; five percent lies between them.

The power functions. In green, the randomized test: exactly five percent at point three, rising toward one. In blue, the slightly smaller non-randomized test, just below it everywhere. Notice that the test did not depend on the alternative's value, point five, only on its side: the same test is most powerful against every p above point three. So it is uniformly most powerful for the one-sided problem. When that happens, and why, is chapter two.

The general version allows several side conditions: maximize the power subject to m linear constraints on phi, not just the size. George Dantzig and Wald showed in 1951 that whenever suitable multipliers exist, a rule rejecting where f one exceeds a combination of the constraint functions is optimal if it satisfies the side conditions. With integrable objective and constraint functions and nonempty feasible constraints, the feasible set is weak-star closed inside the compact set of tests between zero and one. The continuous objective therefore attains its maximum. Multiplier representations require a further supporting-hyperplane condition. For discrete data it is literally a linear programme, the one Dantzig's simplex method solves, and the multipliers are its dual variables: Part twenty-one's dual, at work in testing. Chapter three uses it with two constraints.

Few statisticians would actually flip a coin to decide a test. Randomized tests are a device of the theory. They fill gaps in attainable size and allow exact level alpha at discrete boundaries. Nonrandomized binomial tests also have smooth power functions. In practice one reports a p-value, or Lancaster's mid-p value, which counts half the probability of the observed point but need not be super-uniform and can exceed nominal type-one error, or accepts a conservative size, as Fisher's exact test of chapter three does.

Numbers: Bin(20), p = .3 vs .5: reject x ≥ 10, and x = 9 w.p. 0.031; sizes 4.8% / 11.3% without

2Monotone likelihood ratio and Karlin-RubinPhD4 min

Monotone likelihood ratio and the Karlin–Rubin theorem: when one test is best against every alternative.

A family has a monotone likelihood ratio in a statistic T if, for any larger parameter against any smaller one, the likelihood ratio is a nondecreasing function of T. Larger T is always evidence for larger theta. One-parameter exponential families with an increasing natural parameter, have it automatically, since the ratio is the exponential of a positive multiple of T. Other examples include the uniform upper-endpoint model; noncentral t, chi-square and F families with fixed degrees of freedom and ordered noncentrality; and the fixed-margin noncentral hypergeometric family ordered by its odds ratio.

Two pictures. On the left, the binomial's log likelihood ratio for p equal to point five against point three: a straight line in the number of successes, increasing. On the right, the Cauchy location family, theta equal to one against zero. The ratio rises to a peak near x equal to and then falls back toward one. A gigantic observation is equally surprising under both values, so it is no evidence for either: this location likelihood ratio lacks the monotone ordering. Heavy tails alone are not a general impossibility theorem.

Samuel Karlin and Herman Rubin's theorem of 1956. Test theta at most theta nought against theta above it, in a family with a monotone likelihood ratio. Reject when T exceeds c, randomizing at c, with size alpha at theta nought. Against any single alternative above theta nought, this is a likelihood-ratio threshold, so by chapter one it is most powerful. Since it does not depend on which alternative, it is uniformly most powerful. And its power function is nondecreasing in theta, so its size over the whole composite null is attained at the boundary: the test is UMP for the one-sided problem.

Two-sided problems are different. Test p equal to point three against p different from it. Against larger p, the most powerful test rejects large counts: the teal power curve. Against smaller p, it rejects small counts: purple. A uniformly most powerful two-sided test would have to be both at once, and each of these has power below alpha on the side it ignores. So no UMP test exists. The way out, in chapter three, is to demand that the test be unbiased, never less likely to reject under an alternative than under the null.

The Cauchy family shows what happens without monotonicity. With one observation there is no uniformly most powerful test of theta equal to zero against positive theta. The locally most powerful test, which maximizes the slope of the power at zero, rejects when the score, two x over one plus x squared, is large. But the score peaks at x equal to one and falls to zero for large x. At a small level such as five percent the score cutoff is positive, so the test rejects on a bounded interval and accepts an observation of a thousand. Local optimality targets tiny shifts, not every possible alternative; for location families with heavy tails, chapter four's invariance and Part forty-seven's asymptotics give better guidance.

Numbers: Cauchy ratio peaks at x = 1.6 and returns to 1

3Unbiased tests and Neyman structurePhD6 min

A test is unbiased if it is never less likely to reject under an alternative than under the null: its power function is at most alpha on the null and at least alpha on the alternative. For a point null against a two-sided alternative, a smooth power function must then have a minimum at theta nought: value alpha, slope zero. In an exponential family differentiation with respect to the natural parameter makes the slope the covariance of T with the test. The conditions are size alpha and expected T times phi equal to alpha times expected T. A different smooth parameterization adds the derivative of the natural parameter. The generalized Neyman–Pearson lemma, with these two side conditions, gives the uniformly most powerful unbiased test: reject outside an interval, with its two endpoints and their randomizations solved for jointly.

The binomial again: p equal to point three against p different, at five percent. The UMPU test rejects below or above successes, randomizing at the two endpoints with probabilities and : the tails are not equal. The familiar equal-tailed test puts two and a half percent in each tail. Its power dips just below five percent, to percent, slightly to the left of point three: it is biased, by a hair. The UMPU curve has its minimum exactly at the null value. With skewed distributions the difference can be large.

Check it with chapter one's linear programme. Maximize the power against one alternative, subject to the two unbiasedness conditions. Against p equal to point one five, the programme's best power is , exactly the UMPU test's. Against point five, , again exactly. The same test solves the programme for every alternative on either side: that is what uniformly most powerful unbiased means.

Now add a nuisance parameter, and suppose that on the boundary of the null a statistic T is sufficient for it. A test is similar if its size is exactly alpha whatever the nuisance parameter is: the exact-size property that fails for the familiar Behrens–Fisher approximations. It has Neyman structure if its conditional size given T is alpha, slice by slice. Neyman structure implies similarity, by averaging over T. If T is also complete, the converse holds: the conditional size minus alpha is a function of T with mean zero for every lambda, hence zero. So similar tests are exactly the tests with conditional rejection probability equal to alpha within almost every slice, and the best of them is the best test in each slice.

Here is Neyman structure as a picture, the part's instrument. Two binomial samples, of and trials: is the first success probability larger? On the boundary of the one-sided null the probabilities are equal, to an unknown common value, the nuisance parameter, and the total number of successes is sufficient for it. Given the total, the first count is hypergeometric, whatever the common p. Here are its distributions for totals of four, nine and thirteen. In each slice, the test rejects the top five percent, randomizing at the edge: the red portions. Every slice spends exactly five percent, so the whole test has size five percent at every value of the nuisance parameter.

The unconditional size of that test, as a function of the common p: a flat line at five percent. It is similar, as promised. Fisher's exact test is the same test without the randomization at the slice edges. With samples this small, its size never exceeds about two percent, and it varies with p. The randomized version is the uniformly most powerful unbiased test for comparing two binomials; Fisher's is its conservative, practical cousin.

Two real tables. ISIS-2, the trial of aspirin after heart attacks: vascular deaths among patients on aspirin, among on placebo. Given the deaths in total, the null predicts about in the aspirin arm. The conditional, hypergeometric test gives a z of : a p-value of about one in ten million. And Fisher's lady tasting tea, eight cups with four of each kind: the same conditional test, in which identifying all four correctly has probability one in seventy.

For independent normal observations and at least two observations, Neyman structure also proves the t test optimal. Test a normal mean equal to zero with sigma unknown. On the null, the sum of squares is complete and sufficient for sigma. Given it, the data vector divided by its length is uniform on a sphere, whatever sigma is, so the conditional nuisance-free family can be tested within each sphere. Two-sided unbiasedness adds a zero first-moment constraint; the generalized lemma selects symmetric tails of the sum. And the sum over the root of the sum of squares is a monotone function of Student's t. So the two-sided t test is uniformly most powerful among unbiased tests: Part ten's workhorse, now with a theorem behind it, as Lehmann's Testing Statistical Hypotheses set out in 1959.

Numbers: UMPU: reject x < 2 or > 10 (γ = 0.69, 0.19); equal tails dip to 4.99%; ISIS-2 z = −5.22

4InvariancePhD4 min

Invariance: tests that respect the symmetry of the problem. Part forty-five's equivariance, for tests. A group of transformations, such as changes of units, acts on the data and the parameter and maps the null and the alternative to themselves. A test is invariant if it gives the same answer for transformed data. A maximal invariant is a statistic that is constant on each orbit of the group and different on different orbits: everything the symmetry leaves. Invariant tests are exactly the functions of the maximal invariant, and its distribution depends on theta only through the parameter's own maximal invariant. The problem shrinks, often to one dimension, where chapter two's theory may apply.

The t test again. Normal data, testing whether the mean is positive. Changing the units multiplies every observation by a positive constant and leaves the hypotheses alone. After reducing to the sufficient statistics, the maximal invariant is Student's t, whose distribution is the noncentral t with noncentrality root n mu over sigma. That family has a monotone likelihood ratio, so by Karlin and Rubin the one-sided t test is uniformly most powerful among scale-invariant tests. Unbiasedness and invariance arrive at the same answer.

Exact power curves for ten normal observations. In grey, the z test that knows sigma: no test that does not know sigma can beat it. In green, the t test, the best among tests invariant to the units. In purple, the sign test, also invariant, but throwing away the sizes of the observations. At a mean of half a standard deviation the powers are , and . The gap between grey and green is what ignorance of sigma costs; the gap below green is waste.

But why should a statistician restrict attention to invariant tests? Gilbert Hunt and Charles Stein answered in 1946, in a famous unpublished paper: if the group is amenable, meaning roughly that it admits averages that are themselves invariant, then, under the invariant decision problem's averaging and compactness conditions, symmetrization preserves level and cannot worsen the relevant worst-case power criterion. An invariant rule that optimizes that criterion can therefore be minimax among all tests. Nothing is lost in the worst case by respecting the symmetry. Translations, positive scalings, the one-dimensional positive affine group, and compact groups are amenable. A general multivariate affine group need not be. For dimension at least two the general linear group is not amenable, and Stein constructed a covariance testing problem in which the best invariant test is beaten by a non-invariant one: symmetry can be a trap.

The same idea settles Part twenty-three's general linear hypothesis. For a fixed full-rank design and independent spherical normal errors, test that a block of regression coefficients is zero, with positive error variance unknown. The relevant group includes shifts in the nuisance-column span, positive scalings, and rotations within the orthogonal tested-effect and residual subspaces. The maximal invariant is the F statistic, with a noncentral F distribution that has a monotone likelihood ratio in its noncentrality. So the F test is uniformly most powerful among invariant tests, as P. L. Hsu showed in 1941, and Wald showed it is most stringent: its largest shortfall from the best possible power is the smallest.

Numbers: power at μ/σ = 0.5: z 0.47, t 0.43, sign 0.34

5The likelihood ratio testPhD4 min

The likelihood ratio test: Wilks's theorem, and where it breaks. When no optimal test exists, the likelihood ratio test is the general-purpose answer: the best likelihood under the null over the best likelihood overall. Expanding the log-likelihood around the maximum, the drop from the unrestricted to the constrained maximum is half an information-weighted squared distance from the unrestricted estimate to the null tangent space. In a regular fixed-dimensional model with consistent maxima, nonsingular information, and a smooth null submanifold, projecting the normal estimation error onto the q constrained directions shows that minus twice the log ratio tends to a chi-square, with degrees of freedom equal to the number of constraints. That is Samuel Wilks's theorem of 1938. Every step used something: the true value must be interior, the model smooth and identifiable. Part forty-seven proves it properly; here we watch the conditions fail.

First, a case where everything holds. Ten Poisson counts, testing a rate of two. The simulated quantiles of minus twice the log ratio sit close to the chi-square with one degree of freedom. The nominal five percent test rejects percent of the time; this is a finite-sample, discrete distribution; Wilks supplies an asymptotic approximation rather than exact finite-sample size.

Now put the null value on the edge of the parameter space: a normal mean that cannot be negative, tested at zero. The maximum likelihood estimate is Z when Z is positive and zero otherwise, so minus twice the log ratio is the positive part of Z, squared. Under the null that is zero half the time and a chi-square with one degree of freedom the other half: Herman Chernoff's mixture of 1954. The correct five percent critical value is the ninetieth percentile of chi-square one, two point seven one, not three point eight four.

Simulated, the statistic is exactly zero in half the data sets. Using the chi-square critical value anyway gives a test of size percent: valid, but conservative, wasting power. The mixture's critical value gives exactly five percent in this normal example; its simulated estimate has Monte Carlo uncertainty. Steven Self and Kung-Yee Liang studied likelihood-ratio limits under several boundary configurations in 1987. Chi-bar-square mixtures arise in important regular cone problems, but boundary problems do not all have the same law. The everyday case is Part twenty-five's test that a variance component is zero, where a half-chi-square approximation applies only to suitable single-component problems with otherwise regular identifiable nuisance parameters. Multiple components or unidentified nuisance parameters need a separate limit or validated calibration.

And sometimes Wilks fails outright. In certain unrestricted mixture models, testing one component against two: under the null, the second component's location is not identified, and the statistic grows without bound, slowly, as John Hartigan showed. Change points and thresholds have the same disease, studied by Robert Davies. And when the number of constraints grows with the sample size, the chi-square approximation drifts, the subject of Part fifty-nine. A parametric bootstrap can help when its validity for the specific model is established; singular models can also invalidate a naive bootstrap. Other remedies use a test and limit theory designed for the model geometry.

Numbers: Poisson 95% point 3.74 vs 3.84; boundary: 50% zeros, size 2.5% → 4.9% with 2.71

6Confidence sets by inversionPhD4 min

Confidence sets by inversion: inverting a family of tests gives a confidence set, which need not be an interval.

Neyman's construction of 1937. For each possible value theta nought, take the acceptance region of a level-alpha test of theta equal to theta nought. The confidence set for data x is every theta nought that the data do not reject. It covers the true theta exactly when the data fall in that theta's acceptance region, which happens with probability at least one minus alpha, whatever theta is. And conversely, any confidence set defines a family of tests. Tests and confidence sets are the same objects, and the optimality of one transfers to the other.

The construction drawn: the confidence belt for a binomial proportion with twenty trials, from Clopper and Pearson's equal-tailed tests. Each gold segment is the interval for one count. Read it across, at p equal to : the counts whose intervals contain point three form the acceptance region of the test, from to . Read it up, at successes: the p's whose acceptance regions contain form the interval, from to . One belt, read in two directions.

The exact binomial coverage evaluated on the displayed parameter grid: never below ninety-five percent, as the construction guarantees, with the sawtooth of a discrete distribution. Against it, the Wald interval, estimate plus or minus 1.96 standard errors, whose induced tests do not maintain the claimed level uniformly, and whose coverage falls to percent near the edges. Part eleven met these curves; here is the reason. Uniform coverage and uniformly valid induced tests are equivalent. The parameter grid illustrates this equivalence; its observed minimum is not a proof of a global numerical minimum.

What makes an interval good? Neyman's answer: it should rarely contain false values. A confidence set is uniformly most accurate if, at every true theta, its chance of covering each false value is as small as possible. Inverting uniformly most powerful tests gives uniformly most accurate bounds, including randomized exact upper bounds for a proportion. The usual nonrandomized Clopper–Pearson bound is conservative and does not automatically inherit strict UMA optimality among randomized procedures. Inverting UMPU tests gives the most accurate among unbiased sets, those that cover any false value with probability no more than one minus alpha. The t interval is one: chapter three's optimality, transferred.

John Pratt noticed in 1961 that integrated false coverage determines expected length. The length of a set is the integral of the indicator that each theta prime lies in it. Taking expectations and exchanging the nonnegative integrals by Tonelli, even when the answer is infinite, the expected length is the integral of the probabilities of covering each theta prime. So the most accurate sets, which make those probabilities small for false values, also have the smallest expected length. But some problems force the expected length to be infinite, for every valid procedure. That is the next chapter.

Numbers: Clopper–Pearson ≥ 95.8%; Wald down to 9.5%

7Impossibility: Fieller and Gleser-HwangPhD5 min

Impossibility, from Fieller to Gleser and Hwang: when every honest interval must sometimes be infinite.

Many quantities are ratios: a dose that kills half the beetles, a cost per life saved, an instrumental-variable effect. Assume jointly normal numerator and denominator estimates with known positive definite covariance, and a nonzero true denominator. For the true ratio, a minus rho b is normal with mean zero and a known variance, so this standardized quantity is an exact pivot. Edgar Fieller inverted it: the confidence set is every rho for which the pivot is small, a quadratic inequality in rho. Depending on whether the denominator is clearly away from zero, the set is a bounded interval, the complement of an interval, two rays running off to infinity, or the entire real line.

Plot the quadratic: the confidence set is where it falls below zero. When the denominator estimate is large compared with its standard error, the parabola opens upward and the set is an ordinary interval. When its squared estimate is below z squared times its variance, the parabola opens downward. If the discriminant is positive, the set is everything outside an interval: arbitrarily large ratios, positive and negative, remain plausible. In the red example the joint quadratic has negative discriminant and stays below zero, giving the whole line. Two separately nonsignificant estimates do not by themselves guarantee that shape. This is not a defect of the method: a weak denominator can require arbitrarily large ratios to remain in the confidence set. In a probability-zero transition case the quadratic can reduce to a half-line.

Simulated, with a numerator of one and denominators of four, two, one, and one half, each with standard error one. With a strong denominator, Fieller's set is almost always an interval, and the delta method's estimate plus or minus 1.96 standard errors does about as well. As the denominator weakens, Fieller's set is more and more often unbounded, but its coverage stays at ninety-five percent, because it is exact. The delta method always reports a finite interval, and its coverage collapses to percent.

Leon Gleser and Gene Hwang proved in 1987 that this is unavoidable. In the normal ratio problem, with numerator and nonzero denominator allowed to approach zero together along any fixed ratio, any confidence set whose coverage is at least one minus alpha at every parameter value cannot be almost surely bounded throughout this model. At the limiting zero-mean distribution its probability of being unbounded is at least one minus alpha; continuity and common positive densities connect this limit to the model. For interval-valued procedures with uniform positive coverage, this forces infinite expected length. Unboundedness alone would not imply infinite Lebesgue measure for an arbitrary disconnected sparse set. Turned around: any procedure that always reports a bounded interval, such as the delta method or a Wald interval, has a worst-case coverage of zero, whatever level it claims.

Real data: Bliss's beetles from Part twenty-four, the logistic dose-response curve. The base-ten logarithm of the dose that kills half the beetles is minus the intercept over the slope, a ratio, and the slope is about standard errors from zero. The reported intervals are on the log-ten dose scale. Their endpoints agree to three decimals. Here the normal approximation and covariance are estimated from a logistic fit, so both intervals are asymptotic rather than exact. That is the general lesson: when the denominator is strong, the delta method is fine; Fieller inversion can retain unbounded sets when needed, but its validity still depends on the joint distribution and covariance calibration.

The same impossibility appears elsewhere. With weak instruments, Wald intervals for the causal effect fail, and the honest Anderson–Rubin sets of Part thirty-seven can be unbounded when the instrument contains little identifying information. Dufour's 1997 impossibility results explain why uniformly valid bounded sets cannot generally solve weak-identification problems; there is no universal equivalence between one observed first-stage statistic and set shape. So too for cost-effectiveness ratios, relative potencies, and the location of a maximum. The honest report is sometimes an unbounded set: the data are consistent with any ratio beyond some value.

Numbers: β = 0.5: Fieller 95.2% (68% all of ℝ); delta 78%; Bliss LD50 1.772

8Bounded parameters: Feldman-CousinsPractice4 min

Bounded parameters, and Feldman and Cousins's unified intervals: a signal that cannot be negative.

A problem from particle physics. A detector counts events: a Poisson number with mean equal to an unknown signal mu, which cannot be negative, plus a known background of three. Suppose it counts nothing. The classical ninety percent upper limit, from the one-sided Poisson test, is minus the log of point one minus three: , a negative signal. The interval is empty. The Neyman construction allows this and retains at least ninety percent unconditional coverage at each admissible signal value. An empty set on one outcome is compatible with that procedure-level guarantee. The common practice was to flip-flop: quote an upper limit if the count looks small, a two-sided interval if it looks large, deciding after seeing the data.

Gary Feldman and Robert Cousins's fix of 1998 is the Neyman construction with a better ordering. For each mu, rank the possible counts by a likelihood ratio: the probability of n under mu, over its probability under the best physically allowed mu, which is n minus the background, or zero. Fill the acceptance region with the highest-ranked counts until it holds ninety percent. Invert, as in chapter six. The intervals are never empty, and they move from upper limits to two-sided intervals by themselves, as the count grows, with the coverage guaranteed. Their ordering is the likelihood ratio test's acceptance region, so this is chapter five's test, inverted.

The intervals for zero to ten counts, with a background of three. Feldman and Cousins's are upper limits for up to five counts, and two-sided from six on. The raw likelihood-ratio ordering here gives zero to about point nine five for zero counts. The published Table Four adds an across-background monotonicity correction and reports an upper endpoint of one point zero eight at background three. We display the unmodified ordering, with its own valid construction-grid coverage. The flip-flopping intervals are empty at zero and switch from limits to intervals at nine, the background plus three standard deviations. The numerical construction reproduces the published zero-background table within its grid resolution and rounding.

Poisson-summed coverage at the displayed signals on the construction grid. The stored endpoints use steps of point zero one, so endpoint locations are numerical approximations. Feldman and Cousins's intervals never cover less than ninety percent. The flip-flopping intervals fall to percent, near a signal of . Each piece of the flip-flop is a valid interval on its own; combining them by this particular count-dependent switch breaks their original guarantee. A data-dependent transition can be valid when calibrated as one complete procedure, as the unified construction demonstrates. The teeth come from the discreteness of the counts.

The lesson is that Neyman's construction leaves a choice, the ordering of the sample space within each acceptance region, and that choice decides what the intervals look like. Ordering by the likelihood ratio gives unified, never-empty intervals with correct coverage. One oddity remains: an experiment with more background that happens to see zero events reports a tighter limit than a cleaner experiment that saw the same zero, which troubles many physicists. Hence the alternatives in use at CERN, such as the CLs method and Bayesian limits with a flat prior on the non-negative signal.

Numbers: b = 3, n = 0: FC [0, 0.95]; classical −0.70; flip-flop 85.5%

9Simultaneous inferencePractice4 min

Simultaneous inference: many intervals, one promise. Henry Scheffé asked for intervals for every linear combination of k parameters at once, infinitely many, with one joint guarantee. The worst combination, by Cauchy–Schwarz, turns the supremum into the quadratic form of the estimation error, which is chi-square with k degrees of freedom. So the intervals estimate plus or minus the root of the chi-square quantile times each combination's standard error hold simultaneously with probability one minus alpha. For the normal linear model with an independent chi-square residual estimate of a common variance, the multiplier becomes the root of k times the appropriate F quantile. An arbitrary covariance estimate does not give this exact law. The intervals are the projections of the confidence ellipsoid for theta onto every direction.

The price, as a multiplier of the standard error. Scheffé's grows like the root of k: two point four five for two parameters, five point six for twenty. Bonferroni's, for exactly k intervals chosen in advance, grows only like the root of the log of k: three point zero two for twenty. So for a fixed list of comparisons Bonferroni wins; Scheffé's advantage is that it covers every contrast, including the ones you only thought of after looking at the data.

For a finite family of hypotheses there is a general principle. Form every intersection of them, and give each a level-alpha test of its own. Reject an individual hypothesis only if every intersection containing it is rejected: the closed testing principle of Ruth Marcus, Eric Peritz and Ruben Gabriel, 1976. The proof is one line. A false rejection requires rejecting the intersection of the true nulls, and that happens with probability at most alpha. With Bonferroni as the local test, closed testing is Holm's procedure; with Simes's test, it is Hommel's, provided each intersection satisfies the conditions making Simes valid, such as independent null p-values or the required positive regression dependence. Holm is step-down; Hommel uses a different shortcut through the closure.

An example with four p-values: point zero one one, point zero one eight, point zero two four and point zero four. Here are the fifteen intersections, from all four at the top down to the single hypotheses. With Bonferroni locally, the intersections rejected are shaded red; only the first hypothesis has every intersection above it rejected. With Simes's test locally, every intersection is rejected, because the p-values are all small together, and Hommel's procedure rejects all four. Plain Bonferroni would also stop at the first. Every local test must actually control its level under its intersection null. Bonferroni allows arbitrary dependence; the Simes version needs the stated dependence assumptions.

Two refinements. The partitioning principle of Helmut Finner and Klaus Strassburger tests disjoint pieces of the parameter space, each at level alpha, and so yields confidence statements about the direction of each effect, not merely rejections. And the gatekeeping and graphical procedures used in clinical trials are closed tests with a hierarchy built in. The false discovery rate of Part thirty-three is a different promise altogether: a bound on the expected proportion of errors, not on the probability of any.

Numbers: k = 20: Scheffé 5.60, Bonferroni 3.02; Holm rejects 1, Hommel 4

10Conditional inferencePhD3 min

Conditional inference: does ninety-five percent hold for this data set? Bernard Welch's example of 1939. Two observations from a uniform distribution of width one centred at theta; take the interval between them. It covers theta exactly when one observation falls on each side, which has probability one half: a fifty percent confidence interval. But if the two observations are more than a half apart, theta must lie between them: the interval is certainly right. Reporting fifty percent confidence for a statement known to be true is absurd. Part forty-five's answer was to condition on the ancillary range.

Robert Buehler made the worry precise in 1959. A relevant subset is a set of samples, recognizable from the data alone, on which the interval's conditional coverage is bounded away from its stated level, at every value of the parameter, above it or below it. Even Student's t interval has them. With two normal observations, Buehler and Feddersen, and then Lawrence Brown, showed that on the set where the mean is small compared with the standard deviation, the fifty percent t interval covers more than half the time, whatever the true mean and variance. Someone who can see the set can bet against the stated confidence, at the stated odds, and expect to win.

Simulated, at six values of mu over sigma. The overall coverage is fifty percent, as advertised, at every one. On the recognizable set, the six simulated settings range from about sixty-one to eighty-six percent. Independent quadrature checks those conditional probabilities; this finite table does not establish their global extrema. And the set is not rare: it contains most samples when the mean is small.

Buehler's framing is a betting game. You announce an interval with confidence one minus alpha; I may bet against it at the odds you implied. If I have a strategy that wins on average whatever theta is, your stated confidence is incoherent for the case in hand. Geoffrey Robinson's 1979 theory of relevant and semi-relevant subsets made this systematic; for the t interval the bettor's edge is small in large samples. An interval with exactly the advertised posterior content under a proper prior has the same average content conditional on any data event of positive prior-predictive probability. That excludes a uniform positive gap above or below the advertised level on such an event: Part forty-five's theme, Bayesian content can diagnose one form of conditional inconsistency. This does not make every good confidence procedure a proper-prior posterior interval.

What should a practitioner do? Condition on ancillary statistics when they exist, as Welch's and Cox's examples demand. Otherwise, describe a confidence level for what it is: a guarantee about the procedure over repetitions, not a probability for the case in hand. And when choosing among procedures, prefer those whose conditional behaviour stays close to their stated level.

Numbers: 50% t interval: 61–86% on the recognizable set

11p-values and evidencePractice5 min

P-values and evidence: how strong is a p-value of point zero five? James Berger and Thomas Sellke asked in 1987 what a p-value says as evidence. Take a normal observation and the point null theta equal to zero, tested two-sided. Give the null prior probability one half, and spread the other half over the alternatives by some distribution g. The Bayes factor compares the density of the data under the null with its average under g. The posterior probability of the null follows. Now minimize it over a whole class of g's: the result is the strongest case any advocate of the alternative could make from these data.

The normal-model bounds, at equal prior odds, for four p-values. The last column converts the separate beta-mixture p-value Bayes-factor calibration into a posterior probability. With p equal to point one, the posterior probability of the null is at least point two one over all priors, and about point four over symmetric unimodal ones. At p equal to point zero five, the famous line: at least point one three over every proper alternative prior in this specified normal model, keeping the null prior probability fixed at one half, and point two nine over symmetric unimodal priors. It takes p near point zero zero one to bring the posterior probability of the null down to the one or two percent that p equal to point zero five is often mistaken for.

As curves, against the p-value on a log scale. In red, the bound over all priors; in gold, over symmetric unimodal priors; in green, over normal priors. In grey, the p-value itself. In the small-p region these posterior lower bounds exceed the p-value, with the displayed equal prior odds. A p-value is not a posterior probability; a different null prior weight changes posterior odds, and the all-prior curve need not exceed p across the entire plotted range.

A calibration with explicit assumptions on the alternative distribution of the p-value. Under the null, p is uniform; under an alternative, suppose p has a Beta xi, one distribution with xi between zero and one, or a mixture of these beta distributions. Merely having a decreasing density is not sufficient. The Bayes factor of the null against such an alternative is at least minus e times p times the log of p, for p below one over e: the calibration of Thomas Sellke, Susie Bayarri and Berger, 2001. At point zero five it gives a Bayes factor of at least point four one and a posterior probability of at least point two nine, close to, though not identical with, the symmetric-unimodal normal-model bound, with the same equal prior odds. This derivation applies to a continuous uniform null p-value and the stated beta-mixture alternative class. Discrete p-values or a different alternative class require a separate argument; it is not a universal bound for every model.

The lesson. In this normal model at equal prior odds, p equal to point zero five allows posterior odds of about six point eight to one against the null over all alternative priors. Restricting alternatives to symmetric unimodal priors reduces the best odds to about two point four five to one. And these bounds assume the alternative most favourable to rejection; realistic alternatives give weaker evidence still. Lindley's paradox, from Part fifteen, is the extreme: in a regular increasing-information model, with fixed positive null prior weight and a fixed proper continuous alternative prior having suitable density near the null, keeping the p-value fixed can make the posterior probability of the null tend to one. This limit depends on the prior sequence. Hence the American Statistical Association's statement of 2016, and the proposal by Daniel Benjamin and some seventy co-authors to require p below point zero zero five for claims of discovery. None of this makes p-values invalid as tests: properly calibrated p-values yield tests with their advertised size or a conservative level. They are simply not the probability that the null is true.

Numbers: p = 0.05: P(H₀ | x) ≥ 0.128 (all), 0.290 (unimodal), 0.321 (normal)

12Goodness of fit, rigorouslyPhD4 min

Karl Pearson's statistic of 1900 adds up the squared differences between observed and expected counts, each divided by its expected count. The standardized differences are asymptotically normal, by the multivariate central limit theorem, for a fixed number of categories and fixed positive cell probabilities, with a covariance matrix equal to the identity minus the outer product of the square roots of the probabilities. That matrix is a projection, of rank k minus one, because the counts must add up to n. So Pearson's statistic, the squared length of a normal vector projected onto a k minus one dimensional space, tends to a chi-square with k minus one degrees of freedom.

Checked by simulation: sixty rolls of a fair die, six categories. The quantiles of Pearson's statistic sit on those of chi-square with five degrees of freedom, and the nominal five percent test rejects percent of the time, with only ten expected counts per cell. This example checks one balanced design; sparse cells, growing category counts, or fitted probabilities require separate conditions.

Usually the null is a family, not a single distribution: normal, with unknown mean and variance. We estimate the parameters and then compute the statistic. Fisher showed in 1924, against Pearson, that with efficient estimates from the grouped counts each estimated parameter costs one degree of freedom. But Chernoff and Lehmann showed in 1954 that under the regular fixed-bin model, efficient ungrouped maximum likelihood estimation generally gives a weighted chi-square limit: it lies between the chi-squares with k minus one minus q and k minus one degrees of freedom. Estimating the null changes the statistic's null distribution, a lesson that matters even more for the next test.

The Kolmogorov–Smirnov test of normality, with the mean and standard deviation estimated from the same data. With twenty observations the usual table's five percent critical value is ; the estimated ninety-fifth percentile from forty thousand fresh normal simulations is . Using the table, the simulated rejection count is extremely small; the displayed percentage has appreciable relative Monte Carlo uncertainty and is not an exact tail probability. With a hundred observations, the same: the ratio of the critical values does not improve with n. Fitting the parameters pulls the normal curve toward the data, so the distance is much smaller than for a fixed null. Hubert Lilliefors tabulated the correct values in 1967.

The null distribution itself: forty thousand values of the statistic with twenty observations and the parameters estimated. In green, its correct ninety-fifth percentile. In red, the critical value from the standard table, out in the far tail, almost never reached. The fix is Lilliefors's table, or more generally a parametric bootstrap: simulate from the fitted model, refit, and recompute the statistic each time.

The reason is a theorem about processes. for independent observations from a continuous distribution, the empirical CDF fluctuation tends to a Brownian bridge evaluated at the true CDF. The scaled Kolmogorov–Smirnov statistic tends to its supremum absolute value. With estimated parameters plugged in, James Durbin showed in 1973 that the limit is a different Gaussian process: a bridge with an estimator-dependent correction. For efficient estimators in a regular parametric model the correction has a projection interpretation; arbitrary estimators need their own influence-function calculation. Its law depends on the family, and sometimes on the parameter, so no universal table exists. Part forty-eight, on empirical processes, proves these limits.

Numbers: Pearson 95% point 11.0 vs 11.07; KS table 0.294 vs correct 0.192 (n = 20)

Recap, problems, and the road aheadAll tracks2 min

Part forty-six in thirteen lines. The Behrens–Fisher problem, Welch's answer and Linnik's theorem. The Neyman–Pearson lemma with its randomization and its linear programme. Monotone likelihood ratio and Karlin–Rubin, and the absence of a UMP two-sided test in the binomial example. Unbiased tests by Neyman structure, and the t test's optimality. Invariance, Hunt–Stein and the F test. Wilks's theorem and Chernoff's boundary. Confidence sets by inversion. Fieller's unbounded sets and Gleser and Hwang's impossibility. Feldman and Cousins against flip-flopping. Scheffé's projections and closed testing. Welch's uniform example and Buehler's recognizable subsets. Berger and Sellke's bounds. And goodness of fit, with Lilliefors and Durbin.

A promise for the next part. This one found exact optimal tests and honest confidence sets. But exact theory needs exact distributions, which most models do not have. Part forty-seven is asymptotic statistics: contiguity, local asymptotic normality, the convolution theorem that makes the MLE optimal, and the delta method, proved.

Where it comes back. Part forty-seven proves Wilks's theorem and the local power of the score and Wald tests. Part forty-eight studies the processes behind Kolmogorov–Smirnov. Part fifty-six conditions on selection, while chapter ten examined recognizable subsets, which need not be ancillary. Part fifty-seven builds exact distribution-free tests. And Part fifty-eight turns tests into e-values and confidence sequences that stay valid however long you watch.

Six problems, with full solutions in the README. A UMP Poisson test; the z test as UMPU; the uniform's non-unique UMP test; Chernoff's mixture; closed testing's error control; and the p-value calibration. Pause here if you want to try them.

The books this part follows: Lehmann and Romano's Testing Statistical Hypotheses, Shao, Schervish, and Linnik's monograph; and the papers from Neyman and Pearson to Feldman and Cousins.

Forty-six parts of sixty-five. An optimal test is one that wins inside a class, unbiased or invariant, and an honest interval is sometimes infinite. Next, Part forty-seven: asymptotic statistics.

Where it goes next. Wilks's theorem is proved and local power computed in Part 47; the Kolmogorov-Smirnov limit with estimated parameters is derived in Part 48; conditioning on a selection event is Part 56, exact distribution-free tests Part 57, and e-values and confidence sequences Part 58.

Key results

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

The Neyman-Pearson lemma\(\displaystyle \varphi(x)=\begin{cases}1,&f_1(x)>k f_0(x)\\ \gamma,&f_1(x)=k f_0(x)\\ 0,&f_1(x)<k f_0(x)\end{cases}\qquad\allowbreak \operatorname{E}_0\varphi=\alpha\ \Longrightarrow\ \varphi\ \text{is }\allowbreak \text{most }\allowbreak \text{powerful }\allowbreak \text{at }\allowbreak \text{level }\alpha\)
Neyman structure\(\displaystyle \operatorname{E}_\theta\varphi=\alpha\ \text{on }\allowbreak \text{the }\allowbreak \text{boundary}\iff \operatorname{E}[\varphi\mid T=t]=\alpha\ \text{for }\allowbreak \text{almost }\allowbreak \text{every }t\quad\allowbreak (T\ \text{sufficient }\allowbreak \text{and }\allowbreak \text{boundedly }\allowbreak \text{complete }\allowbreak \text{there})\)
The UMPU side conditions\(\displaystyle \operatorname{E}_{\theta_0}\varphi=\alpha,\qquad\allowbreak \operatorname{E}_{\theta_0}[T\varphi]=\alpha\,\operatorname{E}_{\theta_0}T\)
Chernoff's boundary limit\(\displaystyle H_0:\mu=0\ \text{vs}\ \mu\ge 0:\qquad\allowbreak 2\log\Lambda_n\Rightarrow\tfrac12\chi^2_0+\tfrac12\chi^2_1\)
Fieller's set\(\displaystyle \Bigl\{\rho:\ (a-\rho b)^2\le z_{\alpha/2}^2\,\bigl(v_a-2\rho\,c_{ab}+\rho^2 v_b\bigr)\Bigr\}\)
The calibration of a p-value\(\displaystyle \mathrm{BF}_{01}\ge -e\,p\log p\quad\allowbreak (p<1/e),\qquad\allowbreak P(H_0\mid x)\ge\Bigl(1+\frac{1}{-e\,p\log p}\Bigr)^{-1}\ \text{at }\allowbreak \text{equal }\allowbreak \text{prior }\allowbreak \text{odds}\)

Try it

Lab 46 · Similar tests, unbiased tests, and an interval that must sometimes be infinite

Compute the size of the conditional two-binomial test at every value of the nuisance parameter, with and without randomization; compare the UMPU and equal-tailed binomial tests near the null; then simulate a ratio of normal means and compare Fieller's set with the delta-method interval.

Figure produced by Lab 46: Similar tests, unbiased tests, and an interval that must sometimes be infinite
Produced by the lab below, seed 0, in 0.6 s.
python -m videos.stats.labs 46 needs numpy, scipy, matplotlib · download lab46.py · source on GitHub
randomized conditional test: size over p     0.0500 to 0.0500   (similar: 0.05 at every p)
Fisher's exact test: size over p             0.0000 to 0.0176   (at most 0.05)
UMPU test of p = 0.3, n = 20                 reject x < 2 or x > 10, with probability 0.693 at 2 and 0.192 at 10
UMPU: lowest power near the null             0.05000 at p = 0.300   (unbiased: 0.05 at p0)
equal tails: lowest power near the null      0.04987 at p = 0.296   (biased: below 0.05)
denominator mean 4: coverage of the ratio    Fieller 95.1% (bounded 98% of the time)   delta method 97.4%
denominator mean 2: coverage of the ratio    Fieller 95.3% (bounded 51% of the time)   delta method 97.1%
denominator mean 1: coverage of the ratio    Fieller 95.5% (bounded 17% of the time)   delta method 92.9%
denominator mean 0.5: coverage of the ratio  Fieller 95.0% (bounded 8% of the time)   delta method 78.6%

Conditioning on the total makes the test's size free of the nuisance parameter; the UMPU test's power bottoms out exactly at the null; and Fieller keeps 95% only by returning unbounded sets.
The code (86 lines; it asserts its own result)
"""Lab 46: check that a test with Neyman structure is similar, that the UMPU test is unbiased, and Fieller's coverage."""

import numpy as np
from scipy import stats

from videos.coursekit import labs
from explainer.stats.kit import testing

TITLE = "Similar tests, unbiased tests, and an interval that must sometimes be infinite"
GOAL = ("Compute the size of the conditional two-binomial test at every value of the nuisance parameter, with and "
        "without randomization; compare the UMPU and equal-tailed binomial tests near the null; then simulate a ratio "
        "of normal means and compare Fieller's set with the delta-method interval.")
TASKS = [
    "Change the group sizes from 8 and 10 to 30 and 40. How close to 5% does Fisher's exact test (no randomization) get?",
    "Move the binomial null from p0 = 0.3 to p0 = 0.5. Why do the UMPU and equal-tailed tests now coincide?",
    "Give the numerator and denominator estimates a correlation of 0.8 (use the cab argument of testing.fieller). Does Fieller still cover 95%?",
]


def run(seed=0):
    rng = np.random.default_rng(seed)
    lab = labs.Lab()
    alpha = 0.05

    # 1. Neyman structure: X ~ Bin(8, p1), Y ~ Bin(10, p2), H0: p1 <= p2.  Each slice X + Y = t is tested at level alpha.
    m, n = 8, 10
    ps = np.linspace(0.02, 0.98, 97)
    size_r = testing.unconditional_size(testing.conditional_test(m, n, alpha)["phi"], m, n, ps)
    size_f = testing.unconditional_size(testing.conditional_test(m, n, alpha, randomized=False)["phi"], m, n, ps)
    lab.row("randomized conditional test: size over p", f"{size_r.min():.4f} to {size_r.max():.4f}   (similar: {alpha} at every p)")
    lab.row("Fisher's exact test: size over p", f"{size_f.min():.4f} to {size_f.max():.4f}   (at most {alpha})")
    assert np.allclose(size_r, alpha, atol=1e-10), "every slice spends exactly alpha, so the test is similar"
    assert size_f.max() < 0.03, "without randomization the test is conservative"

    # 2. UMPU against equal tails for Bin(20, p), H0: p = 0.3.
    N, p0 = 20, 0.3
    u = testing.umpu_binomial(N, p0, alpha)
    grid = np.linspace(0.2, 0.4, 2001)
    pow_u = testing.power(u["phi"], N, grid)
    pow_e = testing.power(testing.equal_tailed_binomial(N, p0, alpha), N, grid)
    lab.row("UMPU test of p = 0.3, n = 20", f"reject x < {u['c1']} or x > {u['c2']}, with probability {u['g1']:.3f} at {u['c1']} and {u['g2']:.3f} at {u['c2']}")
    lab.row("UMPU: lowest power near the null", f"{pow_u.min():.5f} at p = {grid[pow_u.argmin()]:.3f}   (unbiased: {alpha} at p0)")
    lab.row("equal tails: lowest power near the null", f"{pow_e.min():.5f} at p = {grid[pow_e.argmin()]:.3f}   (biased: below {alpha})")
    assert abs(pow_u.min() - alpha) < 1e-9 and abs(grid[pow_u.argmin()] - p0) < 1e-3, "the UMPU power is smallest at p0"
    assert pow_e.min() < alpha - 5e-5 and abs(grid[pow_e.argmin()] - p0) > 2e-3, "the equal-tailed test is biased"

    # 3. Fieller: a ~ N(1, 1), b ~ N(beta, 1), the ratio 1 / beta.  The set is bounded, two rays, or the whole line.
    reps, betas = 4000, (4.0, 2.0, 1.0, 0.5)
    z = stats.norm.ppf(0.975)
    cover_f, cover_d, bounded = [], [], []
    for beta in betas:
        rho = 1 / beta
        a, b = 1 + rng.standard_normal(reps), beta + rng.standard_normal(reps)
        hit, bd = 0, 0
        for ai, bi in zip(a, b):
            s = testing.fieller(ai, bi, 1.0, 1.0)
            inside = s["lo"] <= rho <= s["hi"] if s["kind"] != "all" else True
            hit += inside if s["kind"] != "exclusive" else not (s["lo"] < rho < s["hi"])
            bd += s["kind"] == "bounded"
        se = np.sqrt(1 / b ** 2 + a ** 2 / b ** 4)  # the delta method for a / b
        cover_f.append(hit / reps)
        bounded.append(bd / reps)
        cover_d.append(float(np.mean(np.abs(a / b - rho) <= z * se)))
        lab.row(f"denominator mean {beta:g}: coverage of the ratio", f"Fieller {cover_f[-1]:.1%} (bounded {bounded[-1]:.0%} of the time)   delta method {cover_d[-1]:.1%}")
    assert np.all(np.abs(np.array(cover_f) - 0.95) < 0.015), "Fieller's pivot is exact"
    assert cover_d[-1] < 0.85 and bounded[-1] < 0.2, "a bounded interval cannot cover when the denominator is near 0"
    lab.note = ("Conditioning on the total makes the test's size free of the nuisance parameter; the UMPU test's power "
                "bottoms out exactly at the null; and Fieller keeps 95% only by returning unbounded sets.")

    fig, ax = labs.figure(2, size=(11, 4.3))
    ax[0].plot(ps, size_r, color=labs.GOLD, label="randomized conditional test")
    ax[0].plot(ps, size_f, color=labs.BLUE, label="Fisher's exact test")
    ax[0].axhline(alpha, color=labs.MUTED, ls=":", lw=1)
    ax[0].set(title="Size against the nuisance parameter (8 and 10 trials)", xlabel="common success probability p",
              ylabel="P(reject) when p1 = p2 = p", ylim=(0, 0.07))
    ax[0].legend(loc="lower center")
    xpos = np.arange(len(betas))
    ax[1].bar(xpos - 0.2, cover_f, 0.4, color=labs.GOLD, label="Fieller's set")
    ax[1].bar(xpos + 0.2, cover_d, 0.4, color=labs.RED, label="delta-method interval")
    ax[1].plot(xpos, bounded, "o--", color=labs.BLUE, label="share of Fieller sets that are bounded")
    ax[1].axhline(0.95, color=labs.MUTED, ls=":", lw=1)
    ax[1].set_xticks(xpos, [f"{b:g}" for b in betas])
    ax[1].set(title="A ratio of normal means: 95% sets", xlabel="denominator mean (its SE is 1)", ylabel="coverage", ylim=(0, 1.3))
    ax[1].legend(loc="upper left", ncols=1)
    lab.fig = fig
    return lab

Now change it

  1. Change the group sizes from 8 and 10 to 30 and 40. How close to 5% does Fisher's exact test (no randomization) get?
  2. Move the binomial null from p0 = 0.3 to p0 = 0.5. Why do the UMPU and equal-tailed tests now coincide?
  3. Give the numerator and denominator estimates a correlation of 0.8 (use the cab argument of testing.fieller). Does Fieller still cover 95%?

Problems, with solutions

Try each problem before opening its solution.

  1. A UMP Poisson test. Find the UMP level-\(\alpha\) test of \(\lambda \le 1\) vs \(\lambda > 1\) from \(n\) Poisson counts, and its power function.

    Solution
    • T = Σ X_i ~ Poisson(nλ). The family has a monotone likelihood ratio in T, since the ratio is (λ₁/λ₀)^T e^{−n(λ₁−λ₀)}.
    • By Karlin–Rubin the UMP test is φ = 1{T > c} + γ 1{T = c}, with P₁(T > c) + γ P₁(T = c) = α under nλ = n.
    • Its power is β(λ) = P_{nλ}(T > c) + γ P_{nλ}(T = c), increasing in λ.
  2. The z test is UMPU. Show that the two-sided \(z\) test of \(\mu = 0\) is UMPU, using \(E_0\phi = \alpha\) and \(E_0[\bar X \phi] = 0\).

    Solution
    • X̄ ~ N(μ, 1/n) is an exponential family in T = X̄. A UMPU test rejects outside an interval [c₁, c₂], with E₀φ = α and E₀[X̄ φ] = α E₀X̄ = 0.
    • The symmetric test φ = 1{|X̄| > z_{α/2}/√n} has size α. Because φ is even and X̄ is symmetric under μ = 0, E₀[X̄ φ] = 0.
    • So it satisfies both conditions, and by the generalized Neyman–Pearson lemma it is the UMPU test.
  3. The uniform's non-unique UMP test. For \(U(0, \theta)\), show that \(\phi = \mathbf 1\{\max x_i > \theta_0 (1 - \alpha)^{1/n}\}\) is UMP for \(\theta \le \theta_0\), but not unique.

    Solution
    • For θ₁ > θ₀ the ratio f_{θ₁}/f_{θ₀} = (θ₀/θ₁)ⁿ on {max ≤ θ₀} and ∞ on {θ₀ < max ≤ θ₁}. So any level-α test that rejects whenever max > θ₀ is most powerful.
    • φ = 1{max > θ₀(1 − α)^{1/n}} has P_{θ₀}(max > c) = 1 − (c/θ₀)ⁿ = α, and rejects whenever max > θ₀.
    • So does φ′ = α·1{max ≤ θ₀} + 1{max > θ₀}. For every θ > θ₀ both have power 1 − (1 − α)(θ₀/θ)ⁿ, so both are UMP, and they differ.
    • For θ ≤ θ₀ their powers are at most α, since the power is increasing.
  4. Chernoff's mixture. Show that \(\max(0, Z)^2\) has the law \(\tfrac12 \chi^2_0 + \tfrac12 \chi^2_1\) under \(\mu = 0\).

    Solution
    • P(max(0, Z)² = 0) = P(Z ≤ 0) = ½.
    • For t > 0, P(max(0, Z)² > t) = P(Z > √t) = ½ P(Z² > t) = ½ P(χ²₁ > t).
    • Together these say the law is ½δ₀ + ½χ²₁.
  5. Closed testing controls the FWER. Prove that closed testing with level-\(\alpha\) local tests controls the familywise error rate.

    Solution
    • Let T be the set of true nulls. If T is empty there are no false rejections.
    • Otherwise H_T is true, so its local test rejects it with probability at most α.
    • Any false rejection of some H_i, i ∈ T, requires every intersection containing i to be rejected, H_T among them. So P(any false rejection) ≤ P(H_T rejected) ≤ α.
  6. The p-value calibration. Show that \(\min_{\xi \in (0,1)} 1/(\xi p^{\xi - 1}) = -e\,p \log p\) for \(p < 1/e\).

    Solution
    • Minimize h(ξ) = ξ^{−1} p^{1−ξ} over ξ ∈ (0, 1). Then log h = −log ξ + (1 − ξ) log p, with derivative −1/ξ − log p.
    • The derivative vanishes at ξ* = −1/log p, which lies in (0, 1) exactly when p < 1/e.
    • There h(ξ*) = −log p · p · p^{1/log p} = −log p · p · e = −e p log p.

Notes and sources

Where it comes back

  • Part 47: Wilks's theorem proved; the local power of the score, Wald and LR tests; contiguity.
  • Part 48: the empirical processes behind Kolmogorov–Smirnov and Durbin's estimated-parameter limit.
  • Part 56: selective inference: conditioning on the selection event, while chapter 10 also studies recognizable subsets that need not be ancillary.
  • Part 57: exact distribution-free tests: permutation and conformal.
  • Part 58: e-values and confidence sequences, valid however long you watch.

Glossary

  • Tests.
    • Test function; randomized test; size, power, power function; most powerful; Neyman–Pearson lemma; generalized lemma: the basics.
    • Monotone likelihood ratio; Karlin–Rubin; UMP; locally most powerful: one-sided optimality.
    • Unbiased test; similar test; Neyman structure; UMPU; conditional test; Fisher's exact test; mid-p: nuisance parameters.
    • Group action; invariant test; maximal invariant; UMPI; Hunt–Stein theorem; amenable group; most stringent: invariance.
    • Likelihood ratio statistic; Wilks's theorem; χ̄² mixture; non-identifiability under the null; parametric bootstrap: large-sample tests.
  • Confidence sets.
    • Neyman construction; confidence belt; acceptance region; ordering; UMA set; unbiased set; Pratt's identity: from tests to sets.
    • Fieller's set; pivot; unbounded confidence set; Gleser–Hwang theorem: impossibility.
    • Physical boundary; flip-flopping; Feldman–Cousins (unified) interval; CLs: bounded parameters.
    • Scheffé's method; familywise error rate; closed testing; Holm, Hommel; partitioning: simultaneous inference.
    • Relevant (recognizable) subset; semi-relevant subset; conditionality: the case in hand. Recognizable subsets need not be ancillary.
  • Evidence and fit.
    • Bayes factor; Berger–Sellke bounds; calibration −e p log p; Lindley's paradox: evidence.
    • Pearson's χ²; degrees of freedom lost to estimation; Lilliefors test; Durbin's process: goodness of fit.

Sources

  • Behrens–Fisher.
    • W. Behrens, Landwirtsch. Jahrb. 68 (1929); R. A. Fisher, Ann. Eugenics 6 (1935).
    • M. Bartlett, Proc. Camb. Phil. Soc. 32 (1936); B. Welch, Biometrika 29 (1938), 34 (1947).
    • Y. Linnik, Statistical Problems with Nuisance Parameters (1968).
  • Optimal tests.
    • J. Neyman & E. Pearson, Phil. Trans. A 231 (1933), Stat. Res. Mem. 1 (1936).
    • G. Dantzig & A. Wald, Ann. Math. Stat. 22 (1951); S. Karlin & H. Rubin, Ann. Math. Stat. 27 (1956).
    • P. L. Hsu, Biometrika 32 (1941); A. Wald, Ann. Math. Stat. 13 (1942); E. Lehmann, Testing Statistical Hypotheses (1959).
    • H. O. Lancaster, JASA 56 (1961), mid-p.
  • Likelihood ratios.
    • S. Wilks, Ann. Math. Stat. 9 (1938); H. Chernoff, Ann. Math. Stat. 25 (1954); S. Self & K.-Y. Liang, JASA 82 (1987).
    • J. Hartigan, Proc. Berkeley Conf. in Honor of Neyman and Kiefer (1985); R. Davies, Biometrika 64 (1977).
  • Confidence sets.
    • J. Neyman, Phil. Trans. A 236 (1937); C. Clopper & E. Pearson, Biometrika 26 (1934); J. Pratt, JASA 56 (1961).
    • E. Fieller, J. R. Stat. Soc. Suppl. 7 (1940), JRSS B 16 (1954); L. Gleser & J. Hwang, Ann. Stat. 15 (1987).
    • J.-M. Dufour, Econometrica 65 (1997); G. Feldman & R. Cousins, Phys. Rev. D 57 (1998); C. Bliss, Ann. Appl. Biol. 22 (1935).
  • Multiplicity, conditioning, evidence and fit.
    • H. Scheffé, Biometrika 40 (1953); R. Marcus, E. Peritz & K. R. Gabriel, Biometrika 63 (1976).
    • S. Holm, Scand. J. Stat. 6 (1979); G. Hommel, Biometrika 75 (1988); H. Finner & K. Strassburger, Ann. Stat. 30 (2002).
    • B. Welch, Ann. Math. Stat. 10 (1939); R. Buehler, Ann. Math. Stat. 30 (1959); R. Buehler & A. Feddersen, Ann. Math. Stat. 34 (1963).
    • L. Brown, Ann. Math. Stat. 38 (1967); G. Robinson, Ann. Stat. 7 (1979).
    • J. Berger & T. Sellke, JASA 82 (1987); T. Sellke, M. Bayarri & J. Berger, Am. Stat. 55 (2001).
    • R. Wasserstein & N. Lazar, Am. Stat. 70 (2016); D. Benjamin et al., Nat. Hum. Behav. 2 (2018).
    • K. Pearson, Phil. Mag. 50 (1900); R. A. Fisher, JRSS 87 (1924); H. Chernoff & E. Lehmann, Ann. Math. Stat. 25 (1954).
    • H. Lilliefors, JASA 62 (1967); J. Durbin, Ann. Stat. 1 (1973).
  • Books. E. Lehmann & J. Romano, Testing Statistical Hypotheses (4th ed. 2022); J. Shao, Mathematical Statistics (2nd ed. 2003); M. Schervish, Theory of Statistics (1995).
About this partfrom its README

Part 46 of a sixty-five-part course in statistics, from a first course to a PhD (see the series plan and the syllabus), and the fourth part of Stage IV, the PhD core.

It opens with the Behrens–Fisher problem: are two normal means equal when the variances are unequal and unknown?

  • Behrens (1929) and Fisher (1935) answered with a fiducial test whose size moves with the variance ratio.
  • Welch (1938, 1947) gave the practical approximation.
  • Linnik (1966–68) established impossibility results for restricted classes of classical nonrandomized rejection regions. This does not rule out all exact randomized tests; the constant rule φ(x) = α is a smooth, exactly similar but uninformative counterexample.

The part then builds:

  • the Neyman–Pearson theory in full: most powerful, monotone-likelihood-ratio, unbiased and invariant tests;
  • the likelihood ratio test on a boundary;
  • confidence sets by inversion, with their impossibility theorems and bounded-parameter repairs;
  • closed testing, conditional coverage, p-values as evidence, and goodness of fit with estimated parameters.

It keeps two promises:

  • Part 10 built tests that keep their size. Chapters 1–5 ask which level-α test is most powerful, and prove that the t test is UMPU and UMP invariant.
  • Part 11 built intervals with good coverage. Chapters 6–10:
    • construct uniformly most accurate sets by inversion;
    • show that ratio problems need unbounded sets;
    • repair intervals for bounded parameters;
    • ask what coverage means for the data in hand.

Built in this part:

  • statkit.testing (explainer/stats/kit/testing.py), tested in tests/test_stats_kit_testing.py:
    • Behrens–Fisher: Welch–Satterthwaite degrees of freedom; Behrens–Fisher fiducial critical values by quadrature; sizes of the pooled t, Welch and fiducial tests. Part-local stable convolution quadrature conditions on the larger weighted t scale and is checked against an independent simulation.
    • Binomial tests:
      • randomized UMP one-sided tests;
      • the UMPU two-sided test (two side conditions, solved exactly);
      • the equal-tailed test;
      • the generalized Neyman–Pearson lemma as a linear programme.
    • Neyman structure: the conditional two-binomial test, randomized to be similar, with its unconditional size at every nuisance value.
    • Likelihood ratio on a boundary: Chernoff's χ̄² critical value.
    • Confidence sets:
      • Clopper–Pearson sets and Wald intervals with exact coverage;
      • Fieller's sets (bounded, two rays, or all of ℝ);
      • Feldman–Cousins unified intervals and flip-flopping limits, with exact Poisson coverage.
    • Simultaneous inference: closed testing with Bonferroni (Holm) or Simes (Hommel) local tests; Scheffé's multiplier.
    • Conditional inference and evidence: Buehler-style recognizable subsets for the n = 2 t interval; Berger–Sellke bounds at specified prior odds and a −e p log p calibration for a uniform-null/beta-mixture-alternative p-value model.
    • Goodness of fit: Kolmogorov–Smirnov with estimated parameters (Lilliefors).
  • The Neyman-structure visualizer (NeymanSlices in explainer/stats/viz.py), the part's instrument. For each value of a sufficient statistic for the nuisance parameter, it draws the conditional null distribution as bars, with the part the test rejects painted over them: each slice spends exactly α, so the test is similar.

Data.

  • From the Museum:
    • Old Faithful's eruptions (split by the recorded wait to the next eruption);
    • ISIS-2's vascular deaths;
    • the lady tasting tea;
    • Bliss's beetles.
  • Feldman and Cousins's published Table IV (90% intervals, b = 0) is reproduced to grid/rounding precision. The original Table II is for 68.27%. Their published tables also enlarge selected intervals to enforce monotonicity across backgrounds; this part displays the raw likelihood-ratio ordering without that extra correction. Thus at b = 3, n = 0 the plotted endpoint is about 0.95, whereas published Table IV gives 1.08.
  • The rest is exact arithmetic or seeded simulation.

The Coverage Board gains eight rows. Each uses 20,000 independent datasets and the empirical Bernoulli Monte Carlo SE, rather than a nominal-probability reference SE. The table reports estimates, not exact population probabilities:

Method Setting Nominal Achieved Verdict
pooled t test (size) n = 5 (SD 3) vs n = 25 (SD 1) 5% 30.2% broken
Welch's test (size) same 5% 5.3% kept
Behrens–Fisher test (size) same 5% 4.8% kept
delta-method interval for a ratio denominator mean 0.5, SE 1 95% 78.1% broken
Fieller's set for a ratio same 95% 95.2% kept
flip-flopping Poisson limits background 3, μ = 2.34 90% 85.5% broken
Feldman–Cousins limits same 90% 92.4% conservative
KS test, estimated mean and SD (size) normal data, n = 20 5% 0.01% conservative
Chapter notes
# Chapter Numbers
0 The Behrens–Fisher problem pooled size 30% or 0.06%; Welch ≈ 5%; Old Faithful t = 39.5 on 196 df
1 The Neyman–Pearson lemma Bin(20), p = .3 vs .5: reject x ≥ 10, and x = 9 w.p. 0.031; sizes 4.8% / 11.3% without
2 MLR and Karlin–Rubin Cauchy ratio peaks at x = 1.6 and returns to 1
3 Unbiased tests and Neyman structure UMPU: reject x < 2 or > 10 (γ = 0.69, 0.19); equal tails dip to 4.99%; ISIS-2 z = −5.22
4 Invariance power at μ/σ = 0.5: z 0.47, t 0.43, sign 0.34
5 The likelihood ratio test Poisson 95% point 3.74 vs 3.84; boundary: 50% zeros, size 2.5% → 4.9% with 2.71
6 Confidence sets by inversion Clopper–Pearson ≥ 95.8%; Wald down to 9.5%
7 Impossibility β = 0.5: Fieller 95.2% (68% all of ℝ); delta 78%; Bliss LD50 1.772
8 Bounded parameters b = 3, n = 0: FC [0, 0.95]; classical −0.70; flip-flop 85.5%
9 Simultaneous inference k = 20: Scheffé 5.60, Bonferroni 3.02; Holm rejects 1, Hommel 4
10 Conditional inference 50% t interval: 61–86% on the recognizable set
11 p-values and evidence p = 0.05: P(H₀ | x) ≥ 0.128 (all), 0.290 (unimodal), 0.321 (normal)
12 Goodness of fit Pearson 95% point 11.0 vs 11.07; KS table 0.294 vs correct 0.192 (n = 20)
13 Outro —

The rest of the part's numbers, chapter by chapter:

  • Hook.
    • Sizes at nominal 5%, as pooled / Welch / Behrens–Fisher (20,000 data sets each):

      Setting Pooled Welch Behrens–Fisher
      10 vs 10, equal SDs 5.0% 4.9% 3.8%
      10 vs 10, SDs 1 and 3 5.8% 5.0% 4.4%
      5 (SD 3) vs 25 (SD 1) 30.0% 5.6% 5.1%
      25 (SD 3) vs 5 (SD 1) 0.06% 4.6% 3.1%
    • The fiducial critical value for n = 5, 25 runs from 2.06 (t₂₄) to 2.78 (t₄) as φ goes from 0° to 90°.

    • Old Faithful: eruptions followed by waits under 70 minutes last 2.13 minutes (n = 103, SD 0.46); before longer waits, 4.31 (n = 169, SD 0.41). The model-based Welch 95% CI for the difference is [2.07, 2.29]. This is a descriptive time-series association; treating the two groups as independent normal samples is an additional assumption.

  • Chapter 1.
    • The lemma, its one-line proof and necessity.
    • Randomization: Bin(20), H₀ p = 0.3 vs p = 0.5. The test is c = 9, γ = 0.031.
    • The same test is UMP against every p > 0.3.
    • The generalized lemma (Dantzig & Wald 1951) is a linear programme; existence follows from weak-* compactness.
  • Chapter 2.
    • MLR in exponential families, U(0, θ), the noncentral t, χ², F and the hypergeometric.
    • Karlin–Rubin.
    • No UMP two-sided test exists.
    • For one Cauchy observation, the locally most powerful test rejects on a bounded interval.
  • Chapter 3.
    • Smooth two-sided unbiasedness implies β(θ₀) = α and β′(θ₀) = 0; those side conditions alone do not establish global unbiasedness. Differentiating in the natural parameter gives β′ = Cov(T, φ). The UMPU binomial test has c₁ = 2, c₂ = 10, γ₁ = 0.693, γ₂ = 0.192.
    • The LP reproduces its power: 0.3345 at p = 0.15 and 0.4459 at p = 0.5.
    • Neyman structure: X ~ Bin(8, p₁), Y ~ Bin(10, p₂), sliced at totals 4, 9, 13. The randomized one-sided conditional test has rejection probability exactly 5% at every common p; Fisher's exact test has size at most 1.8%.
    • ISIS-2: 804 aspirin deaths against 909.3 expected given 1,820, so z = −5.22 and one-sided P ≈ 1.0 × 10⁻⁷.
    • The tea: 1/70 = 0.0143.
    • The t test is UMPU (Lehmann 1959).
  • Chapter 4.
    • Maximal invariants. The t test is UMP among scale-invariant tests; its power at μ/σ = 0.5 with n = 10 is 0.427, against 0.475 for z (σ known) and 0.336 for the sign test.
    • Hunt–Stein (1946): under the invariant testing problem’s averaging/compactness assumptions, amenability permits reduction of the relevant worst-case criterion to invariant tests. Scalar positive affine transformations are amenable; a general multivariate affine group need not be.
    • For a fixed full-rank design and independent spherical normal errors, the F test is UMP invariant under the specified linear-model symmetry group (Hsu 1941) and most stringent (Wald 1942).
  • Chapter 5.
    • Wilks (1938), for regular fixed-dimensional identifiable models, nonsingular information, consistent maxima and a smooth null submanifold. Its quadratic is the distance between constrained and unrestricted fits in the constrained directions, not the full unrestricted estimation error. Poisson n = 10, λ₀ = 2: quantiles 0.47 / 2.80 / 3.74 / 7.05 vs χ²₁'s 0.45 / 2.71 / 3.84 / 6.63; size 4.3%.
    • Chernoff (1954): ½χ²₀ + ½χ²₁, with 50.0% exact zeros. Size 2.5% with 3.84, 4.9% with 2.71.
    • Self & Liang (1987): boundary limits depend on the cone and nuisance geometry. A half-χ² approximation applies to suitable single-variance-component problems, not every boundary problem.
    • Failures: certain unrestricted mixtures (Hartigan 1985), change points (Davies 1977), growing dimension (Part 59).
  • Chapter 6.
    • Neyman's inversion. The Clopper–Pearson belt (n = 20): at p = 0.3 the acceptance region is x = 2, …, 10; at x = 6 the interval is [0.119, 0.543].
    • On the displayed p grid, the minimum is 95.8% for Clopper–Pearson and 9.5% for Wald. Clopper–Pearson is globally at least 95%; Wald coverage has infimum zero as p approaches an endpoint. The grid does not certify global numerical extrema.
    • Inverting UMP/UMPU tests gives UMA/UMA-unbiased sets within the corresponding class. Discrete nonrandomized Clopper–Pearson bounds are conservative and need not be strictly optimal among randomized bounds. Pratt (1961): expected length = ∫ P(θ′ ∈ C) dθ′.
  • Chapter 7.
    • Fieller's exact pivot assumes jointly normal estimates, known positive definite covariance, and a nonzero true denominator. The quadratic gives bounded sets, two rays, or the whole line, and a half-line on a zero-probability transition. The implementation checks that transition explicitly.
    • a ~ N(1, 1), b ~ N(β, 1), at β = 4 / 2 / 1 / 0.5:
      • Fieller's set is bounded 98% / 51% / 16% / 8% of the time, and covers 95.0% / 95.0% / 95.4% / 95.2%;
      • the delta method covers 97.3% / 96.8% / 93.1% / 78.1%.
    • Gleser & Hwang (1987): in the normal ratio family, limits toward zero numerator and denominator force unbounded sets for uniformly valid procedures. Interval-valued procedures then have infinite expected length; an arbitrary unbounded sparse set need not have infinite Lebesgue measure.
    • Bliss: log₁₀ LD50 = 1.771721, slope z = 11.8. The logistic-model normal approximation and fitted covariance give asymptotic intervals, not exact Fieller coverage. Fieller [1.7639, 1.7792] against delta [1.7642, 1.7793].
    • Weak instruments (Dufour 1997).
  • Chapter 8.
    • Poisson signal plus background b = 3. The classical upper limit at n = 0 is −0.70.
    • Raw Feldman–Cousins likelihood ordering (b = 3), n = 0…10, on a 0.01 signal grid:
      • [0, 0.95], [0, 1.87], [0, 3.03], [0, 4.42], [0, 5.59], [0, 6.98];
      • then [0.16, 8.46], [0.90, 9.53], [1.51, 10.99], [1.88, 12.29], [2.64, 13.50].
    • Flip-flopping switches at n = 9 (b + 3√b). Its exact coverage falls to 85.5% at μ = 2.34; The raw ordering has Poisson-summed coverage at least 90% on the construction grid. The largest omitted Poisson tail at the displayed signals is 3.36 × 10⁻¹². Grid endpoints approximate the continuous construction; no off-grid numerical guarantee is inferred from the plotted curve. The clipped classical n = 0 upper limit is retained as an empty set, including at μ = 0.
  • Chapter 9.
    • Scheffé multipliers (k = 1, 2, 3, 5, 10, 20): 1.96, 2.45, 2.80, 3.33, 4.28, 5.60. Bonferroni: 1.96, 2.24, 2.39, 2.58, 2.81, 3.02.
    • Closed testing on p = (0.011, 0.018, 0.024, 0.040): Bonferroni and Holm reject H₁ only; Hommel (Simes) rejects all four. Bonferroni/Holm allow arbitrary dependence; Simes local tests require valid intersection-level dependence conditions, such as independence or suitable positive regression dependence.
    • Partitioning; gatekeeping.
  • Chapter 10.
    • Welch's uniform example.
    • Buehler (1959). For the n = 2 50% t interval on {|x̄|/s ≤ 1 + √2}, at μ/σ = 0, 0.25, 0.5, 1, 2, 4:
      • coverage 61.1%, 61.4%, 62.6%, 66.0%, 74.4%, 85.9%;
      • share of samples in the set 82%, 81%, 78%, 67%, 42%, 11%.
    • Independent normal/half-normal quadrature validates the displayed conditional probabilities. The six settings do not establish global extrema; the normal-model recognizable set B is not ancillary.
    • Robinson (1979). Exact posterior content under a proper prior rules out a uniform conditional-content gap on a data event of positive prior-predictive probability; this is not a statement about every vaguely Bayesian interval. Observed information is not generally ancillary.
  • Chapter 11.
    • Berger–Sellke lower bounds on P(H₀ | x), as all g / symmetric unimodal / normal / calibration:

      p All g Symmetric unimodal Normal Calibration
      0.1 0.205 0.389 0.412 0.385
      0.05 0.128 0.290 0.321 0.289
      0.01 0.035 0.109 0.133 0.111
      0.001 0.0044 0.018 0.024 0.018
    • The last column converts a Bayes-factor calibration B into B/(1+B), at equal prior odds. The beta-mixture derivation requires a continuous uniform null p-value and a mixture of Beta(ξ, 1), 0 < ξ < 1 alternatives; an arbitrary decreasing p-value density does not suffice.

    • At p = 0.05, optimizing over all normal-model alternative priors permits odds about 6.83:1 against H₀; symmetric unimodal priors permit about 2.45:1. Changing the prior null probability changes posterior odds.

    • Sellke–Bayarri–Berger (2001).

    • Lindley's paradox (Part 15); the ASA (2016); Benjamin et al. (2018).

  • Chapter 12.
    • Pearson's χ² limit by projection. A die, 60 rolls: quantiles 4.40 / 9.20 / 11.0 / 15.2 vs 4.35 / 9.24 / 11.07 / 15.09; size 4.8%.
    • Fisher (1924); Chernoff & Lehmann (1954).
    • Lilliefors (1967): with the table's critical values 0.294 (n = 20) and 0.134 (n = 100), the size is 0.01–0.02%. The simulated 95th percentiles are 0.192 and 0.089. The rare naive-test rejection counts are 3/40,000 and 4/20,000, so those percentages have substantial relative Monte Carlo uncertainty.
    • Durbin (1973): for continuous F the empirical-CDF limit is B(F(x)); the KS limit is a supremum absolute value. Fitting parameters adds an estimator-dependent correction, with a projection interpretation under efficient regular estimation. The grouped/raw-data χ² comparison also requires the stated regular efficient estimates and fixed positive-probability bins.

Companion material in this repository

The syllabus's plan for this partfrom SYLLABUS.md, the plan of record
  1. Hook: the Behrens–Fisher problem. Fisher's fiducial answer, Neyman's objection, Welch; Linnik's theorem (1968).
  2. The Neyman–Pearson lemma in general. Existence (weak-* compactness), necessity, the generalized lemma (Dantzig & Wald 1951; Part 21).
  3. MLR and Karlin–Rubin.
  4. UMPU tests. Similarity and Neyman structure; exponential families; the t-test's optimality proved.
  5. Invariance. Maximal invariants; the Hunt–Stein theorem.
  6. The LRT. Wilks proved under conditions; Chernoff (1954) on boundaries; Self & Liang.
  7. Confidence sets. Uniformly most accurate sets by inverting UMP tests (BeltConstruction); unbiased sets.
  8. Impossibility. Gleser & Hwang (1987): Fieller-type problems need infinite intervals.
  9. Bounded parameters. Feldman & Cousins (1998) (Board).
  10. Simultaneous inference. Scheffé's projections; closed testing (Marcus, Peritz & Gabriel 1976); partitioning.
  11. Conditional inference. Recognizable subsets (Buehler 1959); Welch's example; ancillary conditioning.
  12. p-values and evidence. Berger & Sellke (1987); calibration.
  13. Goodness of fit, rigorously. Pearson's χ² limit; KS with estimated parameters (Part 48).
  14. Outro.

Built: a Neyman-structure visualizer. Books: Lehmann & Romano; Shao; Schervish.

Build the film

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

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

Build it
OMP_NUM_THREADS=1 python -m videos.stats.stats46.compute   # once (a few minutes)
python tools/build.py stats46 -q l                         # fast 480p preview
python tools/build.py stats46                              # 1080p30 -> renders/stats46.mp4
python tools/qa_scene.py stats46 UMPU
python tools/lecture_length.py stats46 --floor 50