Chapter 4: Problem 11
Let \(X_{1}, \ldots, X_{n}\) be a random sample from a \(N(0,1)\) distribution. Then the probability that the random interval \(\bar{X} \pm t_{\alpha / 2, n-1}(s / \sqrt{n})\) traps \(\mu=0\) is \((1-\alpha)\). To verify this empirically, in this exercise, we simulate \(m\) such intervals and calculate the proportion that trap 0, which should be "close" to \((1-\alpha)\). (a) Set \(n=10\) and \(m=50\). Run the \(\mathrm{R}\) code mat=matrix (rnorm \((\mathrm{m} * \mathrm{n}), \mathrm{n} \overline{\mathrm{col}=\mathrm{n}})\) which generates \(m\) samples of size \(n\) from the \(N(0,1)\) distribution. Each row of the matrix mat contains a sample. For this matrix of samples, the function below computes the \((1-\alpha) 100 \%\) confidence intervals, returning them in a \(m \times 2\) matrix. Run this function on your generated matrix mat. What is the proportion of successful confidence intervals? (b) Run the following code which plots the intervals. Label the successful intervals. Comment on the variability of the lengths of the confidence intervals.
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.