TUTORIAL 7 SOLUTIONS #9.11.2 Which of the following hypotheses are simple, and which are composite? a. X follows a uniform distribution on [0, 1]. b. A die is unbiased. c. X follows a normal distribution with mean 0 and variance σ 2 > 10. d. X follows a normal distribution with mean µ = 0. Solution a. This is a simple hypothesis. b. This is another simple hypothesis. c. This is a composite hypothesis. d. This is another composite hypothesis as the variance is unknown. 1 #9.11.6 Consider the coin tossing example of Section 9.1. Suppose that instead of tossing the coin 10 times, the coin was tossed until a head came up and the total number of tosses, X, was recorded. a. If the prior probabilities are equal, which outcomes favor H0 and which outcomes favor H1? b. Suppose P (H0)/P (H1) = 10. What outcomes favor H0? c. What is the significance level of a test that rejects H0 if X ≥ 8? d. What is the power of this test? Solution From Chapter 9.1, we have H0 : probability of heads is 0.5 versus H1 : probability of heads is 0.7. 2 The following is a Bayesian hypothesis testing approach (in contrast to the NeymanPearson approach). Let P (H0) be the prior probability that H0 is true and P (H1) be the prior probability that H1 is true. Clearly P (H0) + P (H1) = 1. After observing the number of heads, X, in 10 tosses of a coin, the posterior probability that H0 is true is given by P (H0, x) P (H0|x) = P (x) P (x|H0)P (H0) . = P (x) Here P (x) = P (x|H0)P (H0) + P (x|H1)P (H1). 3 Likewise, the posterior probability that H1 is true is given by P (H1, x) P (H1|x) = P (x) P (x|H1)P (H1) = . P (x) This implies that we reject H0 if P (H0|x) P (H0) P (x|H0) = < 1, P (H1|x) P (H1) P (x|H1) and accept H0 if P (H0|x) P (H0) P (x|H0) = > 1. P (H1|x) P (H1) P (x|H1) Note In the Bayesian hypothesis testing approach, there is a symmetry between the null hypothesis H0 and the alternative hypothesis H1. 4 Note that X has the geometric distribution with probability of heads equals p where p = 0.5 under H0 and p = 0.7 under H1. The pdf of X is P (X = k) = (1 − p)k−1p, k = 1, 2, . . . a. If P (H0) = P (H1) = 0.5, then P (H1|x) P (x|H1) = . P (H0|x) P (x|H0) We observe that x 1 2 3 4 P (x|H1) P (x|H0) 1.4 x 6 5 0.84 0.504 0.302 0.181 7 8 9 10 P (x|H1) 0.109 0.065 0.039 0.024 0.014 P (x|H0) P (x|H ) Since P (x|H1) > 1 if and only if x ≤ 1, we 0 conclude that X ≤ 1 heads would favor H1 while X ≥ 2 heads would favor H0. 5 b. If P (H0)/P (H1) = 10, then we would reject H0 if and only if P (H1) P (x|H1) P (H1|x) = P (H0|x) P (H0) P (x|H0) P (x|H1) = > 1. 10P (x|H0) This is equivalent to rejecting H0 if and only if P (x|H1) > 10. P (x|H0) From the table of ratios of posterior probabilities, we shall always accept H0. c. The significance level of the test that rejects H0 when X ≥ 8 is α = P (X ≥ 8|H0) ∞ X (0.5)i = i=8 = 0.0078. 6 d. The power of the test in c. is given by power = P (RejectH0|H1) = P (X ≥ 8|H1) ∞ X (0.3)i = (0.7) i=7 = 0.0002187. 7 #9.11.10 Suppose that X1, . . . , Xn form a random sample from a density function, f (x|θ), for which T is a sufficient statistic for θ. Show that the likelihood ratio test of H0 : θ = θ0 versus H1 : θ = θ1 is a function of T . Explain how, if the distribution of T is known under H0, the rejection region of the test may be chosen so that the test has level α. Solution The likelihood ratio test rejects H0 if f (x|θ0) <c f (x|θ1) for some constant c. Since T is a sufficient statistic, by the factorization theorem in Chapter 8.8.1, we have f (x|θ0) g[T (x), θ0]h(x) g[T (x), θ0] = = . f (x|θ1) g[T (x), θ1]h(x) g[T (x), θ1] 8 This implies that the likelihood ratio test is a function of T . Suppose now that the distribution of T is known under H0 and is, say, T ∼ F . We further assume that g[T (x), θ0]/g[T (x), θ1] is a strictly increasing function of T . Then g[T (x), θ0] <c g[T (x), θ1] if and only if T < c0 for some constant c0. Then at level α, the critical constant can be chosen to be c0 = F (1 − α) where F (1 − α) is the 100αth percentile of F since under H0 , P (T < F (1 − α)) = α. 9 #9.11.17 Let X ∼ N (0, σ 2) and consider testing H0 : σ = σ0 versus HA : σ = σ1, where σ1 > σ0. The values σ0 and σ1 are fixed. a. What is the likelihood ratio as a function of x? What values favor H0? What is the rejection region of a level α test? b. For a sample, X1, X2, . . . , Xn, distributed as above, repeat the previous question. c. Is the test in the previous question uniformly most powerful for testing H0 : σ = σ0 versus H1 : σ > σ0? 10 Solution a. The likelihood ratio is given by f (x|σ0) = f (x|σ1) 2/(2σ 2 ) 1 −x 0 e 2 1/2 (2πσ0 ) 2/(2σ 2 ) −x 1 1 e 2 1/2 (2πσ1 ) σ1 x2 1 1 = exp[ ( 2 − 2 )]. σ0 2 σ1 σ0 Since σ1 > σ0, small values of x2 would favor H0. I.e., we reject H0 if X 2 > c for some constant c. Note that under H0, X 2/σ02 ∼ χ21 distribution. Consequently at significance level α, we reject H0 if X 2 > σ02χ21(α) where χ21(α) is the 100(1 − α)th percentile of the χ21 distribution. 11 b. For a sample, X1, X2, . . . , Xn, distributed as above, the likelihood ratio is n Y f (xi|σ0) i=1 = f (xi|σ1) 2/(2σ 2 ) 1 −x 0 e i n 2 Y 1/2 (2πσ0 ) 2/(2σ 2 ) −x 1 1 i=1 (2πσ 2)1/2 e i 1 P n 2 x 1 σ1 n i=1 i 1 ( 2 − 2 )]. = ( ) exp[ σ0 2 σ1 σ0 Thus the likelihood Pn ratio2 test rejects H0 for large values of i=1 Xi . I.e., reject H0 if n X Xi2 > c i=1 for some constant c. Note that under H0, distribution. 12 Pn 2 /σ 2 ∼ χ2 X n i=1 i 0 Consequently at significance level α, we reject H0 if n X Xi2 > σ02χ2n(α) i=1 where χ2n(α) is the 100(1 − α)th percentile of the χ2n distribution. c. Yes, the test in the previous question is uniformly most powerful for testing H0 : σ = σ0 versus H1 : σ > σ0 because the test statistic as well as the critical value do not depend on σ1 > σ0. 13