開始使用免費開始

為中位數產生自助抽樣分佈

在建立單一統計量的自助抽樣分佈時,首先要產生一系列自助抽樣重抽樣,接著紀錄每個重抽樣分佈的相關統計量(本題為中位數)。

在本練習中,已為你載入 tidyverse 套件(包含 ggplot2),以及 infer

本練習屬於課程

R 數值資料推論

檢視課程

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Generate bootstrap distribution of medians
rent_med_ci <- manhattan %>%
  # Specify the variable of interest
  ___(response = ___) %>%  
  # Generate 15000 bootstrap samples
  ___(reps = ___, type = "___") %>% 
  # Calculate the median of each bootstrap sample
  ___(stat = "___")
  
# View its structure
str(rent_med_ci)
編輯並執行程式碼