Virtual Laboratories > Hypothesis Testing > 1 2 3 4 5 [6] 7
As usual, our starting point is a random experiment with a sample space, and a probability measure P. In the basic statistical model, we have an observable random variable X taking values in a set S. In general, X can have quite a complicated structure. For example, if the experiment is to sample n objects from a population and record various measurements of interest, then
X = (X1, X2, ..., Xn)
where Xi is the vector of measurements for the i'th object. The most important special case occurs when X1, X2, ..., Xn, are independent and identically distributed. In this case, we have a random sample of size n from the common distribution.
In the previous sections, we developed tests for parameters based on natural test statistics. However, in other cases, the tests may not be parametric, or there may not be an obvious statistic to start with. Thus, we need a more general method for constructing test statistics. Moreover, we do not yet know if the tests constructed so far are the best, in the sense of maximizing the power for the set of alternatives. In this and the next section, we investigate both of these ideas. Likelihood functions, similar to those used in maximum likelihood estimation, will play a key role.
Suppose that X has one of two possible distributions. Our simple hypotheses are
H0: X has density f0; H1: X has density f1.
The test that we will construct is based on the following simple idea: if we observe x, then the condition f1(x) > f0(x) is evidence in favor of the alternative; the opposite inequality is evidence against the alternative. Thus, let
L(x) = f0(x) / f1(x) for x in S.
The function L is the likelihood ratio function for the hypotheses and L(X) is the likelihood ratio statistic. Restating our earlier observation, note that small values of L are evidence in favor of the H1. Thus it seems reasonable that the likelihood ratio statistic may be a good test statistic, and that we shooed consider tests of the following form, where k is a constant:
Reject H0 if and only if L(X) k.
1.
Show that the significance level of the test is
r = P[L(X) k | H0].
As usual, we can try to construct a test by choosing k so that r is a prescribed value. If X is discrete, this will only be possible when r is a value of the distribution function of L(X).
An important special case of this model occurs when the density function f(x | a) of X depends on a parameters a that has two possible values. Thus, the parameter space is A = {a0, a1}. In this case, the hypotheses are
H0: a = a0 versus H1: a = a1,
and the likelihood ratio function is L(x) = f(x | a0) / f(x | a1).
The following exercises establish the Neyman-Pearson Lemma, and show that the test given above is most powerful. Let
R = {x S: L(x)
k}.
2.
Use the definition of L and the definition of R to show that
3.
Show that if A
R,
then
P(X R | H1) - P(X
B | H1)
(1 / k) [P(X
R | H0)
- P(X
B | H0)].
Hint: Write R = (R
B)
(R
Bc) and B = (B
R)
(B
Rc).
Use the additivity of probability and the results in Exercise 1.
4.
Consider the tests with rejection regions R and B. Use Exercise 3 to
show that if the size of B is no greater than the size of R then the
test with rejection region R is more powerful:
P(X R | H1)
P(X
B | H1).
The Neyman-Pearson lemma is a beautiful result, and is more useful than might be first apparent. In many important cases, the same most powerful test works for a range of alternatives, and thus is a uniformly most powerful test for this range. In the following subsections, we will consider some of these special cases.
Suppose that X = (X1, X2, ..., Xn) is a random sample from the exponential distribution with scale parameter b. The sample variables might represent the lifetimes from a sample of devices. We wish to test the following simple hypotheses, where b0, b1 > 0 are distinct specified values.
H0: b = b0 versus H1: b = b1.
5.
Show that the likelihood ratio statistic is
L(X) = (b1 / b0)n exp[(1 / b1 - 1 / b0)Y] where Y = X1 + X2 + ··· + Xn.
Recall that Y has the gamma distribution with shape parameter n and scale parameter b. We will denote the quantile of order r for the this distribution by yr(n, b).
6.
Suppose that b1 > b0. Show that the most
powerful test at the r level is
Reject H0 if and only if Y > y1 - r(n, b0).
7.
Suppose that b1 < b0. Show that the most
powerful test at the r level is
Reject H0 if and only if Y < yr(n, b0).
Note that the tests in Exercise 6 and 7 do not depend on the value of b1. This fact, together with the monotonicity of the power function can be used to shows that the tests are uniformly most powerful for the usual one-sided tests.
8.
Show that the test in Exercise 6 is uniformly most powerful for the hypotheses
H0: b b0 versus H1: b > b0.
9.
Show that the test in Exercise 7 is uniformly most powerful for the hypotheses
H0: b b0 versus H1: b < b0.
Suppose that I = (I1, I2, ..., In) is a random sample from the Bernoulli distribution with parameter p. The sample could represent the results of tossing a coin n times, where p is the probability of heads. We wish to test the simple hypotheses
H0: p = p0 versus H1: p = p1,
where p0, p1 in (0, 1) are specified distinct values. In the coin tossing model, we know that the probability of heads is either p0 or p1, but we don't know which.
10.
Show that the likelihood ratio statistic is
L(I) = [(1 - p0) / (1 - p1)]n {p0(1 - p1) / [p1(1 - p0)]}X where X = I1 + I2 + ··· + In.
Recall that X has the binomial distribution with parameters n and p. We will denote the quantile of order r for the this distribution by xr(n, p); although since the distribution is discrete, only certain values of r are possible.
11.
Suppose that p1 > p0. Show that the most
powerful test at level r is
Reject H0 if and only if X
x1 - r(n, p0).
12.
Suppose that p1 < p0. Show that the most
powerful test at level r is
Reject H0 if and only if X
xr(n, p0).
Again, note that the tests in Exercise 11 and 12 do not depend on the value of p1. This fact, together with the monotonicity of the power function can be used to shows that the tests are uniformly most powerful for the usual one-sided tests.
13.
Show that the test in Exercise 11 is uniformly most powerful for the hypotheses
H0: p p0 versus H1: p > p0.
14.
Show that the test in Exercise 12 is uniformly most powerful for the hypotheses
H0: p p0 versus H1: p < p0.
The one sided tests that we derived in the normal model, for µ with d known, for µ with d unknown, and for d with µ unknown are all uniformly most powerful. On the other hand, none of the two-sided tests are uniformly most powerful.
Suppose that X = (X1, X2, ..., Xn) is a random sample, either from the Poisson distribution with parameter 1 or from the geometric distribution with parameter 1/2. Note that both of these are distributions on the nonnegative integers, and both have mean 1. Thus, we wish to test
15.
Show that the likelihood ratio statistic is
L(X) = 2n e-n 2Y / U where Y = X1 + X2 + ··· + Xn and U = X1! X2! ··· Xn!.
16.
Show that the most powerful tests have the following form, where d is a constant.
Reject H0 if and only if ln(2) Y - ln(U) d.
The likelihood ratio statistic can be generalized to composite hypotheses. Suppose again that the density f(x | a) of the data variable X depends on a parameters a, taking values in a parameter space A. Consider the following hypotheses, where A0 is a subset of A:
H0: a
A0 versus H1: a
A - A0.
We define
L(x) = max{f(x | a): a
A0}
/ max{f(x | a): a
A} for x
in S.
The function L is the likelihood ratio function and L(X) is the likelihood ratio statistic. By the same reasoning as before, small values of L(x) are evidence in favor of the alternative hypothesis.