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
.
Cet exercice fait partie du cours
Foundations of Inference in R
Instructions
- Calculate a 95% percentile interval by calling
get_confidence_interval()
, settinglevel
to0.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, plotci_endpoints
(vertical axis) vs.ci_percent
(horizontal axis), and add a line layer usinggeom_line()
.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de 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
___()