概要¶
ガンマ分布(gamma distribution)は非負の実数直線上の代表的な確率分布である。指数分布やカイ二乗分布を特殊ケースとして含む柔軟な分布族であり、待ち時間や生存時間のモデリング、ベイズ統計における共役事前分布として広く用いられる。
確率密度関数¶
shape-scale パラメタリゼーション¶
: shape parameter(形状パラメータ)
: scale parameter(尺度パラメータ)
shape-rate パラメタリゼーション¶
尺度変換を行った
という定義も使われる(はrate parameterと呼ばれる)。
import numpy as np
import matplotlib.pyplot as plt
from scipy.special import gamma
x = np.linspace(0.1, 6, 100)
y = gamma(x)
fig, ax = plt.subplots(figsize=[4, 2.5])
ax.plot(x, y)
ax.set(title=r"Gamma function $\Gamma(\alpha)$", xlabel=r"$\alpha$", ylabel=r"$\Gamma(\alpha)$")
fig.show()図¶
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import gamma as gamma_dist
x = np.linspace(0, 20, 200)
fig, axes = plt.subplots(1, 2, figsize=[8, 3])
for alpha in [1, 3, 5, 10]:
pdf = gamma_dist.pdf(x, alpha)
axes[0].plot(x, pdf, label=fr"$\alpha={alpha}, \beta=1$")
cdf = gamma_dist.cdf(x, alpha)
axes[1].plot(x, cdf, label=fr"$\alpha={alpha}, \beta=1$")
axes[0].set(title="PDF", xlabel="x", ylabel="f(x)")
axes[0].legend()
axes[1].set(title="CDF", xlabel="x", ylabel="F(x)")
axes[1].legend()
fig.tight_layout()
fig.show()性質¶
のとき指数分布 に一致する
のとき自由度のカイ二乗分布に一致する
再生性: が独立なら
指数型分布族に属する
ポアソン分布の共役事前分布である
尺度変換を行うと、の分布はに依存しない標準形となる
応用例¶
待ち時間のモデリング(ポアソン過程で個の事象が起きるまでの時間)
ベイズ統計におけるポアソン分布のrate parameterの共役事前分布
保険数理における請求額の分布
降雨量のモデリング