Quant Memo
Advanced

The Neyman-Pearson Lemma

The answer to a very practical question: given a fixed budget of false alarms, which test catches the most real signals? Rank the evidence by a likelihood ratio and act on the top of the list — nothing else can do better.

Prerequisites: Hypothesis Testing, Type I and Type II Errors

Every test makes two kinds of mistake: it can shout when nothing is there, and stay quiet when something is. With a fixed amount of data you cannot drive both to zero — tightening one loosens the other. So the honest way to set a test up is to fix the false-alarm rate you can live with and then ask a sharper question: among all tests with that false-alarm rate, which one catches the most real signals? That question has an exact answer, and it is one formula: the Neyman-Pearson lemma.

An analogy: the customs officer

A customs officer can search 5% of arriving passengers. Not 6% — the queue would collapse. Within that budget she wants to find as much contraband as possible.

She could search every fifth passenger, or everyone whose surname begins with M. Both stay inside budget and both are terrible. What she actually does is score each passenger by a ratio: how likely is this behaviour if they are smuggling, divided by how likely if they are innocent? Then she sorts by that score and searches from the top until the budget runs out.

That is the entire lemma. The score is the likelihood ratio, the budget is the false-alarm rate, and the surprising claim is that no other rule with the same budget catches more. Not a cleverer rule, not a machine-learned one. This is optimal.

The pieces, one symbol at a time

The setting is deliberately narrow: two fully specified possibilities, no vagueness on either side. Call them the null H0H_0 (theta equals θ0\theta_0) and the alternative H1H_1 (theta equals θ1\theta_1).

Write L(θ;x)L(\theta; x) for the likelihood — how probable the data xx you actually saw would be if θ\theta were the truth. Then the likelihood ratio is

Λ(x)=L(θ1;x)L(θ0;x).\Lambda(x) = \frac{L(\theta_1; x)}{L(\theta_0; x)} .

In plain English: how much better does the alternative explain what I saw than the null does? A value of 10 means the data are ten times more probable under the alternative. A value of 0.2 means the null explains them five times better.

Two more names. The size α\alpha (alpha) is the false-alarm rate: the probability of rejecting the null when the null is in fact true. The power is the probability of rejecting the null when the alternative is true — the fraction of real signals you catch.

The lemma says: among all tests with size at most α\alpha, the most powerful one rejects H0H_0 exactly when

Λ(x)>k,\Lambda(x) > k ,

with the cutoff kk set so that the false-alarm rate comes out at α\alpha.

In plain English: compute the ratio and reject whenever it exceeds a threshold chosen to spend your whole false-alarm budget. Nothing else does better. This is where the The Likelihood Ratio Test comes from, and why likelihood sits at the centre of statistics — it is not a convention, it is provably the right thing to rank by.

cutoff if H₀ is true if H₁ is true α = 5% missed = 20% sample mean → reject H₀ to the right of the cutoff
Slide the cutoff right and false alarms shrink while misses grow; slide it left and the reverse. The lemma does not remove that trade-off — it guarantees that ranking by the likelihood ratio gives the smallest possible miss rate for whatever false-alarm rate you chose.

Fix the false-alarm rate you can afford, then rank the evidence by the likelihood ratio and reject from the top down. Among every test with that same false-alarm rate, this one catches the most real signals. There is no cleverer rule waiting to be found.

Worked example 1: five coin flips

A counterparty claims a coin is fair; you suspect it is loaded toward heads. Test H0:p=0.5H_0: p = 0.5 against H1:p=0.8H_1: p = 0.8 with five flips, at a false-alarm budget of α=0.05\alpha = 0.05.

Step 1 — score every outcome. With kk heads out of 5, the likelihood ratio is

Λ(k)=0.8k0.25k0.55.\Lambda(k) = \frac{0.8^k\, 0.2^{5-k}}{0.5^5} .
heads kkΛ(k)\Lambda(k)P(k)P(k) if fair
510.490.031
42.620.156
30.660.313
20.160.313
10.040.156
00.010.031

Step 2 — fill the budget from the top. The highest-ranked outcome is five heads, which happens 1/32=0.0311/32 = 0.031 of the time under a fair coin. That fits inside 0.05. Adding the next outcome down would take the total to 6/32=0.1886/32 = 0.188, far over budget. So the test is: reject only on five heads.

