Pairs bootstrap

Statistical Thinking in Python (ตอนที่ 2)

Justin Bois

Lecturer at the California Institute of Technology

การอนุมานแบบไม่อิงพารามิเตอร์

  • ไม่ตั้งสมมติฐานเกี่ยวกับโมเดลหรือการแจกแจงความน่าจะเป็นของข้อมูล
Statistical Thinking in Python (ตอนที่ 2)

ผลการเลือกตั้งในรัฐสวิงของสหรัฐอเมริกา ปี 2008

ch2-3.004.png

1 Data retrieved from Data.gov (https://www.data.gov/)
Statistical Thinking in Python (ตอนที่ 2)

Pairs bootstrap สำหรับการถดถอยเชิงเส้น

  • สุ่มตัวอย่างข้อมูลเป็นคู่
  • คำนวณความชันและจุดตัดแกนจากข้อมูลที่สุ่มมา
  • ค่าความชันและจุดตัดแกนแต่ละคู่คือ bootstrap replicate
  • คำนวณช่วงความเชื่อมั่นจาก percentile ของ bootstrap replicates
Statistical Thinking in Python (ตอนที่ 2)

การสร้าง pairs bootstrap sample

np.arange(7)
array([0, 1, 2, 3, 4, 5, 6])
inds = np.arange(len(total_votes))

bs_inds = np.random.choice(inds, len(inds))
bs_total_votes = total_votes[bs_inds] bs_dem_share = dem_share[bs_inds]
Statistical Thinking in Python (ตอนที่ 2)

การคำนวณ pairs bootstrap replicate

bs_slope, bs_intercept = np.polyfit(bs_total_votes, 
                                    bs_dem_share, 1)

bs_slope, bs_intercept
(3.9053605692223672e-05, 40.387910131803025)
np.polyfit(total_votes, dem_share, 1)  # fit of original
array([  4.03707170e-05,   4.01139120e+01])
Statistical Thinking in Python (ตอนที่ 2)

ผลการเลือกตั้งในรัฐสวิงของสหรัฐอเมริกา ปี 2008

ch2-3.022.png

1 Data retrieved from Data.gov (https://www.data.gov/)
Statistical Thinking in Python (ตอนที่ 2)

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

Statistical Thinking in Python (ตอนที่ 2)

Preparing Video For Download...