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?

アクチュアリーのためのPython入門(異動契約の保険料積立金)

0
Last updated at Posted at 2026-07-20

アクチュアリーのためのPython入門(決算数理編第4回)

異動契約の保険料積立金の計算

📚 アクチュアリーのためのPython入門
この記事は決算数理編の一部です。
目次はこちら
逆引きガイドはこちら

はじめに

前回は、保有契約のサンプルデータの責任準備金を計算しました。
保険料計算基礎だけではなく、責任準備金基礎や5年チルメル式の計算も必要です。

今回は、異動契約に伴う金額と保険料積立金を集計します。
保険金や解約返戻金は実際に支払った額を集計すればいいですが、
利源分析にはその時の保険料積立金が必要なので計算します。
利源分析に使用するので保険料計算基礎の5年チルメル式です。

また、本来は解約時に解約返戻金を支払っているの計算不要ですが、
せっかくなので、計算しておきましょう。

前提条件は次のとおりとします。

  • 異動と支払いは同時期と仮定して、支払備金は考慮しない
  • 解約および死亡までの保険料の入金回数に未収過収は生じていない

サンプルの異動データは前回に引き続きこちらに置いています。

異動契約データについて補足

保有契約データと同じ項目は同じ意味ですが、
異動契約独自の項目は次の意味です。

  • deposits : 解約または死亡までの入金回数
  • reason : 異動事由(surrender:解約、death:死亡、maturity:満期)

ただし、今回は満期データが存在していません。

異動契約の保険料積立金

まず、共有ファイルのcore_b.py
前回の保有契約で作成した解約返戻金の関数sv_func
保険料積立金の計算res_funcをインポートします。
保有データと同様に内容を確認するためpandasを使います。

calc_movement.py
from core_b import *
from calc_inforce import sv_func, res_func
import pandas as pd

続いて、異動契約データを読み込みこんで、
保険料積立金を計算する関数です。

異動事由reasonと支払額との組み合わせで、
解約返戻金なのか、死亡保険金なのか、満期保険金なのか判定できますが、
それぞれの支払項目を作成した方が、
あとで集計しやすいので、そのようにしておきます。

(ここでは支払額は計算するので設けていませんが、
一般的には、支払部門が入力した支払金額はデータにあるはずです。)

calc_movement.py
# 異動契約データの保険料積立金を計算
def calc_movement(year):
    # 異動データのファイル名
    input_file = f"data/movement{year}.csv"
    # 異動契約データの取得
    movement_df = pd.read_csv(input_file)
    # 支払保険金、死亡時V、解約返戻金、解約時V、満期保険金のリスト
    benefit_list = []
    death_reserve_list = []
    surrender_list = []
    surrender_reserve_list = []
    maturity_list = []
    # 異動保険金額
    amount_list = []
    for _, row in movement_df.iterrows():
        product = row["product"]
        sex = row["sex"]
        age = int(row["age"])
        term = row["term"]
        deposits = int(row["deposits"])
        number = int(row["number"])
        amount = int(row["amount"])
        reason = row["reason"]

        # 入金月数のP基礎保険料積立金
        _, P_Vz = res_func("P", product, sex, age, term ,deposits)
        # 死亡保険金、死亡時V、解約返戻金、解約時V、満期保険金
        # 一旦0を代入
        benefit = 0
        death_reserve = 0
        SV = 0
        surrender_reserve = 0
        maturity = 0
        # 死亡の場合
        if reason == "death":
            benefit = 1
            death_reserve = P_Vz
        # 解約の場合
        elif reason == "surrender":
            SV = sv_func(product, sex, age, term ,deposits)
            surrender_reserve = P_Vz
        # 満期の場合
        elif reason == "maturity":
            if product == "E":
                maturity = 1

        benefit_list.append(roundhu(benefit * amount, 0) * number)
        death_reserve_list.append(roundhu(death_reserve * amount, 0) * number)
        surrender_list.append(roundhu(SV * amount,0) * number)
        surrender_reserve_list.append(roundhu(surrender_reserve * amount, 0) * number)
        maturity_list.append(roundhu(maturity * amount, 0) * number)
        # 異動保険金額
        amount_list.append(amount * number)
        
    # 死亡保険金、死亡時V、解約返戻金、解約時Vの追加
    movement_df["death_ben"] = benefit_list
    movement_df["death_reserve"] = death_reserve_list
    movement_df["SV"] = surrender_list
    movement_df["surrender_reserve"] = surrender_reserve_list
    movement_df["maturity"] = maturity_list
    movement_df["amount"] = amount_list
    
    return movement_df

保有契約同様に、以下のコードで出力してあげれば、
1件ごとの支払金と保険料積立金が確認できます。

calc_movement.py
if __name__ == "__main__":
    # 出力する異動契約の年度
    year = 2025
    # 出力ファイル名
    output_file = f"data/movement{year}_calc.csv"
    # 保険料積立金の計算
    inforce_df = calc_movement(year)
    # 出力
    inforce_df.to_csv(output_file, index=False, encoding="utf-8-sig")

まとめ

今回は異動契約の保険料積立金を計算しました。
異動契約の場合は、異動事由によって、
処理を分岐させるくらいしかポイントはありません。
計算した保険料積立金は最終的に利源分析で使用します。

次回は、入金データから、
危険保険料と純保険料の計算を行います。


📚 ナビゲーション
前の記事
保有契約の責任準備金

次の記事
危険保険料と予定事業費の計算

📚 目次
アクチュアリーのためのPython入門

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?