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

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

Discrete Neyman–Pearson Construction Workshop

Build a discrete Neyman–Pearson test systematically, including the boundary randomization needed to attain a specified size.

Advanced 10 min read

What You'll Learn

  • Define test size, power, and a likelihood ratio for discrete simple hypotheses
  • Rank possible outcomes by their likelihood ratios under the alternative and null
  • Accumulate null probabilities to identify the rejection region
  • Calculate the randomization probability when a boundary outcome would exceed the target size
  • Evaluate and verify a test’s size and power
  • Handle tied likelihood ratios without changing the most powerful property

Constructing a Most Powerful Discrete Test

For discrete data, the most powerful test of one simple hypothesis against another is built by comparing the probability of each possible outcome under the two hypotheses. The key is to rank outcomes by how strongly they favor the alternative, then spend the permitted probability of rejection under the null on the most informative outcomes first. Because discrete outcomes have probability mass, a deterministic rejection region may not have exactly the requested size. Randomization at a boundary resolves that issue.

This tutorial develops that construction for a single observation or a discrete sample summarized by its possible outcomes. It is aligned with the SOA VEE Mathematical Statistics syllabus.

Definition: Let \(H_0\) and \(H_1\) be simple hypotheses specifying probability mass functions \(p_0(x)\) and \(p_1(x)\) on a discrete sample space. A test is a function \(\phi(x)\) between 0 and 1, interpreted as the probability of rejecting \(H_0\) after observing \(x\). Its size is \(E_0[\phi(X)]=\sum_x p_0(x)\phi(x)\), and its power at \(H_1\) is \(E_1[\phi(X)]=\sum_x p_1(x)\phi(x)\). A nonrandomized test has only values 0 and 1; a randomized test may also take values strictly between them.

The likelihood ratio used here is

$$ \Lambda(x)=\frac{p_1(x)}{p_0(x)},\qquad p_0(x)>0. $$

A large ratio means that the observed outcome is relatively more probable under \(H_1\) than under \(H_0\), so it is a strong candidate for rejection. If \(p_0(x)=0\) but \(p_1(x)>0\), the outcome can be rejected without adding to the test’s size; it has an infinite likelihood ratio for this ranking purpose. Outcomes with zero probability under both hypotheses do not affect the test.

The Discrete Construction

For a desired size \(\alpha\), order the outcomes from largest to smallest likelihood ratio. Add their probabilities under \(H_0\) in that order. Reject on outcomes above the boundary; if the next outcome would take the cumulative null probability beyond \(\alpha\), reject on that boundary outcome with only the probability needed to reach \(\alpha\). If several outcomes tie at the boundary, a common randomization probability on those outcomes is a convenient choice.

1
Compute likelihood ratios.
For each outcome with positive null probability, calculate \(p_1(x)/p_0(x)\). Keep track of any outcomes possible under \(H_1\) but impossible under \(H_0\).
2
Rank the outcomes.
Sort from highest likelihood ratio to lowest. Outcomes tied in ratio provide equal evidence per unit of null probability.
3
Use the size budget.
Accumulate \(p_0(x)\) in ranked order until the next outcome would exceed \(\alpha\). Include the preceding outcomes fully.
4
Randomize at the boundary if needed.
Choose the boundary rejection probability so that the total null rejection probability is \(\alpha\). If the cumulative probability lands exactly on \(\alpha\), no boundary randomization is needed.
5
Calculate power and check size.
Use the same test function with \(p_1(x)\) to find power. Verify separately that the null rejection probability equals the target.

In the usual threshold form, a most powerful test rejects for \(\Lambda(x)>c\), accepts for \(\Lambda(x)<c\), and rejects with probability \(\gamma\) for \(\Lambda(x)=c\), where \(c\) and \(\gamma\) are chosen to attain the target size when possible. The Neyman–Pearson result says this test has at least as much power as any other test whose size is no greater than \(\alpha\). The boundary randomization is part of the test, not an adjustment to the reported power.

Why Ranking Likelihood Ratios Works

The ranking rule can be justified by comparing the threshold test with any competing test. Let \(\phi^*\) be the threshold test with boundary \(c\), and let \(\psi\) be any test of size at most \(\alpha\). At an outcome above the threshold, \(\phi^*(x)=1\) and \(p_1(x)-c p_0(x)>0\); below it, \(\phi^*(x)=0\) and \(p_1(x)-c p_0(x)<0\). At a boundary outcome, the latter difference is zero. Consequently, at every outcome,

