Write a program in (mathrm{R}) that simulates 1000 samples of size (n) from a distribution (F) with
Question:
Write a program in \(\mathrm{R}\) that simulates 1000 samples of size \(n\) from a distribution \(F\) with mean \(\theta\), where \(n, F\), and \(\theta\) are specified below. For each sample test the null hypothesis \(H_{0}: \theta \leq 0\) against the alternative hypothesis \(H_{1}: \theta>0\) using two different tests. In the first test the null hypothesis is rejected if \(n^{1 / 2} \hat{\sigma}_{n}^{-1} \bar{X}_{n}>z_{0.90}\) and in the second test the null hypothesis is rejected if \(n^{1 / 2} \hat{\sigma}_{n}^{-1} \bar{X}_{n}>t_{0.90, n-1}\). Keep track of how many times each test rejects the null hypothesis over the 1000 replications for \(\theta=0.0,0.10 \sigma, 0.20 \sigma, \ldots, 2.0 \sigma\) where \(\sigma\) is the standard deviation of \(F\). Plot the number of rejections against \(\theta\) for each test on the same set of axes, and repeat the experiment for \(n=5,10,25,50\) and 100. Discuss the results in terms of the power functions of the two tests.
a. \(F\) is a \(\mathrm{N}(\theta, 1)\) distribution.
b. \(F\) is a LAPLace \((\theta, 1)\) distribution.
c. \(F\) is a \(\operatorname{Exponential}(\theta)\) distribution.
d. \(F\) is a \(\operatorname{Cauchy}(\theta, 1)\) distribution \(\theta=0.0,0.25, \ldots, 2.0\), where \(\theta\) is taken to be the median (instead of the mean) of the distribution.
Step by Step Answer: