Question 1: 2.1

Question 2: 2.7

Question 3: 2.12

Question 4: 2.17 Parts (a) and (c)

Question 5: 2.20. Actually for this question, do this instead:

\[ \sum \frac{(n_{ij} - \mu_{ij})^2}{\mu_{ij}} = n \sum \frac{(\hat{\pi}_{ij} - \hat{\pi}_{i+} \hat{\pi}_{+j})^2}{\hat{\pi}_{i+} \hat{\pi}_{+j}} \]

\[ \begin{array}{c|cc} & Y=1 & Y=0 \\ \hline X=1 & 55 & 45 \\ X=0 & 50 & 50 \end{array} \]

Question 6: 2.28

Question 7: 2.30

Question 8: This question involves Fisher’s exact test. We will do this in class, but you should turn in your finished document as a part of your second homework.

Question 9: This question will investigate the large-sample normal approximation for the sampling distribution of \(\log \widehat{\theta}\) described in Section 2.3.3. We will do this in several steps:

  1. First, write a small simulation to bootstrap the odds ratio (rather than the log odds) to estimate the sampling distribution (use \(B = 2000\) replicates for this). Plot the resulting distribution and use its quantiles to construct a 95% confidence interval. Outside of dplyr and ggplot2, do not use any external R packages

  2. Take the log of your bootstrapped odds ratios and plot the resulting distribution. Comment on its shape and whether it is approximately normal

  3. Using the methods in Section 2.3.3, construct a 95% confidence interval for \(\log \theta\), then exponentiate the endpoints to obtain a 95% confidence interval for \(\theta\).

  4. Repeat Steps (1)–(3) for each of the tables given below. How similar are the bootstrap and large-sample approximation confidence intervals? How does sample size affect the apparent normality of \(\log \widehat{\theta}\) and the usefulness of the large-sample approximation? Summarize your findings in 2–3 sentences.

\[ \begin{array}{c|cc} & Y=0 & Y=1 \\ \hline X=0 & 193 & 42 \\ X=1 & 181 & 117 \end{array} \qquad \begin{array}{c|cc} & Y=0 & Y=1 \\ \hline X=0 & 21 & 5 \\ X=1 & 17 & 13 \end{array} \]

It is worth carefully considering how to reconstruct individual observations from data summarized as a table so that you can generate bootstrap samples. Useful functions include: