Type I Error and Power using Monte Carlo Simulations


I have an R Term Project using RStudio. Please help.

If you want to open it on RStudio
my.x < - rnorm(50,0,1)

  1. Consider a normal population with mean \mu=2 and variance \sigma^2=1. and testing the hypotheses: $$H_0: \mu=2 \mbox{ versus } H_1: \mu=3.$$ The decision rule is to reject H_0 if the sample mean, \bar{x} is larger than 2.5. Write code to estimate the probability Type-I error as well as the power of the test based on K=1000 Monte Carlo simulations. Print these two quantities.