01 / 22
\(H_0\)
\(H_1\)

The Neyman-Pearson
Lemma

Discover the optimal strategy for choosing between two hypotheses: how the likelihood ratio unlocks the most powerful test at any significance level.

Statistics Hypothesis Testing

The Hypothesis Testing Framework

In statistical inference, we often face a decision between two competing claims about a population parameter. We formalize this as a choice between a null hypothesis \(H_0\) and an alternative hypothesis \(H_1\).

\(H_0\): Null
The default or "no effect" claim. We assume it holds until evidence says otherwise.
\(H_1\): Alternative
The competing claim we seek evidence for. Rejecting \(H_0\) means accepting \(H_1\).

Two Types of Error

Any test can make two kinds of mistakes. The Neyman-Pearson framework treats these errors asymmetrically: we fix the probability of one and minimize the other.

Type I Error (\(\alpha\))
Rejecting \(H_0\) when it is actually true. The probability is called the significance level or size of the test.
Type II Error (\(\beta\))
Failing to reject \(H_0\) when \(H_1\) is actually true. We want \(\beta\) as small as possible: equivalently, we want power \(1 - \beta\) as large as possible.

Size, Power, and the Rejection Region

\(f(x \mid H_0)\)
\(f(x \mid H_1)\)
critical value \(k\)
Rejection Region \(R\)
test statistic \(x\)
1
Size \(\alpha\): the area under the \(H_0\) curve inside the rejection region \(R\).
2
Power \(1 - \beta\): the area under the \(H_1\) curve inside the rejection region \(R\).
3
Goal: choose \(R\) so that power is maximized while size stays \(\leq \alpha_0\).

The Likelihood Ratio

The key insight is to compare how likely the observed data is under each hypothesis. The likelihood ratio for an observation \(x\) is:

When \(\Lambda(x)\) is large, the data are much more consistent with \(H_1\) than with \(H_0\): strong evidence against \(H_0\). The Neyman-Pearson Lemma tells us that rejecting when \(\Lambda(x)\) exceeds a threshold is the optimal strategy.

Formal Statement: Neyman-Pearson Lemma

This test is called the most powerful (MP) test of size \(\alpha\). No other test at the same significance level can achieve higher power against \(\theta_1\).

What "Most Powerful" Means

