1. Learn
  2. /
  3. Courses
  4. /
  5. Foundations of Inference in R

Exercise

Percentile effects on bootstrap CIs

Most scientists use 95% intervals to quantify their uncertainty about an estimate. That is, they understand that over a lifetime of creating confidence intervals, only 95% of them will actually contain the parameter that they set out to estimate.

There are studies, however, which warrant either stricter or more lenient confidence intervals (and subsequent error rates).

The previous bootstrapped \(\hat{p}^*\) values have been loaded for you and are available in one_poll_boot.

Instructions

100 XP
  • Calculate a 95% percentile interval by calling get_confidence_interval(), setting level to 0.95.
  • Do the same for a 99% interval,
  • … and a 90% interval.
  • The results you just got are stored in a dataframe called conf_int_data. With this dataset, plot ci_endpoints (vertical axis) vs. ci_percent (horizontal axis), and add a line layer using geom_line().