ยินดีต้อนรับสู่คอร์ส!

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

Mine Cetinkaya-Rundel

Associate Professor of the Practice, Duke University

ค่าเช่าใน Manhattan

ในวันหนึ่ง มีการสุ่มเลือกอพาร์ตเมนต์ขนาด 1 ห้องนอน จำนวน 20 แห่งจาก Craigslist Manhattan โดยคัดเฉพาะประกาศ "by owner" (ให้เช่าโดยเจ้าของโดยตรง ไม่ผ่านเอเจนซี)

ค่าเฉลี่ยหรือค่ามัธยฐานเหมาะกว่ากันในการวัดค่าเช่าทั่วไปใน Manhattan?

ค่าเช่าใน Manhattan บทที่ 1

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

เทคนิค Bootstrapping

  • สมมติว่าข้อมูลมีความเป็นตัวแทน
  • หลักการ Bootstrapping
การอนุมานสำหรับข้อมูลเชิงตัวเลขใน R

กลุ่มตัวอย่างที่สังเกตได้

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

กลุ่มตัวอย่างและประชากร Bootstrap

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

ประชากร Bootstrap

กลุ่มตัวอย่างและประชากร Bootstrap

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

ขั้นตอน Bootstrapping

  1. สุ่ม Bootstrap sample — สุ่มตัวอย่างแบบใส่คืน (with replacement) จากกลุ่มตัวอย่างเดิม ขนาดเท่ากับกลุ่มตัวอย่างต้นฉบับ

  2. คำนวณ Bootstrap statistic — ค่าสถิติ เช่น ค่าเฉลี่ย ค่ามัธยฐาน สัดส่วน ฯลฯ จาก Bootstrap sample

  3. ทำขั้นตอนที่ (1) และ (2) ซ้ำหลายครั้ง เพื่อสร้าง Bootstrap distribution — การกระจายของ Bootstrap statistic

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

ขั้นตอน Bootstrapping ใน R

library(infer)

___ %>%                               # start with data frame
  specify(response = ___) %>%         # specify the variable of interest
การอนุมานสำหรับข้อมูลเชิงตัวเลขใน R

ขั้นตอน Bootstrapping ใน R

library(infer)

___ %>%                               # start with data frame
  specify(response = ___) %>%         # specify the variable of interest
  generate(reps = ___, type = "bootstrap") %>%  # generate bootstrap samples
การอนุมานสำหรับข้อมูลเชิงตัวเลขใน R

ขั้นตอน Bootstrapping ใน R

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

การสร้าง Bootstrap interval

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

การกระจาย Bootstrap ไม่มีแกน

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

การสร้าง Bootstrap interval

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

การกระจาย Bootstrap ไม่มีแกน พร้อมวงเล็บ

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

มาฝึกกันเถอะ!

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

Preparing Video For Download...