Question

# Let W = Y U + (1 − Y )V , where Y ∼ Bern(θ), U ∼ N(µ1, σ2 1 ), V ∼ N(µ2, σ2 2 ) and Y, U, V are

independent, i.e., W is a mixture of normal distributions and we know E(W) = θµ1 + (1 − θ)µ2. Suppose we have W1, W2, . . . , Wn being independent copies of W. We are interested in testing the hypotheses H0 : θµ1 + (1 − θ)µ2 = 0 and Ha : θµ1 + (1 − θ)µ2 ̸= 0 using a two-sided t-test. 1 (a) (4 points) Let T = √ n(W¯ −0)/S be the usual t-test test statistic. Perform a simulation study to check whether the distribution of T is well approximated by a t-distribution with n − 1 degrees of freedom when n = 200, θ = 0.5, µ1 = −1, µ2 = 1, σ2 1 = 0.5 2 , σ2 2 = 1. Use a QQ-plot to evaluate the distribution and set reps=104 . Comment on the result. When calculating the theoretical percentiles in QQ-plot, you may use qt function in R. (b) (4 points) Create a function named reject.prob to estimate the probability that the null hypothesis will be rejected under difference data generating distributions. Your function should have the following parameters: • n: sample size in each realization of the data • mean0: hypothesized mean of the distribution • theta: weight of the first component of the distribution • mu1: mean of the first normal component • sigma1: standard deviation of the first normal component • mu2: mean of the second normal component • sigma2: standard deviation of the second normal component • alpha: significance level of the test • reps: number of replications of Monte Carlo simulation. And it should return a estimated rejection probability. (c) (4 points) Let α = 0.05. Calculate the number of replications needed to estimate Type I error probability of the test with a margin of error of at most 0.01 at the conservative approximate 99% confidence level. (d) (4 points) Test your function by estimating the type I error probability of the test H0 : θµ1+(1−θ)µ2 = 0 and Ha : θµ1 + (1 − θ)µ2 ̸= 0 when n = 200, θ = 0.5, µ1 = −1, µ2 = 1, σ2 1 = 0.5 2 , σ2 2 = 1, α = 0.05 using reps calculated above. Create a 99% Wald CI for the Type I error probability. (e) (4 points) Test your function by producing a plot of a simulated estimate of the power curve of the test H0 : θµ1 + (1−θ)µ2 = 0 and Ha : θµ1 + (1−θ)µ2 ̸= 0 by using n = 200, θ = 0.5, µ1 = −1, , σ2 1 = 0.5 2 , σ2 2 = 1, µ2 ∈ {1, 1.05, 1.1, . . . , 2} using reps calculated above.

### Recently Asked Questions

- 13. Nick got a bag full of colorful jelly beans. There were 40 of them: 10 were red, 4 were yellow, 5 were orange, and 11 were blue. After shaking the bag, he

- clear answer please

- The waiting times between a subway departure schedule and the arrival of a passenger are uniformly distributed between 0 and 6 minutes. Find the probability