NP optimal \(R^*\)
other \(R'\)
\(H_0\)
\(H_1\)

Both regions \(R^*\) and \(R'\) have the same size \(\alpha\) (same area under the \(H_0\) curve). But the NP region \(R^*\) captures more area under the \(H_1\) curve, giving higher power. Any other region with the same \(\alpha\) necessarily has lower power.

Simple vs Composite Hypotheses

The Neyman-Pearson Lemma applies directly to simple vs simple tests. Understanding this distinction is critical.

Simple Hypothesis Composite Hypothesis
Definition Specifies a single value: \(\theta = \theta_0\) Specifies a set of values: \(\theta \in \Theta_0\)
Example \(H_0\!: \mu = 5\) \(H_1\!: \mu > 5\)
NP Lemma Directly applies Requires extension (UMP tests)
Likelihood ratio Single well-defined \(\Lambda(x)\) \(\Lambda(x)\) depends on which \(\theta_1\)

How to Apply the Lemma

1
Write the densities. Identify \(f(x \mid \theta_0)\) and \(f(x \mid \theta_1)\) under each simple hypothesis.
2
Form the likelihood ratio. Compute \(\Lambda(x) = \frac{f(x \mid \theta_1)}{f(x \mid \theta_0)}\). For a random sample of size \(n\), use the joint density.
3
Simplify the inequality. Reduce \(\Lambda(x) > k\) to an equivalent condition on a sufficient statistic (e.g., \(\bar{X} > c\)).
4
Find the threshold. Choose \(c\) (or \(k\)) so that \(P_{\theta_0}(\text{reject}) = \alpha\). Use the distribution of the test statistic under \(H_0\).
5
State the test. Reject \(H_0\) if the statistic exceeds the threshold. This is the most powerful level-\(\alpha\) test.

Example 1: Normal Mean

Let \(X_1, \ldots, X_n \overset{iid}{\sim} N(\mu, \sigma^2)\) with \(\sigma^2\) known. Test \(H_0\!: \mu = \mu_0\) vs \(H_1\!: \mu = \mu_1\), where \(\mu_1 \gt \mu_0\).

Example 1: Visualized

\(\alpha\)
Power
\(1 - \beta\)
\(\mu_0\)
\(\mu_1\)
\(c = \mu_0 + z_\alpha \frac{\sigma}{\sqrt{n}}\)

The rejection region lies in the right tail: exactly where the \(H_1\) density is largest relative to the \(H_0\) density. The \(\alpha\) area under the green curve equals the significance level. The shaded area under the red curve equals the power.

Example 2: Exponential Rate

Let \(X_1, \ldots, X_n \overset{iid}{\sim} \text{Exp}(\lambda)\) with density \(f(x \mid \lambda) = \lambda e^{-\lambda x}\). Test \(H_0\!: \lambda = 1\) vs \(H_1\!: \lambda = 2\).

The MP test rejects \(H_0\) when \(\sum X_i \lt c\): short total lifetimes suggest a higher rate \(\lambda = 2\).

Example 3: Bernoulli Proportion

Let \(X_1, \ldots, X_n \overset{iid}{\sim} \text{Bernoulli}(p)\). Test \(H_0\!: p = 0.3\) vs \(H_1\!: p = 0.6\).

Randomized Tests

For discrete distributions, we may not be able to achieve size exactly \(\alpha\) with a deterministic rule. The NP lemma allows a randomized test on the boundary:

Here \(\phi(x)\) is the probability of rejecting \(H_0\) given observation \(x\). When \(\Lambda(x) = k\), we reject with probability \(\gamma\) (flip a biased coin). In continuous settings, \(P(\Lambda(X) = k) = 0\), so randomization is unnecessary.

Why It Works: Proof Intuition

1
Compare two tests. Let \(\phi^*\) be the NP test and \(\phi'\) be any other test with size \(\leq \alpha\).
2
Difference in power: \(\text{Power}(\phi^*) - \text{Power}(\phi') = \int [\phi^*(x) - \phi'(x)] f(x \mid \theta_1)\, dx\).
3
Key observation: Where \(\phi^*(x) > \phi'(x)\), we know \(\Lambda(x) \geq k\), so \(f(x \mid \theta_1) \geq k \cdot f(x \mid \theta_0)\).
4
Bound the integral: Replace \(f(x \mid \theta_1)\) by \(k \cdot f(x \mid \theta_0)\). The resulting integral is \(\geq k[\alpha - \alpha'] \geq 0\).
5
Conclusion: \(\text{Power}(\phi^*) \geq \text{Power}(\phi')\). The NP test is at least as powerful as any competitor. ✓

Common Mistakes

✕ Applying NP to Composite \(H_1\)
The lemma gives the MP test for a specific \(\theta_1\). For composite alternatives, you need UMP theory or may find no single best test exists.
✕ Wrong Ratio Direction
The ratio is \(f(\theta_1)/f(\theta_0)\), not the reciprocal. Reversing it flips the rejection region entirely.
✕ Ignoring Monotonicity
After forming \(\Lambda(x) > k\), you must check whether the inequality simplifies to an upper or lower tail test in the sufficient statistic.

Summary and Connections

Concept NP Lemma UMP Test Generalized LRT
Hypotheses Simple vs Simple Simple vs Composite Composite vs Composite
Optimality MP guaranteed MP for all \(\theta_1 \in \Theta_1\) Asymptotically optimal
Test statistic \(\Lambda(x) = f_1/f_0\) Same, if monotone LR \(\lambda(x) = \sup_{\Theta_0} L / \sup_\Theta L\)
Existence Always exists May not exist Always computable
Key condition Both \(H\) simple Monotone likelihood ratio Large sample / regularity

Question 1 of 5

The Neyman-Pearson Lemma guarantees an optimal test for which type of hypothesis testing problem?

Question 2 of 5

In the NP framework, the most powerful test rejects \(H_0\) when the likelihood ratio \(\Lambda(x) = f(x \mid \theta_1)/f(x \mid \theta_0)\) satisfies which condition?

Question 3 of 5

For \(X_1, \ldots, X_n \overset{iid}{\sim} N(\mu, \sigma^2)\) with \(\sigma^2\) known, the NP test of \(H_0\!: \mu = 0\) vs \(H_1\!: \mu = 2\) rejects when:

Question 4 of 5

Why might a Neyman-Pearson test require randomization?

Question 5 of 5

A test is called Uniformly Most Powerful (UMP) if: