Inference for Numerical Data in R
Mine Cetinkaya-Rundel
Associate Professor of the Practice, Duke University
On a given day, twenty 1 BR apartments were randomly selected on Craigslist Manhattan from apartments listed as "by owner" (as opposed to by a rental agency).
Is the mean or the median a better measure of typical rent in Manhattan?
sample median = $2,350
Take a bootstrap sample - a random sample taken with replacement from the original sample, of the same size as the original sample.
Calculate the bootstrap statistic - a statistic such as mean, median, proportion, etc. computed on the bootstrap samples.
Repeat steps (1) and (2) many times to create a bootstrap distribution - a distribution of bootstrap statistics.
library(infer)
___ %>% # start with data frame
specify(response = ___) %>% # specify the variable of interest
library(infer)
___ %>% # start with data frame
specify(response = ___) %>% # specify the variable of interest
generate(reps = ___, type = "bootstrap") %>% # generate bootstrap samples
library(infer)
___ %>% # start with data frame
specify(response = ___) %>% # specify the variable of interest
generate(reps = ___, type = "bootstrap") %>% # generate bootstrap samples
calculate(stat = "___") # calculate bootstrap statistic
library(infer)
___ %>% # start with data frame
specify(response = ___) %>% # specify the variable of interest
generate(reps = ___, type = "bootstrap") %>% # generate bootstrap samples
calculate(stat = "___") # calculate bootstrap statistic
library(infer)
___ %>% # start with data frame
specify(response = ___) %>% # specify the variable of interest
generate(reps = ___, type = "bootstrap") %>% # generate bootstrap samples
calculate(stat = "___") # calculate bootstrap statistic
Inference for Numerical Data in R