泊松分布

Python 统计学入门

Maggie Matsui

Content Developer, DataCamp

泊松过程

  • 事件以某一速率发生,但完全随机
  • 示例
    • 动物收容所每周被收养的动物数
    • 餐厅每小时到达的人数
    • 加州每年的地震次数
  • 只要同一情境中使用一致的时间单位,具体单位无关紧要

  收容所里的狗与一家人

Python 统计学入门

泊松分布

  • 在固定时间内发生某个数量事件的概率
  • 示例
    • 每周收养动物数 $\ge$ 5 的概率
    • 每小时到达餐厅人数为 12 的概率
    • 加州每年地震数 $\lt$ 20 的概率
Python 统计学入门

Lambda($\lambda$)

  • $\lambda$ = 每个时间区间的平均事件数
    • 每周平均收养数 = 8

 

λ=8 的泊松分布

Python 统计学入门

λ 决定分布峰值

 

3 个泊松分布:λ=1、λ=5、λ=8

Python 统计学入门

单个取值的概率

若每周平均收养数为 8,求 $P(\text{\# 一周内收养} = 5)$?

from scipy.stats import poisson

poisson.pmf(5, 8)
0.09160366
Python 统计学入门

小于等于的概率

若每周平均收养数为 8,求 $P(\text{\# 一周内收养} \le 5)$?

from scipy.stats import poisson
poisson.cdf(5, 8)
0.1912361
Python 统计学入门

大于的概率

若每周平均收养数为 8,求 $P(\text{\# 一周内收养} \gt 5)$?

1 - poisson.cdf(5, 8)
0.8087639

若每周平均收养数为 10,求 $P(\text{\# 一周内收养} \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 统计学入门

Passons à la pratique !

Python 统计学入门

Preparing Video For Download...