Python應用math模塊分析保險理- 學習筆記

泊松分佈
泊松分佈:
Poisson分佈,是一種統計與概率學裏常見到的離散概率分佈,由法國數學家西莫恩·德尼·泊松(Siméon-Denis Poisson)在1838年時發表。
一般情況下假設隨機時間發生的次數爲X且服從泊松分佈,那麼發生次數等於K的時候概率滿足以下公式
P(x=k)=λkk!×eλP(x=k)=\frac{\lambda^{k}}{k!} \times e^{-\lambda}
設計保險產品是需要知道一年內多少人投保
以及假定理賠人數服從泊松分佈,見卷期間不考慮其他費用和成本
那麼假設保險理賠概率爲0.4%當年10000人投保
簡單求出盈虧平衡及實現盈利的概率

def poisson(k,Lambda):
    from math import exp,factorial
    P=pow(Lambda,k)*exp(-Lambda)/factorial(k)
    return P
n=10000
prob=0.004
premium=100
cost=20000
L=n*prob
K_breakeven=n*premium/cost
prob_breakeven=poisson(K_breakeven,L)
print(round(prob_breakeven,6))
profit1=2e5
profit2=4e5
profit3=6e5
K1=(n*premium-profit1)/cost
K2=(n*premium-profit2)/cost
K3=(n*premium-profit3)/cost
prob1=poisson(K1,L)
prob2=poisson(K2,L)
prob3=poisson(K3,L)
print(prob1,' ',prob2,' ',prob3)
import math
prob_list=[]
K_breakeven=math.trunc(K_breakeven)
for i in range(K_breakeven):
    P=poisson(i,L)
    prob_list.append(P)
prob_profit=math.fsum(prob_list)
print(round(prob_profit,6))
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章