ComeçarComece de graça

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.

Este exercício faz parte do curso

Foundations of Inference in R

Ver curso

Instruções do exercício

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

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# 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
  ___()
Editar e executar o código