Questions 1-6 are from the textbook. You are allowed to use R for any of these, but please plan on turning a hard copy of your solutions into class (handwritten or printed is OK)
Question 1: 1.3
Question 2: 1.4
Question 3: 1.7. For Part (b), also compare the probability distribution given with a binomial. Identify why the distribution function given should be used instead of the binomial
Question 4: 1.12. Part (d) can be determined using
prop.test(). It may be a fun exercise to see if you can
write a function to do this without prop.test() as well,
but this is optional.
binom.test() for this, though this instead gives yet
another confidence interval.?prop.test() to see how the
score should be implemented without a correctionbinom.test() that’s
fineQuestion 5: 1.13
Question 6: 1.15
Question 7:
\[ \hat{\lambda} = \frac{1}{n} \sum_{i=1}^n x_i \]
For this exercise, we will investigate comparative coverage of the Wald and Score confidence intervals for varying levels of \(\pi\) using simulation. Specifically, for a nominal 95% confidence interval, we want to estimate the proportion of repeated samples for which the derived confidence interval actually contains the true value of \(\pi\).
The simulation should use the following settings:
The final product should be a ggplot with \(\pi\) on the x-axis and the estimated coverage probability on y-axis, with separate lines for the Score and Wald intervals. Include a horizontal reference line at \(y = 0.95\). Describe the resulting plot in 2-3 sentences.
Useful functions, though you may not need all (see e.g.,
?rbinom() for use of each):
rbinom()seq()replicate()mean(c(TRUE, TRUE, FALSE)) <- useful trick to
knowsapply()prop.test(x, n, correct = FALSE)$conf.int to get Score
interval