Tutorials › VEE Mathematical Statistics › Continuous Neyman–Pearson Construction Workshop

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

Continuous Neyman–Pearson Construction Workshop

Learn a systematic way to build and check Neyman–Pearson tests when the observation has a continuous density.

Advanced 12 min read

What You'll Learn

  • Form the likelihood ratio from the two simple-hypothesis densities.
  • Translate a likelihood-ratio threshold into a rejection region for the data.
  • Calibrate a critical value using the null distribution and a specified test size.
  • Compute power by evaluating the rejection probability under the alternative.
  • Recognize when the most powerful rejection region has disconnected pieces.
  • Check support, tail direction, and boundary randomization.

From Densities to a Rejection Region

For a continuous observation, a Neyman–Pearson test is built by comparing the likelihood of the observed data under two specified models. The calculation has several distinct parts: form the likelihood ratio, solve its inequality for the observation, choose the cutoff to give the required size under the null, and then calculate the rejection probability under the alternative. Keeping these steps separate helps prevent a common error: choosing a tail before checking how the likelihood ratio changes with the data.

The discussion here concerns simple hypotheses, which specify a complete probability model under each hypothesis. The Neyman–Pearson result identifies a most powerful test among tests with size no greater than a specified level. For composite hypotheses, this result does not by itself provide a uniformly most powerful test.

Definition: Let \(X\) have density \(f_0\) under \(H_0\) and density \(f_1\) under \(H_1\), both defined with respect to the same measure. A test is a function \(\phi(x)\) giving the probability of rejecting \(H_0\) after observing \(x\); a nonrandomized test has \(\phi(x)\) equal to 0 or 1. Its size is \(E_0[\phi(X)]\), the probability of rejecting \(H_0\) when \(H_0\) is true. Its power at \(H_1\) is \(E_1[\phi(X)]\), the probability of rejecting \(H_0\) when \(H_1\) is true.

The likelihood ratio in this tutorial is \(f_1(x)/f_0(x)\), alternative density over null density. A large value means that the observation is relatively more likely under \(H_1\) than under \(H_0\). If \(f_0(x)=0\) and \(f_1(x)>0\), that observation has zero probability under the null and positive density under the alternative; the likelihood-ratio rule rejects there. The examples below have common support and positive null density throughout that support.

Theorem: For testing the simple hypotheses \(H_0:f=f_0\) against \(H_1:f=f_1\), a most powerful test of size \(\alpha\) rejects when \(f_1(x)/f_0(x)>k\), accepts when \(f_1(x)/f_0(x)<k\), and, if necessary, randomizes on the boundary where the ratio equals \(k\). Choose \(k\) and any boundary randomization so that the test has size \(\alpha\). A most powerful test has the greatest power among all tests whose size is at most \(\alpha\).

A Reliable Construction

Start from the density of the full observation under each hypothesis. For independent observations, this means using the joint densities, or equivalently the product of their individual densities. Constants that depend on the hypotheses must be retained; factors common to both densities can be canceled when forming the ratio. Then solve the likelihood-ratio inequality in terms of the observed data. Only after identifying which values lead to rejection should the size be calibrated under \(H_0\).

1
Write both models.
Specify the null and alternative densities, including their parameters and support.
2
Form and simplify the ratio.
Use \(L(x)=f_1(x)/f_0(x)\). Preserve the direction of this ratio throughout the calculation.
3
Solve the critical inequality.
Find the observations for which \(L(x)>k\). The result may be an upper tail, a lower tail, or a disconnected region.
4
Calibrate size and calculate power.
Choose the cutoff using the null probability of rejection, then evaluate the same rejection region under the alternative.

Why the Likelihood-Ratio Rule Is Most Powerful

The reason this construction works can be seen by comparing its test, \(\phi\), with any competing test, \(\psi\), of size at most \(\alpha\). At the threshold \(k\), the likelihood-ratio test rejects above the threshold and accepts below it. Consequently, at every observation, \((\phi(x)-\psi(x))(f_1(x)-k f_0(x))\geq 0\). Above the threshold, both factors are nonnegative; below it, both are nonpositive. On the boundary, the second factor is zero.

$$ \int (\phi-\psi)(f_1-kf_0)\,dx \geq 0 $$

