Tutorials › VEE Mathematical Statistics › Neyman–Pearson Lemma and Its Conditions

VEE Mathematical Statistics · Neyman-Pearson Testing · Tutorial 610 of 880

Neyman–Pearson Lemma and Its Conditions

Use likelihood ratios to construct a size-controlled test of two simple hypotheses and identify the test’s power and boundary randomization.

Advanced 12 min read

What You'll Learn

  • State the assumptions and conclusion of the Neyman–Pearson lemma for two simple hypotheses
  • Define a test function and calculate its size and power
  • Construct a rejection rule by ordering outcomes by their likelihood ratios
  • Handle outcomes with zero null probability and likelihood-ratio ties
  • Calculate the randomization probability needed to attain a specified size
  • Recognize when a nonrandomized test cannot use the full size allowance

Why the Likelihood-Ratio Rule Matters

When two fully specified models are being compared, the evidence is not equally informative for every possible outcome. The Neyman–Pearson lemma formalizes a useful principle: for a fixed probability of rejecting the null model when it is true, rank outcomes by how much more likely they are under the alternative than under the null. This gives a test with the greatest power among tests of that size.

The result applies to simple hypotheses: each hypothesis specifies one complete probability distribution. It does not, by itself, give a most powerful test for a composite hypothesis, which allows multiple parameter values within a hypothesis.

Definition: A test of \(H_0\) against \(H_1\) can be represented by a test function \(\phi(x)\), where \(0\leq \phi(x)\leq 1\). After observing \(x\), the test rejects \(H_0\) with probability \(\phi(x)\). A nonrandomized test has \(\phi(x)\) equal to either 0 or 1. The size is \(E_0[\phi(X)]\), the probability of rejection under \(H_0\); the power is \(E_1[\phi(X)]\), the probability of rejection under \(H_1\).

The Lemma and Its Conditions

Suppose the observation \(X\) has density or probability mass function \(f_0\) under \(H_0\) and \(f_1\) under \(H_1\), with both defined relative to the same dominating measure. For discrete outcomes, these are probability masses; for continuous observations, they are densities. The likelihood ratio is the alternative likelihood divided by the null likelihood.

$$ \Lambda(x)=\frac{f_1(x)}{f_0(x)}, \qquad \text{when } f_0(x)>0. $$

A large value of \(\Lambda(x)\) means that the observed outcome is relatively more supportive of \(H_1\) than of \(H_0\). When \(f_0(x)=0\) but \(f_1(x)>0\), the outcome can be treated as having an infinite likelihood ratio: it cannot occur under the null model, but it can occur under the alternative. When \(f_1(x)=0\) and \(f_0(x)>0\), its ratio is zero.

Theorem (Neyman–Pearson lemma): For two simple hypotheses with densities or mass functions relative to a common dominating measure, a test that rejects for sufficiently large values of \(f_1(x)/f_0(x)\), with possible randomization at a boundary likelihood ratio, is most powerful among tests with the same size. In particular, for a target size \(\alpha\), choose a constant \(c\) and a boundary randomization probability \(\gamma\) such that

\(\phi(x)=1\) when \(\Lambda(x)>c\), \(\phi(x)=\gamma\) when \(\Lambda(x)=c\), and \(\phi(x)=0\) when \(\Lambda(x)<c\), where \(0\leq\gamma\leq1\). Choose \(c\) and \(\gamma\) so that \(E_0[\phi(X)]=\alpha\), when exact size \(\alpha\) is attainable. The resulting test has greatest power among all tests whose size is at most \(\alpha\).

The rule includes the infinite- and zero-ratio cases just described. It also explains why a critical region need not be a single upper tail of the observed measurement: the region is an upper set in likelihood-ratio values. The shape of that set depends on the two specified distributions.

Boundary Randomization and the Size Constraint

In a discrete model, the null probability of outcomes can be too coarse to hit a requested size using only reject-or-do-not-reject decisions. A test may reject for every outcome above the boundary ratio and for a fraction of the outcomes tied at the boundary. If the boundary outcome occurs with null probability \(P_0(\Lambda(X)=c)\), the size is

$$ P_0(\Lambda(X)>c)+\gamma P_0(\Lambda(X)=c). $$

Solving this expression for \(\gamma\) gives the randomization probability. In particular, if \(P_0(\Lambda(X)=c)>0\), then

$$ \gamma= \frac{\alpha-P_0(\Lambda(X)>c)} {P_0(\Lambda(X)=c)}. $$

This value is valid when it lies between 0 and 1. Equivalently, select a boundary \(c\) for which