Step 3 — measure the power. If the coin really is 80% heads, five heads happens with probability 0.85=0.3280.8^5 = 0.328. So this test catches about a third of genuinely loaded coins.

Step 4 — see why the ranking matters. Take a different test with the same false-alarm rate: reject on zero heads. Its size is also 1/32=0.0311/32 = 0.031, perfectly legitimate. Its power is 0.25=0.000320.2^5 = 0.00032 — one loaded coin in three thousand instead of one in three. Both tests are valid; only one is sensible, and the likelihood ratio is what separates them.

In the explorer below, n=5n = 5 and p=0.5p = 0.5 shows how rare five heads is under the null; drag pp to 0.8 and the same bar becomes the most likely outcome. The ratio of those two bar heights is Λ(5)\Lambda(5).

Distribution · binomial
mean 2.5012345outcomes (k) →
mean 2.50std dev 1.12peak at k = 2

Worked example 2: a mean return, and the cost of hedging both sides

You have 25 daily returns with known standard deviation σ=1%\sigma = 1\%. Test H0:μ=0H_0: \mu = 0 against H1:μ=0.5%H_1: \mu = 0.5\% at α=0.05\alpha = 0.05.

Step 1 — reduce the ratio. For normal data the likelihood ratio increases whenever the sample mean xˉ\bar{x} increases, so "reject when Λ>k\Lambda > k" is the same rule as "reject when xˉ>c\bar{x} > c". The messy ratio collapses to a threshold on a single familiar number.

Step 2 — find the cutoff. The standard error of the mean is

SE=σn=125=0.2.\text{SE} = \frac{\sigma}{\sqrt{n}} = \frac{1}{\sqrt{25}} = 0.2 .

To leave 5% in the upper tail under the null, put the cutoff 1.645 standard errors above zero:

c=1.645×0.2=0.329.c = 1.645 \times 0.2 = 0.329 .

Step 3 — compute the power. If the truth is μ=0.5\mu = 0.5, the cutoff sits

z=0.3290.50.2=0.855z = \frac{0.329 - 0.5}{0.2} = -0.855

standard errors from that mean, so the chance of landing above it is P(Z>0.855)=0.804P(Z > -0.855) = 0.804. The test catches 80% of real signals.

Step 4 — pay for a two-sided test. Suppose you had run the usual two-sided test instead, splitting the 5% across both tails. The cutoff moves out to 1.96×0.2=0.3921.96 \times 0.2 = 0.392, and the power drops to P(Z>0.54)=0.705P(Z > -0.54) = 0.705. Same data, same false-alarm budget, seven percentage points of power handed over — because half the budget was spent guarding a direction you never cared about. That is the price of not using the most powerful test for the alternative you actually face.

What this means in practice

  • It explains why likelihood is everywhere. Generalised likelihood ratio tests, the chi-square tests inside every regression package, and the theory behind maximum likelihood all trace back here.
  • Signal detection is the same problem. Radar, medical screening, fraud alerts and trade surveillance all rank cases by a likelihood ratio and act on the top. An ROC curve is exactly the power-versus-size trade-off in the figure above.
  • It sharpens experiment design. If you know which alternative matters, a one-sided test aimed at it beats a two-sided test on the same data — worked example 2, in numbers.
  • When it does not apply, it still guides. Real alternatives are usually composite ("the mean is some positive number"). Sometimes one test is optimal against all of them at once, a uniformly most powerful test; when none exists, the likelihood ratio remains the standard starting point.

The classic confusion is hearing "most powerful" as "good". The lemma is a relative statement: this test beats every other test of the same size, against that one specific alternative. It says nothing about whether the power is adequate — the coin test above is most powerful and still misses two loaded coins in three, because five flips is not enough data. Two traps follow. Optimality is tied to the alternative you named, so a test tuned for μ=0.5\mu = 0.5 is not the best test for μ=2.0\mu = 2.0. And the lemma covers simple versus simple only; stretch H1H_1 into a range and a single most powerful test may not exist at all.

Related concepts

Practice in interviews

Further reading

  • Neyman & Pearson, On the Problem of the Most Efficient Tests of Statistical Hypotheses (1933)
  • Casella & Berger, Statistical Inference, sec. 8.3
ShareTwitterLinkedIn