การอนุมานสำหรับข้อมูลเชิงตัวเลขใน R
Mine Cetinkaya-Rundel
Associate Professor of the Practice, Duke University
ในวันหนึ่ง มีการสุ่มเลือกอพาร์ตเมนต์ขนาด 1 ห้องนอน จำนวน 20 แห่งจาก Craigslist Manhattan โดยคัดเฉพาะประกาศ "by owner" (ให้เช่าโดยเจ้าของโดยตรง ไม่ผ่านเอเจนซี)
ค่าเฉลี่ยหรือค่ามัธยฐานเหมาะกว่ากันในการวัดค่าเช่าทั่วไปใน Manhattan?

ค่ามัธยฐานของกลุ่มตัวอย่าง = $2,350


สุ่ม Bootstrap sample — สุ่มตัวอย่างแบบใส่คืน (with replacement) จากกลุ่มตัวอย่างเดิม ขนาดเท่ากับกลุ่มตัวอย่างต้นฉบับ
คำนวณ Bootstrap statistic — ค่าสถิติ เช่น ค่าเฉลี่ย ค่ามัธยฐาน สัดส่วน ฯลฯ จาก Bootstrap sample
ทำขั้นตอนที่ (1) และ (2) ซ้ำหลายครั้ง เพื่อสร้าง Bootstrap distribution — การกระจายของ Bootstrap statistic
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

การอนุมานสำหรับข้อมูลเชิงตัวเลขใน R