Question: here is myrchisq function as mentioned in the problem description. myrchisq=function(k,n) { v=NULL for(i in 1:k) { x=runif(n,0,1) y=runif(n,0,1) z=sqrt(-(2*log(x)))*cos(2*pi*y) v=c(v,sum(z^2)) } return(v) } Problem
here is myrchisq function as mentioned in the problem description.
myrchisq=function(k,n)
{
v=NULL
for(i in 1:k)
{
x=runif(n,0,1)
y=runif(n,0,1)
z=sqrt(-(2*log(x)))*cos(2*pi*y)
v=c(v,sum(z^2))
}
return(v)
}

Problem 5 Suppose we have 2 groups- the first with n observations such that X1, X2,..., Xni ~ xi lid and group 2 has ny observations such that Y1, 12, ..., Ymz ~ x/. The researchers are interested in testing the hypothesis Hock= Ha:kal Let k = 11,/ = 12. i. Suppose n1 = ng = 500. Test your myrchisq( created in Problem 2) function by creating two QQ plots of your realizations compared to the true distributions of both X and Y . Use the Ist, 2nd,..., and 99th percentiles (so the plots have 99 points). You may use qchisq to do this problem. Comment on the results. 2 ii. The researchers will use the two independent samples model to build a test statistic for their hypothesis. Use simulation to find the value of ni = n2 such that the power of the the two independent sample { - test is roughly 90%. when a = .05. Use 10" replications. Conclue your results.(10 points)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