$$ P_0(\Lambda(X)>c)\leq \alpha\leq P_0(\Lambda(X)\geq c). $$

Here is the short derivation: outcomes with ratio above \(c\) are always rejected, contributing \(P_0(\Lambda(X)>c)\) to the null rejection probability. Outcomes tied at \(c\) are rejected with probability \(\gamma\), contributing \(\gamma P_0(\Lambda(X)=c)\). Adding these contributions and setting their sum equal to \(\alpha\) yields the displayed formula. If the likelihood ratio has no probability mass at the boundary, no boundary randomization is needed; the critical value can be chosen to give the desired size when such a value exists.

1
Specify the hypotheses.
Write the null and alternative distributions completely. The lemma compares one specified distribution against another.
2
Form the likelihood ratio.
Calculate \(f_1(x)/f_0(x)\) where \(f_0(x)>0\), and account separately for outcomes with zero probability under one hypothesis.
3
Order outcomes and set the boundary.
Reject first for the largest ratios, choosing the boundary so that the null rejection probability does not exceed the target size.
4
Use a boundary fraction if needed.
If the boundary outcomes have positive null probability, solve for \(\gamma\) to reach the target size exactly.
5
Calculate power under the alternative.
Average the test function using the alternative distribution, not the null distribution.

Worked Applications

Worked Example: Randomizing at a Discrete Boundary

A hypothetical inspection system records one of three labels, \(A\), \(B\), or \(C\). Under \(H_0\), the probabilities are \(0.50\), \(0.30\), and \(0.20\); under \(H_1\), they are \(0.20\), \(0.30\), and \(0.50\), respectively. Construct a Neyman–Pearson test of size \(0.30\) and calculate its power. The distributions are the stated categorical distributions; interest and mortality assumptions are not applicable.

Method. Calculate the alternative-to-null probability ratio for each label, then take the labels with the largest ratios first.

$$ \Lambda(A)=\frac{0.20}{0.50}=0.40,\qquad \Lambda(B)=\frac{0.30}{0.30}=1,\qquad \Lambda(C)=\frac{0.50}{0.20}=2.50. $$

The ordering is \(C\), then \(B\), then \(A\). Rejecting whenever \(C\) occurs uses size \(P_0(C)=0.20\). The remaining size allowance is \(0.30-0.20=0.10\). Since \(P_0(B)=0.30\), the required boundary randomization probability is

$$ \gamma=\frac{0.10}{0.30}=\frac{1}{3}. $$

Thus the test rejects for \(C\), rejects with probability \(1/3\) for \(B\), and does not reject for \(A\). Its size is \(0.20+(1/3)(0.30)=0.30\). Its power is

$$ P_1(C)+\frac{1}{3}P_1(B)=0.50+\frac{1}{3}(0.30)=0.60. $$

Check. The null rejection probability is exactly \(0.30\), and the alternative rejection probability is \(0.60\). The common mistake is to randomize over \(A\), the lowest-ratio label, rather than over \(B\), the boundary label. That would spend size on an outcome less favorable to \(H_1\) while leaving a more favorable outcome unrejected.

Worked Example: A Continuous Likelihood-Ratio Threshold

A hypothetical measurement \(X\) lies in \([0,1]\). Under \(H_0\), \(X\) has a Uniform\((0,1)\) distribution, with density \(f_0(x)=1\). Under \(H_1\), its density is \(f_1(x)=2x\) on \([0,1]\). Find the Neyman–Pearson test of size \(0.25\) and its power. These are the complete model specifications; interest and mortality assumptions are not applicable.

Method. Divide the alternative density by the null density, then find the upper likelihood-ratio region with null probability \(0.25\).

$$ \Lambda(x)=\frac{2x}{1}=2x,\qquad 0\leq x\leq1. $$

Because \(2x\) increases with \(x\), the test rejects for large \(x\). Under the uniform null, \(P_0(X>c)=1-c\). Set this equal to \(0.25\), obtaining \(c=0.75\). The test rejects when \(x>0.75\); the boundary itself has probability zero under these continuous distributions, so boundary randomization is unnecessary.

Under the alternative, the power is the probability that \(X>0.75\):

$$ P_1(X>0.75)=\int_{0.75}^{1}2x\,dx =\left[x^2\right]_{0.75}^{1} =1-(0.75)^2 =1-0.5625 =0.4375. $$

Check. The size is \(1-0.75=0.25\), and the power is \(0.4375\). The common mistake is to use the null probability for power. Under \(H_0\), the rejection probability is \(0.25\); power must instead be calculated by integrating the alternative density over the same rejection region.