$$ \bigl(\phi^*(x)-\psi(x)\bigr)\bigl(p_1(x)-c p_0(x)\bigr)\geq 0. $$

Summing over the sample space gives

$$ E_1[\phi^*]-E_1[\psi] \geq c\bigl(E_0[\phi^*]-E_0[\psi]\bigr)\geq 0. $$

The final inequality holds because \(E_0[\phi^*]=\alpha\), \(E_0[\psi]\leq\alpha\), and \(c\geq0\). Thus the threshold test has power at least as large as the competing test. This explains why probability mass under \(H_0\) should be assigned first to outcomes with the largest likelihood ratios.

Worked Example: Randomizing at a Categorical Boundary

A hypothetical diagnostic process records one of four outcomes, \(A,B,C,D\). Under the simple hypotheses, the distribution is:

Outcome\(p_0(x)\)\(p_1(x)\)\(\Lambda(x)\)
A0.400.100.25
B0.300.200.6667
C0.200.301.50
D0.100.404.00

Find a most powerful test of size \(\alpha=0.25\), and calculate its power. This is one categorical observation with the displayed probability mass functions; the parameters are the listed outcome probabilities. No interest rate or mortality assumption is involved.

Method: likelihood-ratio ranking and boundary randomization. The ratios rank the outcomes \(D,C,B,A\), from most to least favorable to \(H_1\). Under \(H_0\), rejecting on \(D\) uses \(0.10\) of the size, and rejecting on both \(D\) and \(C\) uses \(0.10+0.20=0.30\), which exceeds \(0.25\). Therefore reject on \(D\) always and on \(C\) with probability \(\gamma\), where

$$ 0.10+\gamma(0.20)=0.25,\qquad \gamma=\frac{0.15}{0.20}=0.75. $$

The power is the alternative probability of rejection:

$$ P_1(\text{reject})=0.40+0.75(0.30)=0.40+0.225=0.625. $$

Check. The size is \(0.10+0.75(0.20)=0.25\), as required, and the power is \(0.625\). This construction avoids the mistake of rejecting on both \(D\) and \(C\) deterministically: that test has size \(0.30\), not \(0.25\).

Worked Example: A Binomial Sample

Suppose \(X\) is the number of positive results in \(n=3\) independent trials. Test \(H_0:p=0.20\) against \(H_1:p=0.60\) at size \(\alpha=0.10\). The model is \(X\sim\operatorname{Binomial}(3,p)\), with the specified success probability under each hypothesis. The outcomes are \(k=0,1,2,3\); there is no interest rate or mortality assumption.

Method: calculate the binomial likelihood ratios and accumulate null probabilities. The probability at outcome \(k\) is \(\binom{3}{k}p^k(1-p)^{3-k}\). Under \(H_0\), the probabilities for \(k=0,1,2,3\) are \(0.512,0.384,0.096,0.008\), respectively. Under \(H_1\), they are \(0.064,0.288,0.432,0.216\), respectively. Dividing the alternative probabilities by the null probabilities gives:

$$ \Lambda(0)=0.125,\quad \Lambda(1)=0.75,\quad \Lambda(2)=4.5,\quad \Lambda(3)=27. $$

The ranking is \(k=3,2,1,0\). Rejecting only when \(k=3\) uses size \(0.008\). Adding \(k=2\) in full would give size \(0.008+0.096=0.104\), exceeding \(0.10\). Thus reject at \(k=3\) always and at \(k=2\) with probability \(\gamma\):

$$ 0.008+0.096\gamma=0.10,\qquad \gamma=\frac{0.092}{0.096}=\frac{23}{24}. $$

The power is

$$ 0.216+\frac{23}{24}(0.432) =0.216+0.414 =0.630. $$

Check. The size is \(0.008+(23/24)(0.096)=0.008+0.092=0.10\), and the power is \(0.630\). The common mistake is to reject for \(k\geq2\) without checking the null probability: that rule has size \(0.104\). Randomizing at \(k=2\) attains the requested size exactly.

Worked Example: A Tied Boundary

A hypothetical monitoring system reports one of five labels, \(A,B,C,D,E\). Under \(H_0\), the probabilities are \(0.20,0.20,0.30,0.20,0.10\); under \(H_1\), they are \(0.10,0.10,0.30,0.30,0.20\), in that order. Find a most powerful test of size \(0.70\) and its power. This is a single categorical observation with those specified distributions and parameters; no interest rate or mortality assumption applies.

