The Neyman-Pearson Lemma and Most-Powerful Tests
Anchor (Master): Lehmann & Romano 2005 Testing Statistical Hypotheses (3rd ed., Springer) Ch. 3 (most powerful tests, generalized Neyman-Pearson, randomization); Casella & Berger 2002 Statistical Inference §8.3
Intuition Beginner
A hypothesis test is a rule for deciding between two stories about where your data came from. Maybe a coin is fair, or maybe it is biased. Maybe a new drug does nothing, or maybe it helps. You collect data, and you need a rule that turns the data into one of two verdicts: reject the first story, or do not reject it. The question this unit answers is: among all such rules, which one is the best, and what does "best" even mean?
Any rule can make two kinds of mistake. You can reject the first story when it was true (a false alarm), or fail to reject it when the second story was real (a missed detection). With limited data you cannot drive both to zero at once. So the standard move is to cap the false-alarm rate at a small number you choose, like 5 in 100, and then make the missed-detection rate as small as possible.
The chance of correctly catching the second story when it is true is called the power of the test. So the goal becomes: among all rules whose false-alarm rate is at most your cap, pick the one with the highest power. Such a rule is called most powerful.
The remarkable answer, found by Neyman and Pearson, is that for the simplest case — one specific first story against one specific second story — the best rule has a single clean form. You compare how likely your data are under the second story versus the first, forming a ratio, and you reject when that ratio is large enough. Nothing more clever beats it.
Visual Beginner
Figure: two bell-shaped density curves on one data axis. The left curve is the data distribution if the first story (the null) is true; the right curve is the distribution if the second story (the alternative) is true. A vertical cutoff sits between them, and data to its right make you reject the first story. The left-curve area past the cutoff is the false-alarm rate (the size); the right-curve area past the cutoff is the power. Sliding the cutoff left raises both areas; sliding it right lowers both. The Neyman-Pearson rule places the cutoff where the false-alarm area equals your chosen cap, and there the power is as large as it can be.
density
| null story alternative story
| (story 1) (story 2)
| .-. .-.
| / \ / \
| / \ cutoff / \
| / \ | / \
| / \ | / \
| / \. | ./ \
| / \. | ./ \
+---------------------------------------------------> data
|<--- reject story 1 (data here) --->
left-of-curve area right of cutoff = false-alarm rate (size)
right-of-curve area right of cutoff = power
Worked example Beginner
A factory line produces rods whose length scatters around a target with a known wobble. Under the current setting the average length is ; a worry is that the line has drifted to . You measure one rod, getting a value , and the wobble has standard deviation . You want to test "the average is " against "the average is ", with a false-alarm cap of about in .
Step 1. Which way should the rule point? The drifted setting pushes lengths higher, so a large is evidence for . The rule will reject "average is " when is bigger than some cutoff .
Step 2. Set the cutoff from the false-alarm cap. If the true average is , then is centered at with spread . We want the chance that exceeds to be in . The value that leaves in in the upper tail of a bell curve sits about spreads above center, so .
Step 3. Compute the power. If the true average is really , then is centered at with spread . The power is the chance exceeds . That is spreads above the alternative center, and the upper-tail area past is about .
What this tells us. With a single rod the test rejects only about times in when the line truly drifted — a weak test, because one measurement barely separates a center of from a center of . The fix is more data: averaging many rods shrinks the spread, pushes the two bell curves apart, and drives the power up. The shape of the rule, though, never changes: reject when the measurement is large enough.
Check your understanding Beginner
Formal definition Intermediate+
Fix a sample space and a family of probability measures on it (the measure-theoretic setting of 37.01.01). A hypothesis-testing problem partitions into a null and an alternative . A hypothesis is simple if its parameter set is a singleton and composite otherwise.
Definition (test function). A (possibly randomized) test is a measurable function ; on observing one rejects the null with probability (drawing an independent coin). A non-randomized test takes values in and corresponds to a rejection region . Randomization is the price of achieving an exact error level when the data law has atoms.
Definition (power function, size, level). The power function of is
the probability of rejection at . The size of is . The test has level if its size is at most . The type I error at is (rejecting a true null); the type II error at is (failing to reject a false null). For an alternative , is the power at .
Definition (most powerful test). Within the class of level- tests for against , a test is most powerful (MP) at if for every level- test . When and are both simple, an MP test is just one maximizing power among all with [Casella & Berger §8.3.2].
Definition (likelihood ratio and the Neyman-Pearson test). Let be densities of with respect to a common dominating measure (e.g. , by Radon-Nikodym; the likelihood object of 45.01.02). The likelihood ratio is (set where ). A Neyman-Pearson (NP) test with critical value and randomization is
The test rejects when the data are sufficiently more likely under than under , breaking ties on the boundary with a coin of probability .
Counterexamples to common slips
- Size is a supremum over the null, not the value at one point. For a composite null, capping at one is not enough; the size is , and a test can have small power at one null point yet exceed elsewhere on .
- Randomization is not optional for exact size with atoms. For discrete data (binomial, Poisson) the attainable non-randomized sizes are a finite set; the cutoff alone cannot hit an arbitrary , and the boundary probability is what makes exactly. Without it the NP lemma's "most powerful at exactly level " claim fails.
- The likelihood ratio thresholds , not . Rejecting when the ratio is small gives the worst test, not the best. The reject region is where the alternative outvotes the null.
Key theorem with proof Intermediate+
The fundamental lemma has three parts: an NP test is most powerful at its level (sufficiency), such a test exists at every level (existence with randomization), and every most-powerful test is an NP test off the boundary (necessity).
Theorem (Neyman-Pearson fundamental lemma). Let versus be simple, with densities relative to , and fix .
(i) (Existence.) There exist and such that the NP test has size exactly : .
(ii) (Sufficiency.) Any NP test with is most powerful at level for against .
(iii) (Necessity.) If is most powerful at level , then is an NP test: there is a with when and when , for -almost every (it may differ from only on the boundary ). Unless there is a level- test of power , also has size exactly .
Proof of (i). Define for , where . As a survival function of under , is nonincreasing and right-continuous, with and . If take effectively (reject only where ); assume . Choose
By right-continuity . Put the leftover mass on the boundary: set
when , and otherwise (then already). Then and
so the NP test has size exactly .
Proof of (ii). Let have , and let be any test with . Consider the pointwise product
Indeed, where the test , so the first factor is and the second is ; where the test , so the first factor is and the second is ; where the second factor vanishes. Integrating the inequality against ,
Rearranging, , since and . Hence : is most powerful.
Proof of (iii). Let be MP at level , and let be the size- NP test from (i). By (ii) is MP, so (both maximal). Re-examine the integral in (ii) with the roles of and : the integrand is everywhere , yet its integral is (the first bracket vanishes; the second is since , multiplied by and subtracted). A nonnegative integrand with integral is zero -almost everywhere, so a.e. On the set this forces , i.e. where and where ; thus is an NP test, possibly differing from only on the boundary. Finally, if then unless ; but makes reject wherever , giving power . So outside that degenerate case has size exactly .
Bridge. This lemma builds toward the one-sided composite theory of 45.02.02, where a single likelihood-ratio threshold is uniformly optimal across a whole family, and it appears again in the likelihood-ratio and uniformly-most-powerful constructions throughout testing. This is exactly the decision-theoretic Bayes rule of 45.01.01 for the two-action problem under weighted 0-1 loss: thresholding at is choosing the action of smaller posterior expected loss, with encoding the loss ratio and the prior odds, so the most powerful test and the Bayes test are one object viewed through two principles. The central insight is that optimizing a linear functional (power) subject to one linear constraint (size) has an extremal solution of bang-bang form — reject fully, abstain fully, randomize only on the boundary — which is the foundational reason the optimal test is a thresholded ratio rather than anything smoother. Putting these together, sufficiency and necessity pin the MP test to the likelihood-ratio family up to boundary behaviour, and existence supplies the boundary randomization that hits an arbitrary even with atoms; the bridge is the variational inequality , which generalises in the master section to the multi-constraint generalized lemma.
Exercises Intermediate+
Advanced results Master
The generalized Neyman-Pearson lemma
The single-constraint lemma extends to several side constraints. Let be -integrable functions on , and seek a test maximizing subject to for . If there exist constants and a test satisfying the constraints with
then maximizes among all tests meeting the constraints; if moreover all , the constraints may be relaxed to [Lehmann & Romano §3.5]. The proof is the same variational identity: for any competing , and the constraints make the -terms cancel. Setting , , , recovers the fundamental lemma; the multiplier is the Lagrange multiplier of the size constraint. This is the testing instance of Lagrangian duality: the most powerful test is the unconstrained maximizer of power minus times size, with tuned so the size constraint binds at .
Monotone likelihood ratio and the route to composite alternatives
A family has monotone likelihood ratio (MLR) in a statistic if for every the ratio is a nondecreasing function of . One-parameter exponential families with increasing have MLR in [Casella & Berger §8.3.2]. When MLR holds, the NP test built for a single pair with has a rejection region that does not depend on the particular — only on its being above . This is the mechanism by which a most-powerful-for-one-alternative test becomes uniformly most powerful for the whole one-sided family , the Karlin-Rubin theorem developed in 45.02.02. The fundamental lemma thus does double duty: it is both the simple-vs-simple optimum and, through MLR, the engine of the composite one-sided theory.
The p-value, its null distribution, and the duality with confidence sets
For a test statistic with continuous null distribution, the p-value (large extreme) is under , so "reject when " has size exactly and the p-value reports the smallest level at which the data reject. With atoms the p-value is stochastically larger than uniform — — so the naive p-value test is conservative, and exact size requires randomization exactly as in the discrete NP construction. Inverting a level- test family gives a confidence set ; the most-powerful-test optimality transfers to a corresponding optimality of the dual interval, the link that organizes the rest of the chapter. The p-value is not the probability that is true; it is a tail probability computed under , and its calibration is the uniform-distribution fact.
Tests as a decision problem: the Bayes reading
Casting versus as a two-action problem with action space accept, reject and loss , , zero for correct decisions, the Bayes risk under a prior is . Minimizing pointwise (the posterior-expected-loss device of 45.01.01) rejects exactly when , i.e. when with . The Bayes test is an NP test, and as range over their values the Bayes tests trace the whole most-powerful family — the size-power frontier is the lower boundary of the convex risk set of tests, its supporting hyperplanes the priors-times-losses. Admissibility of NP tests with (Exercise 8) is the testing case of the admissibility-of-unique-Bayes-rules theorem.
Synthesis. The central insight is that an optimal test maximizes a linear functional (power) under linear constraints (size), so its solution is extremal — bang-bang on the likelihood ratio, randomizing only on the boundary — and this single variational principle is exactly what the fundamental lemma, its generalized multi-constraint form, and the Bayes/decision-theoretic reading all express. The foundational reason the likelihood ratio is privileged is that is the Lagrange multiplier of the size constraint, so thresholding is dual to the constrained optimization; the same multiplier reappears as the prior-times-loss odds in the Bayes test of 45.01.01, identifying the most powerful test with the Bayes rule. Putting these together, monotone likelihood ratio lifts the simple-vs-simple optimum to the uniformly-most-powerful one-sided test of 45.02.02, because the rejection region is alternative-free, and the p-value's uniform null distribution generalises the exact-size guarantee from a single threshold to the whole calibrated reporting scale. The size-power frontier is the lower boundary of the convex risk set of randomized tests, so admissibility, the complete-class structure, and the minimax-Bayes duality of decision theory specialize here verbatim; the bridge across the whole chapter is the test-inversion duality that turns this optimality into optimal confidence sets, where these same objects appear again in interval estimation.
Full proof set Master
Proposition 1 (existence and uniqueness of the critical value). Let and . There is a unique and a (unique when ) such that .
Proof. The survival function is nonincreasing and right-continuous with and as . Set , finite because . Right-continuity gives , while by definition of the infimum. Thus , and the gap . If this gap is , then and is irrelevant; otherwise is the unique solution. Uniqueness of : any has so cannot give size with ; any has forcing to reach unless on a flat stretch, which the infimum excludes as the canonical choice.
Proposition 2 (the fundamental variational identity). For any two tests and any ,
and if is an NP test the integrand is pointwise.
Proof. Linearity of the integral and give the displayed equation directly. For the sign: where the NP test has , the maximum, so while ; where , , so while ; where the second factor is . In every case the product is .
Proposition 3 (sufficiency: NP is MP). If has size and has size , then .
Proof. By Proposition 2 the integral , so , using and .
Proposition 4 (necessity: MP is NP a.e.). If is MP at level and is the size- NP test, then on up to a -null set.
Proof. Both maximize power, so . By Proposition 2 applied with the pair , the integral equals since and . But the integrand is pointwise (Proposition 2), so its integral is ; hence the integral is and the nonnegative integrand vanishes -a.e. On the factor , forcing there a.e.
Proposition 5 (uniform distribution of the p-value under a continuous null). Let have continuous distribution under , with survival function , and define . Then under .
Proof. Continuity of the law of makes continuous; on the support is nonincreasing with range . For let ; continuity gives . Then (up to the null event , which has probability ), so . Thus the cdf of is the identity on .
Connections Master
The one-sided composite theory of uniformly most powerful tests
45.02.02is the direct continuation: when the family has monotone likelihood ratio in a sufficient statistic, the single-pair Neyman-Pearson rejection region is alternative-free and therefore uniformly most powerful for , so the lemma proved here is the generating case of the Karlin-Rubin theorem.Statistical decision theory
45.01.01supplies the frame in which the most powerful test is the Bayes rule for the two-action problem under weighted 0-1 loss; the critical value is the prior-times-loss odds ratio, the size-power frontier is the lower boundary of the convex risk set of tests, and admissibility of NP tests is the testing instance of the admissibility of unique Bayes rules.Sufficiency and the factorization theorem
45.01.02guarantee that the likelihood ratio, hence the most powerful test, depends on the data only through a sufficient statistic; the exponential-family structure that makes the worked normal and exponential examples tractable is the same structure that produces monotone likelihood ratio downstream.The measure-theoretic foundations
37.01.01underwrite every object here: a test is a measurable -valued function, size and power are integrals of it against the parameter-indexed measures, the likelihood ratio is a Radon-Nikodym derivative with respect to a common dominating measure, and the boundary-randomization construction is an explicit handling of the atoms those measures may carry.
Historical & philosophical context Master
The framework is due to Jerzy Neyman and Egon Pearson, whose 1933 paper On the problem of the most efficient tests of statistical hypotheses [Neyman & Pearson 1933] (Phil. Trans. R. Soc. Lond. A 231, 289-337) introduced the two-error formulation, the power function, and the fundamental lemma, deliberately breaking with R. A. Fisher's significance-testing program by insisting that a test be judged against a specified alternative and by its operating characteristics rather than by a single p-value. The Neyman-Pearson program reframed testing as a behavioral rule with controlled long-run error rates, a stance Neyman defended as "inductive behavior" against Fisher's "inductive inference"; the resulting dispute over the meaning of a test ran for decades and still structures the frequentist-Bayesian and Fisher-Neyman debates in the foundations of statistics.
Abraham Wald's decision-theoretic synthesis [Lehmann & Romano §3.1] (1950) absorbed the lemma as the Bayes rule of a two-action problem, and Erich Lehmann's Testing Statistical Hypotheses (1959; 3rd edition with Joseph Romano, 2005) became the canonical development, extending the lemma through the generalized multi-constraint form, monotone likelihood ratio, unbiased and invariant tests, and the test-confidence-set duality. The randomization device, an artifact of insisting on exact size for discrete data, was contributed by the Neyman-Pearson formulation itself and remains the cleanest illustration of why test functions, not rejection regions, are the right primitive object.
Bibliography Master
@article{neymanpearson1933problem,
author = {Neyman, Jerzy and Pearson, Egon S.},
title = {On the problem of the most efficient tests of statistical hypotheses},
journal = {Philosophical Transactions of the Royal Society of London. Series A},
volume = {231},
pages = {289--337},
year = {1933}
}
@book{lehmannromano2005testing,
author = {Lehmann, Erich L. and Romano, Joseph P.},
title = {Testing Statistical Hypotheses},
edition = {3rd},
series = {Springer Texts in Statistics},
publisher = {Springer},
year = {2005}
}
@book{casellaberger2002statistical,
author = {Casella, George and Berger, Roger L.},
title = {Statistical Inference},
edition = {2nd},
publisher = {Duxbury},
year = {2002}
}
@book{lehmanncasella1998theory,
author = {Lehmann, Erich L. and Casella, George},
title = {Theory of Point Estimation},
edition = {2nd},
series = {Springer Texts in Statistics},
publisher = {Springer},
year = {1998}
}
@book{wald1950statistical,
author = {Wald, Abraham},
title = {Statistical Decision Functions},
publisher = {Wiley},
year = {1950}
}