Bootstrap hypothesis tests

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

Justin Bois

Lecturer at the California Institute of Technology

ขั้นตอนการทดสอบสมมติฐาน

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

Michelson และ Newcomb: ผู้บุกเบิกความเร็วแสง

ch3-3.008.png

1 ภาพ Michelson: สาธารณสมบัติ, Smithsonian 2 ภาพ Newcomb: US Library of Congress
Statistical Thinking in Python (ตอนที่ 2)

Michelson และ Newcomb: ผู้บุกเบิกความเร็วแสง

ch3-3.010.png

1 ภาพ Michelson: สาธารณสมบัติ, Smithsonian 2 ภาพ Newcomb: US Library of Congress
Statistical Thinking in Python (ตอนที่ 2)

ข้อมูลที่มีอยู่

ch3-3.011.png

1 ข้อมูล: Michelson, 1880
Statistical Thinking in Python (ตอนที่ 2)

สมมติฐานหลัก

  • ค่าเฉลี่ยจริงของความเร็วแสงในการทดลองของ Michelson คือค่าที่ Newcomb รายงานไว้
Statistical Thinking in Python (ตอนที่ 2)

การเลื่อนข้อมูลของ Michelson

newcomb_value = 299860  # km/s
michelson_shifted = michelson_speed_of_light \\
           - np.mean(michelson_speed_of_light) + newcomb_value

ch3-3.019.png

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

การคำนวณสถิติทดสอบ

def diff_from_newcomb(data, newcomb_value=299860):
    return np.mean(data) - newcomb_value
diff_obs = diff_from_newcomb(michelson_speed_of_light)

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

การคำนวณ p-value

bs_replicates = draw_bs_reps(michelson_shifted,
                             diff_from_newcomb, 10000)

p_value = np.sum(bs_replicates <= diff_observed) / 10000
p_value
0.16039999999999999
Statistical Thinking in Python (ตอนที่ 2)

 

การทดสอบแบบหนึ่งกลุ่มตัวอย่าง

- เปรียบเทียบข้อมูลชุดเดียวกับตัวเลขค่าเดียว

 

การทดสอบแบบสองกลุ่มตัวอย่าง

- เปรียบเทียบข้อมูลสองชุด
Statistical Thinking in Python (ตอนที่ 2)

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

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

Preparing Video For Download...