BaşlayınÜcretsiz Başlayın

Sample size effects on bootstrap CIs

In a previous multiple choice exercise, you realized that if you resampled the data with the wrong size (e.g. 300 or 3 instead of 30), the standard error (SE) of the sample proportions was off. With 300 resampled observations, the SE was too small. With 3 resampled observations, the SE was too large.

Here, you will use the incorrect standard error (based on the incorrect sample size) to create a confidence interval. The idea is that when the standard error is off, the interval is not particularly useful, nor is it correct.

Bu egzersiz

Foundations of Inference in R

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • A function for calculating the bootstrapped t-confidence interval, calc_t_conf_int(), is shown is the script. Read the code and try to understand it.
  • Call calc_t_conf_int() on one_poll_boot to calculate the correct t-confidence interval.
  • Do the same on one_poll_boot_300, to find an incorrect interval for the resamples of size 300.
  • Do the same on one_poll_boot_3, to find an incorrect interval for the resamples of size 3.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

calc_t_conf_int <- function(resampled_dataset) {
  resampled_dataset %>%
    summarize(
      lower = p_hat - 2 * sd(stat),
      upper = p_hat + 2 * sd(stat)
    )
}

# Find the bootstrap t-confidence interval for 30 resamples
calc_t_conf_int(___)

# ... and for 300 resamples
___

# ... and for 3 resamples
___
Kodu Düzenle ve Çalıştır