การแจกแจงความน่าจะเป็นและเรื่องราว: การแจกแจงทวินาม

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

Justin Bois

Teaching Professor at the California Institute of Technology

ฟังก์ชันมวลความน่าจะเป็น (PMF)

  • ชุดของความน่าจะเป็นของผลลัพธ์แบบไม่ต่อเนื่อง
Statistical Thinking in Python (ตอนที่ 1)

PMF แบบสม่ำเสมอไม่ต่อเนื่อง

ch3-3.004.png

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

การแจกแจงความน่าจะเป็น

  • คำอธิบายเชิงคณิตศาสตร์ของผลลัพธ์
Statistical Thinking in Python (ตอนที่ 1)

การแจกแจงแบบสม่ำเสมอไม่ต่อเนื่อง: เรื่องราว

ผลลัพธ์จากการทอยลูกเต๋าหนึ่งด้านที่ยุติธรรมนั้น

  • ไม่ต่อเนื่อง
  • มีการแจกแจงแบบสม่ำเสมอ
Statistical Thinking in Python (ตอนที่ 1)

การแจกแจงทวินาม: เรื่องราว

  • จำนวน r ของความสำเร็จใน n การทดลองแบบเบอร์นูลลี ที่มีความน่าจะเป็น p ของความสำเร็จ มีการแจกแจงแบบทวินาม
  • จำนวน r ของด้านหัวใน 4 การโยนเหรียญ ที่มีความน่าจะเป็น 0.5 ของด้านหัว มีการแจกแจงแบบทวินาม
Statistical Thinking in Python (ตอนที่ 1)

การสุ่มตัวอย่างจากการแจกแจงทวินาม

rng.binomial(4, 0.5)
2
rng.binomial(4, 0.5, size=10)
array([4, 3, 2, 1, 1, 0, 3, 2, 3, 0])
Statistical Thinking in Python (ตอนที่ 1)

PMF ของการแจกแจงทวินาม

samples = rng.binomial(60, 0.1, size=10000)
n = 60
p = 0.1

ch3-3.019.png

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

CDF ของการแจกแจงทวินาม

import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
x, y = ecdf(samples)
_ = plt.plot(x, y, marker='.', linestyle='none')
plt.margins(0.02)
_ = plt.xlabel('number of successes')
_ = plt.ylabel('CDF')
plt.show()
Statistical Thinking in Python (ตอนที่ 1)

CDF ของการแจกแจงทวินาม

ch3-3.022.png

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

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

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

Preparing Video For Download...