Method: rank the likelihood ratios, then randomize across the tied boundary. The ratios are

$$ \Lambda(A)=0.5,\quad \Lambda(B)=0.5,\quad \Lambda(C)=1,\quad \Lambda(D)=1.5,\quad \Lambda(E)=2. $$

Thus the order is \(E,D,C\), followed by the tied outcomes \(A,B\). Rejecting on \(E,D,C\) uses null probability \(0.10+0.20+0.30=0.60\). The remaining size is \(0.70-0.60=0.10\). The two tied outcomes together have null probability \(0.20+0.20=0.40\); applying a common rejection probability \(\gamma\) to them gives

$$ 0.60+0.40\gamma=0.70,\qquad \gamma=0.25. $$

The power is

$$ 0.20+0.30+0.30+0.25(0.10+0.10) =0.80+0.05 =0.85. $$

Check. The size is \(0.60+0.25(0.40)=0.70\), and the power is \(0.85\). Because \(A\) and \(B\) have equal likelihood ratios, allocating the boundary rejection probability to them in the same proportion preserves the threshold construction. The method avoids arbitrarily treating one tied outcome as stronger evidence than the other.

Common Construction Errors

Discrete tests require careful bookkeeping. A likelihood-ratio ranking determines the order of outcomes, but the target size is always calculated with probabilities under \(H_0\), while power is calculated with probabilities under \(H_1\). Keep those two calculations separate.

  • Using alternative probabilities to set the size. The size constraint is \(\sum_x p_0(x)\phi(x)=\alpha\), not a sum under \(H_1\).
  • Taking outcomes in numerical order automatically. The most powerful region is determined by likelihood ratios, which need not increase with the observed value.
  • Rejecting the whole boundary outcome. If doing so exceeds \(\alpha\), calculate the boundary randomization probability rather than reporting an oversized test.
  • Forgetting the randomization in the power calculation. A boundary outcome’s contribution to power is \(p_1(x)\gamma\), not \(p_1(x)\) in full.
  • Breaking a likelihood-ratio tie without justification. Tied outcomes provide the same likelihood ratio; a common randomization probability is a direct way to meet the size target.

When the size obtained by including the highest-ranked outcomes lands exactly on \(\alpha\), the test is nonrandomized. Otherwise, randomization is generally what allows a discrete test to attain the specified size rather than merely stay below it. This distinction matters when comparing tests at a fixed size or reporting their power.

Key takeaway: Rank outcomes by \(p_1(x)/p_0(x)\), accumulate probability under \(H_0\) until the target size is nearly reached, randomize at the boundary if necessary, and calculate power using \(p_1(x)\). Always verify the final size and power separately.

Check Your Understanding

For each problem, construct or interpret the discrete test using the stated simple hypotheses.

  1. A single categorical observation has outcomes \(A,B,C\), with null probabilities \(0.50,0.30,0.20\) and alternative probabilities \(0.10,0.40,0.50\). At size \(0.40\), which outcome is always rejected, what boundary randomization is used, and what is the power? (Answer: Reject \(C\) always and \(B\) with probability \(2/3\); power \(0.7667\).)
  2. Let \(X\sim\operatorname{Binomial}(2,p)\), testing \(H_0:p=0.25\) against \(H_1:p=0.50\) at size \(0.20\). Find the randomization probability at the boundary \(X=1\) and the power. (Answer: Randomize at \(X=1\) with probability \(11/30\); power \(0.4333\).)
  3. A categorical observation has outcomes \(A,B,C\), with null probabilities \(0.40,0.40,0.20\) and alternative probabilities \(0.20,0.50,0.30\). Construct a test of size \(0.50\), accounting for the likelihood-ratio ordering, and calculate its power. (Answer: Reject \(C\) always and \(B\) with probability \(0.75\); power \(0.675\).)
  4. A categorical observation has outcomes \(A,B,C\), with null probabilities \(0.50,0.30,0.20\) and alternative probabilities \(0.10,0.45,0.45\). At size \(0.35\), rank the outcomes, find the boundary randomization probability, and calculate power. (Answer: Rank \(C,B,A\); reject \(C\) always and \(B\) with probability \(0.50\); power \(0.675\).)
Clinical Biostats