Why a Discrete Test May Need Randomization
For a test with a continuous test statistic, a cutoff can often be adjusted to give a requested significance level exactly. In a discrete sample space, the probability of rejection can jump from below the target to above it when the cutoff moves past a possible outcome. A nonrandomized test may therefore be unable to attain the requested size.
The Neyman–Pearson construction resolves this for testing a simple null hypothesis against a simple alternative: reject for outcomes with the strongest evidence against the null, and, if necessary, reject with a probability strictly between zero and one at the likelihood-ratio boundary. The randomization is a specified part of the testing procedure, not a change to the observed data.
Calibrating the Boundary
Assume the hypotheses are simple, the possible outcomes have specified probabilities under both hypotheses, and the likelihood ratio is defined as \(L(x)=P_1(X=x)/P_0(X=x)\) on outcomes with positive null probability. A likelihood ratio larger than one indicates that the outcome is relatively more probable under the alternative. For a target size \(\alpha\), order outcomes by decreasing \(L(x)\).
Choose a boundary value \(c\) so that the null probability of outcomes with likelihood ratio strictly greater than \(c\) is no more than \(\alpha\), while including the boundary outcomes would bring the cumulative probability to at least \(\alpha\). Define
The test rejects with certainty above the boundary, does not reject below it, and randomizes on outcomes with likelihood ratio equal to \(c\). If a common boundary rejection probability \(\gamma\) is used, it is determined by
The denominator is positive when the boundary has positive null probability. The boundary conditions ensure \(0\leq\gamma\leq1\). If the target size is already attained by taking a whole set of likelihood-ratio levels, no partial rejection is needed. If an outcome has zero probability under the null but positive probability under the alternative, it can be treated as having an infinite likelihood ratio: rejecting on it adds no null size.
Calculate their likelihood ratios and rank outcomes from largest to smallest.
Add null probabilities from the top of the ordering until the next likelihood-ratio level would exceed the target size.
Divide the remaining size by the null probability at the boundary to obtain the common boundary randomization probability.
Verify the null rejection probability equals \(\alpha\), then weight each rejection probability by the corresponding alternative probability.
Why This Gives a Most Powerful Test
The likelihood-ratio ordering is not an arbitrary ranking. For any test function \(\phi\), its power is the sum of alternative probabilities multiplied by the rejection probabilities. Since \(P_1(X=x)=L(x)P_0(X=x)\), the power can be written as a null-probability-weighted sum:
At a fixed size, this expression is made as large as possible by assigning rejection probability first to outcomes with the largest likelihood ratios. Any rejection probability assigned to a lower-ratio outcome rather than a higher-ratio outcome can be shifted upward without increasing size and will not decrease power. The boundary randomization uses precisely the remaining null probability after all higher-ratio outcomes are rejected.
This also explains how to interpret ties. The standard likelihood-ratio construction assigns the same \(\gamma\) to every outcome at the boundary. That is a convenient, valid most powerful test. But equal rejection probabilities across tied outcomes are not necessary. Outcomes tied at \(c\) have alternative probabilities \(c\) times their null probabilities, so any boundary rejection probabilities whose null-weighted total is calibrated to the remaining size give the same boundary contribution to power.
Worked Example: Randomizing at One Discrete Boundary
A hypothetical quality audit produces one of four categorical outcomes, \(A,B,C,\) or \(D\). The hypotheses are simple: \(H_0\) and \(H_1\) assign the probabilities shown below. The target size is \(\alpha=0.25\). There is no interest or mortality component; the model is the finite categorical distribution in the table.
| Outcome | \(P_0(X=x)\) | \(P_1(X=x)\) | \(L(x)=P_1/P_0\) |
|---|---|---|---|
| A | 0.10 | 0.40 | 4.00 |
| B | 0.20 | 0.30 | 1.50 |
| C | 0.30 | 0.20 | 0.667 |
| D | 0.40 | 0.10 | 0.25 |
Method. Apply the Neyman–Pearson likelihood-ratio ordering, then randomize at the first boundary level that would otherwise push the size past the target. The ratios are \(4,1.5,0.667,\) and \(0.25\), so the order is \(A,B,C,D\). Rejecting on \(A\) alone uses null probability \(0.10\). Adding \(B\) completely would raise the size to \(0.10+0.20=0.30\), above \(0.25\). Thus \(B\) is the boundary and \(c=1.50\).
The remaining null size after rejecting on \(A\) is \(0.25-0.10=0.15\). The null probability at \(B\) is \(0.20\), so
The test rejects on \(A\) with probability one, on \(B\) with probability \(0.75\), and on \(C\) and \(D\) with probability zero. Its size is \(0.10+(0.75)(0.20)=0.10+0.15=0.25\). Its power is \(0.40+(0.75)(0.30)=0.40+0.225=0.625\). As a check, the null rejection probability is exactly the requested size, and the power is between zero and one.
Common mistake avoided: Rejecting on all of \(B\) would give size \(0.10+0.20=0.30\), not \(0.25\). The boundary is only partly included.
Worked Example: Tied Outcomes at the Boundary
A hypothetical monitoring system records one of four categories, \(R,S,T,\) or \(U\), under two fully specified hypotheses. The target size is \(0.30\), and there is no interest or mortality assumption because this is a finite categorical probability model.
| Outcome | \(P_0(X=x)\) | \(P_1(X=x)\) | \(L(x)\) |
|---|---|---|---|
| R | 0.15 | 0.30 | 2 |
| S | 0.25 | 0.50 | 2 |
| T | 0.30 | 0.15 | 0.5 |
| U | 0.30 | 0.05 | 0.167 |
The largest likelihood ratio is \(2\), shared by \(R\) and \(S\). Their total null probability is \(0.15+0.25=0.40\), which exceeds the target \(0.30\). There are no outcomes with a ratio greater than \(2\), so the common boundary probability is
Using this standard equal-probability rule gives size \(0.75(0.15+0.25)=0.30\) and power \(0.75(0.30+0.50)=0.60\).
Equal randomization is not required here. For example, reject on \(R\) with probability \(1\) and on \(S\) with probability \(0.60\). The size is \(1(0.15)+0.60(0.25)=0.15+0.15=0.30\). The power is \(1(0.30)+0.60(0.50)=0.30+0.30=0.60\). Both tests attain the same size and power because \(P_1=2P_0\) for each tied outcome. This calculation illustrates why the standard rule is sufficient, but not the only most powerful way to allocate rejection probability across a tied boundary.
Common mistake avoided: It would be incorrect to claim that tied outcomes must always receive identical rejection probabilities. What matters for calibration is their total null-weighted rejection probability; the likelihood-ratio tie makes their alternative-weighted contribution proportional to that total.
Worked Example: Computing Size and Power After Calibration
A hypothetical inspection procedure has five possible results, \(1\) through \(5\), with the following simple null and alternative distributions. The target size is \(0.28\). No financial interest rate or mortality assumption applies; the stated probability table fully specifies the model.
| Outcome | \(P_0(X=x)\) | \(P_1(X=x)\) | \(L(x)\) |
|---|---|---|---|
| 1 | 0.05 | 0.25 | 5 |
| 2 | 0.15 | 0.30 | 2 |
| 3 | 0.25 | 0.25 | 1 |
| 4 | 0.30 | 0.15 | 0.5 |
| 5 | 0.25 | 0.05 | 0.2 |
Method. Rank by likelihood ratio: outcome \(1\), then \(2\), then \(3\), \(4\), and \(5\). Rejecting on outcomes \(1\) and \(2\) uses null probability \(0.05+0.15=0.20\). Including outcome \(3\) completely would increase this to \(0.20+0.25=0.45\), so outcome \(3\) is the boundary, with \(c=1\).
The remaining size is \(0.28-0.20=0.08\), and the null probability at the boundary is \(0.25\). Therefore
The size check is \(0.05+0.15+(0.32)(0.25)=0.20+0.08=0.28\). The power is \(0.25+0.30+(0.32)(0.25)=0.55+0.08=0.63\). Both distributions sum to one, and the resulting size equals the target.
Common mistake avoided: The residual \(0.08\) is a null probability to be allocated, not an alternative probability. Use the null boundary mass \(0.25\) to find \(\gamma\); use the alternative probabilities to calculate power.
Common Calibration Traps
- Using the wrong numerator. The randomization probability is the target size minus the null probability already assigned to higher-ratio outcomes. It is not the target size by itself.
- Using alternative probabilities to calibrate size. The size is calculated under \(H_0\). Alternative probabilities are used afterward to calculate power.
- Including the whole boundary. If doing so exceeds \(\alpha\), the boundary must be randomized rather than fully rejected.
- Confusing the randomization probability with power. \(\gamma\) is the conditional chance of rejection at a boundary outcome; power averages rejection probabilities under \(H_1\).
- Overstating what ties require. Assigning a common \(\gamma\) across a tied group is a standard construction. Different probabilities can also be most powerful when their null-weighted total is calibrated to the remaining size.
A useful final check is to write the test function for every likelihood-ratio level and calculate \(E_0[\phi(X)]\) directly. If it is not the target size, either the boundary was selected incorrectly or the randomization probability was miscalculated. Then compute \(E_1[\phi(X)]\) separately; do not infer power from the value of \(\gamma\) alone.
Check Your Understanding
For each finite categorical model, use the likelihood-ratio ordering to find the boundary randomization and report the requested power or size. Each table gives the complete distributions; no interest or mortality assumptions are involved.
- Under \(H_0\), outcomes \(a,b,c\) have probabilities \(0.20,0.50,0.30\); under \(H_1\), they have probabilities \(0.60,0.30,0.10\). For target size \(0.35\), find the boundary randomization probability and power. (Answer: Boundary \(b\), \(\gamma=0.30\), power \(0.6900\).)
- Under \(H_0\), outcomes \(w,x,y,z\) have probabilities \(0.10,0.20,0.30,0.40\); under \(H_1\), they have probabilities \(0.40,0.40,0.15,0.05\). For target size \(0.20\), find the boundary randomization probability and power. (Answer: Boundary \(x\), \(\gamma=0.50\), power \(0.6000\).)
- Outcomes \(M,N,O\) have null probabilities \(0.20,0.30,0.50\) and alternative probabilities \(0.40,0.60,0\). For target size \(0.35\), give the common boundary randomization and one unequal allocation across the tied outcomes that attains the same size; calculate the power. (Answer: The tied boundary is \(M,N\) with \(L=2\); common \(\gamma=0.70\), or reject on \(M\) with probability \(1\) and \(N\) with probability \(0.50\); power \(0.7000\).)
- Under \(H_0\), outcomes \(A,B,C,D\) have probabilities \(0.10,0.20,0.30,0.40\); under \(H_1\), they have probabilities \(0.05,0.15,0.30,0.50\). For target size \(0.50\), determine the boundary randomization probability and power. (Answer: Reject on \(D\), randomize at \(C\) with \(\gamma=\frac{1}{3}\), and do not reject on \(A\) or \(B\); power \(0.6000\).)