Percentile Method with the infer Package
Explore constructing 95% confidence intervals using the percentile and standard error methods with bootstrapped data in R. Understand how to apply the infer package functions to compute and visualize these intervals, enhancing your data inference skills in statistical modeling.
We'll cover the following...
Recall the percentile method for constructing 95% confidence intervals we introduced in the Understanding Confidence Intervals lesson. This method sets the lower endpoint of the confidence interval at the 2.5th percentile of the bootstrap distribution and similarly sets the upper endpoint at the 97.5th percentile. The resulting interval captures the middle 95% of the values of the sample mean in the bootstrap distribution.
We can compute the 95% confidence interval by piping bootstrap_distribution into the get_confidence_interval() function from the infer package. Here, the confidence level will be set to 0.95 and the confidence interval type will be "percentile". Let’s save the results in percentile_ci.
Alternatively, we can visualize the interval (1991, 1999) by piping the bootstrap_distribution data frame into the visualize() function and adding a ...