knitr::opts_chunk$set(echo = TRUE)
library(SDS100) # simple vector my_sample <- c(3, 1, 4, 1, 5, 9) # resampling values in the vector with replacement
$\$
# simple bootstrap example my_sample <- c(21, 29, 25, 19, 24, 22, 25, 26, 25, 29) # calculate the x-bar statistic # create the bootstrap distribution # visualize the bootstrap distribution # calculate the standard error # 95% confidence interval
$\$
# Get the Gettysburg population data # SDS100::download_data("gettysburg.Rda") load("gettysburg.Rda") word_lengths <- gettysburg$num_letters # We can use the sample(data_vec, n) to get a sample of length n: # calculate the actual x-bar # Let's create a sampling distribution in R # visualize the bootstrap distribution # get the bootstrap standard error SE* # 95% confidence interval # Is the actual parameter value mu in the confidence interval?
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.