Worked Example: An Outcome Impossible Under the Null

A hypothetical monitoring device reports \(A\), \(B\), or \(C\). Under \(H_0\), the probabilities are \(0.60\), \(0.40\), and \(0\); under \(H_1\), they are \(0.20\), \(0.50\), and \(0.30\). Construct a size-\(0.20\) test and calculate its power. The model is categorical with the stated probabilities; interest and mortality assumptions are not applicable.

Method. Include outcomes that are possible under the alternative but impossible under the null, then order the remaining outcomes by their ratios.

Outcome \(C\) has \(f_0(C)=0\) and \(f_1(C)=0.30\), so it can be rejected without increasing the size. For the other outcomes,

$$ \Lambda(A)=\frac{0.20}{0.60}=\frac{1}{3},\qquad \Lambda(B)=\frac{0.50}{0.40}=1.25. $$

Rejecting \(B\) with probability \(0.50\), in addition to always rejecting \(C\), gives size \(0.50(0.40)+0(0.60)+1(0)=0.20\). The corresponding power is

$$ P_1(C)+0.50P_1(B)=0.30+0.50(0.50)=0.55. $$

Check. Under \(H_0\), \(C\) contributes no rejection probability, and the randomized \(B\) contributes \(0.20\). Under \(H_1\), \(C\) contributes \(0.30\) and randomized \(B\) contributes \(0.25\). The common mistake is to divide by the zero null probability for \(C\) and call the ratio an ordinary finite number; it is clearer to handle this outcome separately as an infinite-ratio outcome.

What the Guarantee Does—and Does Not—Say

The lemma’s optimality statement compares tests for the same two simple hypotheses and the same size constraint. It says that no competing test with size at most \(\alpha\) has greater power than the likelihood-ratio test constructed for that size. It does not say that the test has high power for every alternative distribution, or that the null hypothesis is the more plausible one whenever the test does not reject.

For a discrete distribution, a nonrandomized test may be unable to attain size exactly \(\alpha\). If the decision must be deterministic, one can often select the largest likelihood ratios whose total null probability is no greater than \(\alpha\); the resulting size may be below the allowance. The randomized version reaches the requested size when the boundary probability permits it. In an application, whether randomized decisions are operationally meaningful is a separate practical consideration.

Common exam trap: Confusing the likelihood ratio with its reciprocal reverses the ordering. The rule here uses \(f_1/f_0\), so large values favor rejection of \(H_0\) in favor of \(H_1\). If instead a problem defines \(f_0/f_1\), small values favor rejection. Always check the numerator and denominator before deciding which outcomes belong in the rejection region.

Check Your Understanding

For each problem, identify the likelihood-ratio ordering, apply the size constraint, and calculate power where requested.

  1. A categorical observation has probabilities \((0.40,0.40,0.20)\) under \(H_0\) and \((0.10,0.40,0.50)\) under \(H_1\), in the order \(A,B,C\). Find the size-\(0.30\) likelihood-ratio test, including any boundary randomization, and its power. (Answer: Reject \(C\), reject \(B\) with probability \(0.25\), and do not reject \(A\); power \(0.60\).)
  2. Under \(H_0\), \(X\) is Uniform\((0,2)\), with density \(1/2\) on \([0,2]\); under \(H_1\), its density is \(x/2\) on \([0,2]\). Find the size-\(0.20\) rejection region and power. (Answer: Reject for \(X>1.6\); power \(0.36\).)
  3. For outcomes \(A,B,C\), let the probabilities under \(H_0\) be \((0.50,0.25,0.25)\) and under \(H_1\) be \((0.20,0.50,0.30)\). Find the size-\(0.40\) test and power. (Answer: Reject \(B\), reject \(C\) with probability \(0.60\), and do not reject \(A\); power \(0.68\).)
  4. Under \(H_0\), the probabilities of \(A,B,C\) are \((0.70,0.30,0)\); under \(H_1\), they are \((0.10,0.60,0.30)\). Find a size-\(0.15\) test and its power. (Answer: Always reject \(C\), reject \(B\) with probability \(0.50\), and do not reject \(A\); power \(0.60\).)
  5. Under \(H_0\), probabilities for \(A,B,C\) are \((0.50,0.30,0.20)\); under \(H_1\), they are \((0.40,0.20,0.40)\). Find a size-\(0.10\) test and power. (Answer: Reject \(C\) with probability \(0.50\), and do not reject \(A\) or \(B\); power \(0.20\).)
Clinical Biostats