Get startedGet started for free

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.

This exercise is part of the course

Foundations of Inference in R

View Course

Exercise instructions

  • 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().

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Calculate a 95% bootstrap percentile interval
one_poll_boot %>% 
  ___(___) 

# Calculate a 99% bootstrap percentile interval
___ %>% 
  ___(___) 

# Calculate a 90% bootstrap percentile interval
___ %>% 
  ___(___) 

# Plot ci_endpoints vs. ci_percent to compare the intervals
ggplot(conf_int_data, aes(___, ___)) +
  # Add a line layer
  ___()
Edit and Run Code