卜瓦松分配

Python 統計學入門

Maggie Matsui

Content Developer, DataCamp

卜瓦松程序(Poisson processes)

  • 事件以某固定速率發生,但完全隨機
  • 範例
    • 每週從動物收容所被認養的數量
    • 每小時抵達餐廳的人數
    • 加州每年的地震次數
  • 只要討論同一情境,時間單位不影響結果,保持一致即可

  與家人在收容所裡的狗

Python 統計學入門

卜瓦松分配

  • 在固定期間內發生某個事件次數的機率
  • 範例
    • 每週有 $\ge$ 5 隻動物被認養的機率
    • 每小時有 12 人抵達餐廳的機率
    • 加州每年地震少於 $\lt$ 20 次的機率
Python 統計學入門

Lambda($\lambda$)

  • $\lambda$ = 每個時間區間的平均事件數
    • 每週平均認養數 = 8

 

λ = 8 的卜瓦松分配

Python 統計學入門

λ 對應分配的峰值

 

3 個卜瓦松分配:一個 λ = 1,一個 λ = 5,另一個 λ = 8

Python 統計學入門

單一值的機率

若每週平均認養數為 8,則 $P(\text{\# adoptions in a week} = 5)$ 是多少?

from scipy.stats import poisson

poisson.pmf(5, 8)
0.09160366
Python 統計學入門

小於或等於的機率

若每週平均認養數為 8,則 $P(\text{\# adoptions in a week} \le 5)$ 是多少?

from scipy.stats import poisson
poisson.cdf(5, 8)
0.1912361
Python 統計學入門

大於的機率

若每週平均認養數為 8,則 $P(\text{\# adoptions in a week} \gt 5)$ 是多少?

1 - poisson.cdf(5, 8)
0.8087639

若每週平均認養數為 10,則 $P(\text{\# adoptions in a week} \gt 5)$ 是多少?

1 - poisson.cdf(5, 10)
0.932914
Python 統計學入門

從卜瓦松分配取樣

from scipy.stats import poisson
poisson.rvs(8, size=10)
array([ 9,  9,  8,  7, 11,  3, 10,  6,  8, 14])
Python 統計學入門

中心極限定理依然適用!

λ = 8 的卜瓦松分配之樣本平均分配;近似常態分配

Python 統計學入門

一起來練習吧!

Python 統計學入門

Preparing Video For Download...