0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ポアソン分布を理解するために試してみた

Last updated at Posted at 2021-07-11

E資格受験勉強中です。

二項分布を理解するために試してみた
の続きです。

ポアソン分布

Wikipadia:ポアソン分布 では
「ある時間間隔で発生する事象の回数を表す離散確率分布である。」
と説明されています。

Pythonでは random.poisson で計算できます。
random.poisson に与えるパラメータは 期待値(λ)、サンプル数です。
random.poisson からの戻り値はサンプル毎の事象が発生する回数です。

ちょっと分かりにくいのでパラメータを変えて試してみます。

試すためのしくみを作る

poisson.py
import numpy as np
import matplotlib.pyplot as plt

def poisson(lamb):
    np.random.seed(0)
    x = np.random.poisson(lamb,1000)
    fig, ax = plt.subplots()
    ax.hist(x)
    plt.grid(True)

期待値が0の場合

何度やっても事象は発生しません。

poisson(0)

image.png

期待値が1の場合

poisson(1)

0回か1回になることが7割以上になります。
image.png

期待値が2の場合

1、2となることが多く、0や3以上にもすそ野が広がっています。

poisson(2)

image.png

期待値を上げていった場合

少しずつ正規分布に近づいているような感じでしょうか。

image.png

image.png

image.png

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?