## D.8 Chapter 8 Solutions

library(tidyverse)
library(moderndive)
library(infer)

(LC8.1) What is the chief difference between a bootstrap distribution and a sampling distribution?

Solution:

A bootstrap sample is a smaller sample that is “bootstrapped” from a larger sample. Bootstrapping is a type of resampling where large numbers of smaller samples of the same size are repeatedly drawn, with replacement, from a single original sample.

(LC8.2) Looking at the bootstrap distribution for the sample mean in Figure 8.14, between what two values would you say most values lie?

Solution:

Most values lie in 1990 amd 2000.

(LC8.3) What condition about the bootstrap distribution must be met for us to be able to construct confidence intervals using the standard error method?

Solution:

We can only use the standard error rule when the bootstrap distribution is roughly normally distributed.

(LC8.4) Say we wanted to construct a 68% confidence interval instead of a 95% confidence interval for $$\mu$$. Describe what changes are needed to make this happen. Hint: we suggest you look at Appendix A.2 on the normal distribution.

Solution:

Thus, using our 68% rule of thumb about normal distributions from Appendix A.2, we can use the following formula to determine the lower and upper endpoints of a 95% confidence interval for $$\mu$$:

$\overline{x} \pm 1 \cdot SE = (\overline{x} - 1 \cdot SE, \overline{x} + 1 \cdot SE)$

(LC8.5) Construct a 95% confidence interval for the median year of minting of all US pennies? Use the percentile method and, if appropriate, then use the standard-error method.

Solution:

Using the percentile method:

bootstrap_distribution <- pennies_sample %>%
specify(response = year) %>%
generate(reps = 1000) %>%
calculate(stat = "median")
percentile_ci <- bootstrap_distribution %>%
get_confidence_interval(level = 0.95, type = "percentile")
percentile_ci
# A tibble: 1 x 2
2.5% 97.5%
<dbl>   <dbl>
1   1988    2000

The standard-error method is not appropriate, because the bootstrap distribution is not bell-shaped:

visualize(bootstrap_distribution)