Rearranging this inequality gives \(E_1[\phi]-E_1[\psi]\geq k(E_0[\phi]-E_0[\psi])\). The likelihood-ratio test has size \(\alpha\), while the competing test has size at most \(\alpha\), so \(E_0[\phi]-E_0[\psi]\geq 0\). Since \(k\geq 0\), the right side is nonnegative. Therefore \(E_1[\phi]\geq E_1[\psi]\): the likelihood-ratio test has at least as much power as any competing test satisfying the size constraint. Randomization at a boundary can be chosen to attain the prescribed size when a nonrandomized cutoff cannot do so.

Worked Constructions

Worked Example: A Lower-Tail Test for Exponential Rates

A hypothetical sensor records one waiting time \(X\), in hours. Under \(H_0\), \(X\) is exponential with rate \(\lambda_0=1\) per hour; under \(H_1\), it is exponential with rate \(\lambda_1=2\) per hour. Construct a most powerful test of size \(\alpha=0.10\), and find its power. For an exponential distribution with rate \(\lambda\), the density is \(f(x)=\lambda e^{-\lambda x}\) for \(x\geq 0\).

Method and likelihood ratio. Both models have support \(x\geq0\). Their densities are \(f_0(x)=e^{-x}\) and \(f_1(x)=2e^{-2x}\). Thus

$$ L(x)=\frac{f_1(x)}{f_0(x)} =\frac{2e^{-2x}}{e^{-x}} =2e^{-x}. $$

Since \(2e^{-x}\) decreases as \(x\) increases, the rule \(L(x)>k\) is a lower-tail rule. Write it as \(x<c\), where \(c\) is the critical waiting time. Under \(H_0\), the exponential distribution has \(P_0(X<c)=1-e^{-c}\), so size \(0.10\) requires

$$ 1-e^{-c}=0.10,\qquad e^{-c}=0.90,\qquad c=-\ln(0.90)=0.1053605\text{ hours}. $$

The test rejects \(H_0\) when \(X<0.1053605\) hours. Under \(H_1\), the power is

$$ P_1(X<c)=1-e^{-2c} =1-(e^{-c})^2 =1-(0.90)^2 =0.19. $$

The size is \(0.1000\) and the power is \(0.1900\), both reported to four decimal places. The critical time is \(0.105361\) hours to six decimal places. Check: substituting \(e^{-c}=0.90\) into the null rejection probability gives \(1-0.90=0.10\). The key mistake avoided is assuming that a larger observation must favor the alternative: here, a short waiting time has a larger likelihood ratio.

Worked Example: An Upper-Tail Test for a Normal Mean

A hypothetical instrument produces one reading \(X\), measured in standard units. Under \(H_0\), \(X\sim N(0,1)\); under \(H_1\), \(X\sim N(1.5,1)\). Construct a most powerful test with size \(\alpha=P(Z>1)\), where \(Z\sim N(0,1)\), and calculate its power. The variance is known and equals 1 under both hypotheses.

Method and likelihood ratio. The two normal densities are \(f_0(x)=(2\pi)^{-1/2}e^{-x^2/2}\) and \(f_1(x)=(2\pi)^{-1/2}e^{-(x-1.5)^2/2}\). Their ratio simplifies to

$$ L(x)=\exp\left(\frac{x^2-(x-1.5)^2}{2}\right) =\exp(1.5x-1.125). $$

This ratio increases with \(x\), so reject for \(X>c\). Under \(H_0\), \(P_0(X>1)=P(Z>1)=\alpha\), which sets \(c=1\) exactly for the specified size. Under \(H_1\), standardize by subtracting the mean 1.5 and dividing by the standard deviation 1:

$$ P_1(X>1) =P\left(\frac{X-1.5}{1}>\frac{1-1.5}{1}\right) =P(Z>-0.5) =\Phi(0.5) =0.6915. $$

Here \(\Phi\) is the standard normal cumulative distribution function; the probability is rounded to four decimal places. Check: the cutoff gives exactly the stipulated null upper-tail probability, and the alternative mean lies above the cutoff, so the power exceeds \(0.5\). The mistake avoided is using a two-tail test simply because the observation is normal: the likelihood ratio increases with \(x\), so the most powerful region is one-sided.

Worked Example: A Disconnected Rejection Region

A hypothetical quality-control score \(X\) lies between 0 and 1. Under \(H_0\), \(X\) is uniform on \((0,1)\), so \(f_0(x)=1\). Under \(H_1\), its density is \(f_1(x)=4|x-0.5|\) on \((0,1)\). Construct a most powerful test of size \(0.50\) and calculate its power.

Check the alternative density. Its total probability is

$$ \int_0^1 4|x-0.5|\,dx =4\left(2\int_0^{0.5}(0.5-x)\,dx\right) =4(2)(0.125)=1. $$

The density is therefore normalized. The likelihood ratio is \(L(x)=4|x-0.5|\). It is largest near either endpoint and smallest at the center. The likelihood-ratio rule rejects where \(4|x-0.5|>k\). Setting \(k=1\) gives

$$ |x-0.5|>0.25 \quad\Longleftrightarrow\quad x<0.25\ \text{or}\ x>0.75. $$

Under \(H_0\), the two intervals have total length \(0.25+0.25=0.50\), so this region has the required size. Under \(H_1\), symmetry gives equal probability to the two tails. The probability of the left tail is

$$ \int_0^{0.25}4(0.5-x)\,dx =4\left[0.5x-\frac{x^2}{2}\right]_0^{0.25} =4(0.125-0.03125)=0.375. $$

The right tail also has probability \(0.375\), so the power is \(0.375+0.375=0.7500\), to four decimal places. Check: the null size is \(0.50\), and the alternative power is below 1. The mistake avoided is forcing the critical region to be one connected tail: solving the likelihood-ratio inequality produces two tails.

Cutoffs, Boundaries, and Checks

For a continuous observation, a cutoff often has null probability zero, so the test can be calibrated by an equality such as \(P_0(X>c)=\alpha\). However, continuity of \(X\) alone does not guarantee that every likelihood-ratio boundary has probability zero. If the ratio is constant over an interval, that interval can have positive probability. In that case, a nonrandomized threshold may not attain every desired size; randomization on the boundary may be needed.

The same distinction matters when translating the rule into data values. A likelihood ratio that increases with \(x\) produces an upper tail; one that decreases with \(x\) produces a lower tail. A ratio that increases and then decreases can produce a central interval, while a ratio that is large at separated parts of the support can produce disconnected tails. Derive the region from the inequality rather than relying on the labels “upper-tail” or “two-tail.”

Construction stepQuestion to check
ModelAre the null and alternative densities correctly assigned, with their parameters and supports stated?
RatioIs the ratio alternative over null, with constants depending on the hypotheses retained?
RegionHas the inequality \(f_1(x)/f_0(x)>k\) actually been solved for \(x\)?
SizeWas the rejection probability calculated under \(H_0\), not under \(H_1\)?
PowerWas the same rejection region evaluated under \(H_1\)?

A compact final check is to substitute the chosen cutoff back into the null rejection probability, confirm that the region corresponds to large likelihood ratios, and evaluate power under the alternative without changing the region. A test’s size and power use the same rejection event but different probability models.

Key takeaway: For a continuous Neyman–Pearson construction, form the alternative-to-null density ratio, solve its threshold inequality, calibrate the resulting region under the null, and compute its probability under the alternative. The direction and shape of the region come from the ratio, not from an automatic choice of tail.

Check Your Understanding

For each problem, identify the likelihood-ratio region, calibrate or apply its cutoff, and compute the requested power.

  1. Let \(X\) be exponential with rate 2 under \(H_0\) and rate 1 under \(H_1\), with rates per hour. A test has size \(0.20\). Find the critical value and power. (Answer: reject for \(X>\frac{\ln 5}{2}=0.8047\) hours; power \(1/\sqrt{5}=0.4472\).)
  2. Suppose \(X\sim N(0,4)\) under \(H_0\) and \(X\sim N(2,4)\) under \(H_1\). For size \(0.10\), find the upper-tail cutoff and power. (Answer: reject for \(X>2\Phi^{-1}(0.90)=2.5631\); power \(1-\Phi(\Phi^{-1}(0.90)-1)=0.3891\).)
  3. On \((0,1)\), let \(f_0(x)=1\) and \(f_1(x)=6x(1-x)\). Find the most powerful size-\(0.50\) region and its power. (Answer: reject for \(0.25<x<0.75\); power \(11/16=0.6875\).)
  4. On \((0,1)\), let \(f_0(x)=1\) and \(f_1(x)=2x\). A test rejects when the likelihood ratio exceeds the cutoff corresponding to \(X>0.75\). Find its size and power. (Answer: size \(0.25\); power \(0.4375\).)
Clinical Biostats