View the step-by-step solution to:

Question

# can you do tcan you do

this right now? I would really appreciate your help

Let W = YU + (1 - Y)V, where Y ~ Bern(0), U ~ N(u1, of), V ~ N(#2, 02) and Y, U, V are
independent, i.e., W is a mixture of normal distributions and we know E(W) = Qui + (1 -0) /2. Suppose
we have W1, W2, . .., Wn being independent copies of W. We are interested in testing the hypotheses Ho :
Qui + (1 -0)/42 = 0 and Ha : Qui + (1 - 0)/42 / 0 using a two-sided t-test.
(a) (4 points) Let T = vn(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 = 0.5, #1 = -1, /2 = 1,01 = 0.5', 02 = 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
. mul: 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 a = 0.05. Calculate the number of replications needed to estimate Type I error proba-
bility 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 Ho : Qui +(1-0)/2 =
0 and Ha : Oui + (1 -0)/2 / 0 when n = 200, 0 = 0.5, #1 = -1, /42 = 1, 0; = 0.52, 0? = 1,0 =
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
Ho : Qui+ (1-0)/42 = 0 and Ha : Ou1 + (1-0)/42 # 0 by using n = 200, 0 = 0.5, #1 = -1, , 0) =
0.52, 02 = 1, /42 6 {1, 1.05, 1.1,..., 2} using reps calculated above.

### Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

• ### -

Study Documents

Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

Browse Documents