Stats 2 Winter 28 Homework 9: Solutions Due Friday, March 6 Exercise 2: The form of the generalized likelihood ratio We want to test H : θ Θ against H : θ Θ, and compare the two following rules of rejection: r(x,..., X n ) = max θ Θ f(x,..., x n θ) max θ Θ f(x,..., x n θ) c and Let us denote: Λ(X,..., X n ) = max θ Θ f(x,..., x n θ) max θ Θ f(x,..., x n θ) d. The two rejection rules are then given by: ˆθ = arg max f(x,..., x n θ) θ Θ ˆθ = arg max f(x,..., x n θ) θ Θ ˆθ = arg max f(x,..., x n θ). θ Θ r = f(x,..., x n ˆθ ) f(x,..., x n ˆθ ) and Λ = f(x,..., x n ˆθ ) f(x,..., x n ˆθ) Let us consider the region C of the sample space where the MLE in Θ belongs to Θ, i.e. C = {(x,..., x n ) ˆθ (x,..., x n ) = ˆθ(x,..., x n )} For (x,..., x n ) C, we have ˆθ = ˆθ and the two statistics r = Λ. While for (x,..., x n ) C, we have: Λ = and r where we used that on C: f(x,..., x n ˆθ ) f(x,..., x n ˆθ ) by definition of argmax. taking c = d < yields the same rejection for the two tests: C {(x,..., x n ) C c r = Λ c} Hence, Exercise 3: Confidence intervals and tests (a) The MLE of µ for one observation X for a normal distribution is simply ˆµ = X. Since Θ = {µ = } consists of only one point, the generalized likelihood test is simply: Λ = f(x µ = ) f(x ˆµ) = 2π exp( X 2 /2) 2π = exp ( 2 ) X2
Hence the rejection region can be written as: 2 log(λ) = X 2 c where we reject X 2 for large values (two sided). X 2 follows a χ 2 statistic of degree. Hence to get a level α test, we choose c such that: P (X 2 c) = P (χ 2 c) = α i.e. we take c = χ 2 (α), the α quantile of the χ 2 distribution. Remark: We could also have rewritten the region as { X c}. The distribution being symmetrical around, it suffices to find c such that 2P(X c) = α or P(X c) = α/2 where X N(, ) hence, we take c = Z ( α/2) the α/2 quartile of the standard normal distribution. We have of course χ 2 (α) = Z ( α/2). (b) The acceptance region is given by X 2 χ 2 (α), i.e. [ X χ 2 (α), + ] χ 2 (α) = A() (c) The MLE is not changed by µ = θ and the same computations as in (a) gives: 2 log(λ) = (X θ) 2 and (X θ) 2 χ 2. Hence the acceptance region is given by: [ X θ χ 2 (α), θ + ] χ 2 (α) = A(θ) (d) The confidence interval is given by definition by: S(X) = {θ X A(θ)} Reverting the inequalities of the acceptance region: X A(θ) θ χ 2 (α) X θ + χ 2 (α) X χ 2 (α) θ X + χ 2 (α) We deduce that: S(X) = [ X χ 2 (α), X + ] χ 2 (α) (e) As illustrate in the picture (Figure??), the acceptance region of θ, θ 2 and θ 3 are the green (A(θ )), blue (A(θ 2 )), and red (A(θ 3 )) region respectively. Note that X A(θ ), X A(θ 2 ) but X / A(θ 3 ). The black thick line segment is the confidence interval C(X). Correspondingly, θ C(X), θ 2 C(X), but θ 3 / C(X). 2
Figure : Confidence Intervals and Acceptance Regions Exercise 4: A uniformly most powerful test and a corresponding most accurate confidence interval (a) For simplicity, let X () X (2),..., X (n) be the order statistics of (X,..., X n ). Intuitively, if X (n) > θ the true support of X is definitely larger than [, θ ], so we can immediately reject the hypothesis θ = θ ; this is the reason why φ is a reasonable test. So φ has level α. E θ φ (X,..., X n ) = α (b) First we need to check that φ is still a level α test for the new null hypothesis H : θ θ. For θ θ E θ φ (X,..., X n ) = αp θ (X (n) θ ) = α Now we have seen that φ is indeed a level α test for the one-sided hypothesis. For any test φ (X,..., X n ) that is also a level α test for the one-sided hypothesis testing problem, it also satisfies E θ φ (X,.,,, X n ) α For θ > θ, since we know φ is the UMP test for θ = θ against θ = θ, E θ φ (X,.., X n ) E θ φ (X,..., X n ) and this is true for θ θ. This shows that φ is the UMP test for the hypothesis testing problem: H : θ θ against H : θ > θ. 3
(c) Again we first need to check that φ 2 is of level α under the null hypothesis. E θ φ 2 = P θ (X (n) θ α /n ) = (α /n ) n = α For an arbitrary test of level α, say,, so that E θ α We show that E θ Eθ φ 2 for θ θ. We discuss θ < θ and θ > θ respectively. θ < θ The power of φ 2 is E θ φ 2 = P θ (X (n) min(θ α /n ( θ, θ)) = α θ α /n < θ o.w. In the case where θ α /n θ, the power of is automatically bounded by, thus we only consider the case where θ α /n < θ. The power of is E θ =Eθ X(n) θ α /n + E θ X(n) >θ α /n = X (n) θ α /n θ n dx + X (n) >θ α /n θ n dx = ( θ X (n) θ α /n θ n dx + ( θ θ X (n) >θ α /n θ n dx ( θ ( X (n) θ α /n θ n dx + θ X (n) >θ α /n θ n dx) = ( θ E θ ( θ α = E θ φ 2 θ > θ In this case, the power of φ 2 is given by E θ φ 2 = P θ (X (n) θ α /n ) + P θ (X (n) > θ ) = ( θ α + ( θ For test of level α, that is, E θ α, its power at θ is E θ = X (n) θ θ n dx + θ X (n) >θ θ n dx ( θ X (n) θ θ n dx + P θ (X (n) > θ ) = ( θ E θ + ( θ ( θ α + ( θ = E θ φ 2 So far we have shown E θ Eθ φ 2 for θ θ and level α test, which means φ 2 is the UMP test. 4
(d) Here we invert the UMP test to get the uniformly most accurate confidence interval. The UMA confidence interval is given by S(X) = {θ : θα /n X (n) θ} Then {θ S(X)} = {θα /n X (n) θ} = {X (n) θ X (n) α n } The UMA confidence interval is [X (n), X (n) α n ]. Exercise 5: Many tests (a) Given X R, a level α =.5 test can be rejecting the null when X z.975 where z.975 is the 97.5% quantile of standard normal distribution. The power of this test is P µ=2.8 ( X z.975 ) = P µ=2.8 (X z.975 ) + P µ=2.8 (X z.975 ) = P µ=2.8 (X 2.8 z.975 2.8) + P µ=2.8 (X 2.8 z.975 2.8) = Φ(z.975 2.8) + Φ( z.975 2.8) =.8 Figure?? illustrates the power and level of the test: the shaded area is the rejection region. The area under the left curve is the level and the area under the right curve is the power of the test. (b)(c) See attached Rmarkdown file. Exercise 6: Confidence intervals after selection (a) The confidence interval is [X i z.975, X i +z.975 ], where z.975 =.96 is the.975 quantile of standard normal distribution. (b) set. seed (24) N = alpha =.5 mu =.3 X = rnorm (n=n, mean =mu, sd=) CIs = cbind (X -.96, X +.96) print ( sum (( mu >= CIs [,]) * (mu <= CIs [,2 ]))) There are 948 out of confidence intervals covering the true value µ i =.3. (c) pvals = 2*(-pnorm ( abs (X ))) active = ( pvals <= alpha ) CI_ active = cbind (X[ active ] -.96, X[ active ] +.96) print ( sum (( mu >= CI_ active [, ])*( mu <= CI_ active [,2 ])) / sum ( active )) 5
-5 5 x Figure 2: level and power of the test The proportion of these confidence intervals that cover the true model parameter is.44. (d) alpha _b = alpha /. active _b = ( pvals <= alpha _b) CI_ active _b = cbind (X[ active _b] -.96, X[ active _b] +.96) print ( sum (( mu >= CI_ active _b[, ])*( mu <= CI_ active _b[,2 ])) / sum ( active _b)) With the α for hypothesis testing so small, none of the tests are rejected. We are being very conservative with the tests and controlling the overall error of any false rejection at nominal level.5 by seldom making any rejection at all. Exercise 7: Permutation tests for correlation See attached Rmarkdown file. 6