Suppose X1, . . . , Xn is a random sample from the Normal(μ, σ2) distribution,...

60.1K

Verified Solution

Question

Statistics

Suppose X1, . . . , Xn is a random sample from the Normal(μ, σ2)distribution, where μ is unknown but σ2 is known, and it is ofinterest to test H0: μ = μ0 versus H1: μ ̸= μ0 for some value μ0.The R code below plots the power curve of the test

Reject H0 iff |√n(X ̄n − μ0)/σ| > zα/2

for user-selected values of μ0, n, σ, and α. For a sequence ofvalues of μ, the code computes the probability that the nullhypothesis will be rejected according to the above test. Inaddition, for each value of μ in the sequence, a simulation is run:100 data sets with sample size n are generated from theNormal(μ,σ2) distribution, and for each of the 100 data sets, it isrecorded whether the null hypothesis was rejected. For each valueof μ, the proportion of times the null hypothesis is rejected isrecorded. This gets plotted as a dashed line.

   mu.0 <- ???   n <- ???   sigma <- ???   alpha <- ???
   mu.seq <- seq(mu.0 - 5,mu.0 + 5,length=50)   power.theoretical <- numeric()   power.empirical <- numeric()   for(j in 1:length(mu.seq))
   {     power.theoretical[j] <- 1-(pnorm(qnorm(1-alpha/2)-sqrt(n)*(mu.seq[j] - mu.0)/sigma)
reject <- numeric()for(s in 1:100){

}

-pnorm(-qnorm(1-alpha/2)-sqrt(n)*(mu.seq[j] - mu.0)/sigma))
x <- rnorm(n,mu.seq[j],sigma)x.bar <- mean(x)
reject[s] <- abs(sqrt(n)*(x.bar-mu.0)/sigma) > qnorm(1-alpha/2)
    power.empirical[j] <- mean(reject)  }
  plot(mu.seq,power.theoretical,type=\"l\",ylim=c(0,1),xlab=\"mu\",ylab=\"power\")  lines(mu.seq, power.empirical,lty=2)  abline(v=mu.0,lty=3) # vert line at null value  abline(h=alpha,lty=3) # horiz line at size

(a) Putinμ0 =2,n=5,σ=2,andα=0.05andexecutethecode.Turnintheplot.

(b) Explain why the dashed line follows the solid line closelybut not exactly.

(c) Interpret the height of the solid line at μ = 4.

(d) Interpret the height of the solid line at μ = 2.

(e) Interpret the height of the dashed line at μ = 2.

(f) What would be the effect on the height of the solid line atμ = 4 if i. the sample size n were increased?

ii. the standard deviation σ were increased? iii. the size α ofthe test were increased?

(g) What would be the effect on the height of the solid line atμ = 2 if i. the sample size n were increased?

ii. the standard deviation σ were increased? iii. the size α ofthe test were increased?

(h) What would be the effect on the dashed line of generating500 data sets instead of only 100 data sets for the simulation ateach value of μ?

Answer & Explanation Solved by verified expert
4.2 Ratings (752 Votes)
Here n 25If 03 03 otherwiseProbability of a Standard normal distribution provides variancebetween 0 and 1In standard distribution mean will be zero and Z mean value 05and Z value    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students