モデル3 - 養老保険・終身保険・定期保険

複数商品を管理し、またEV(エンベデッドヴァリュー)の計算ができる本格的なモデルです。
チュートリアル3 で説明しています。

このファイルでは、養老保険・終身保険・定期保険のモデルを記述しています。

養老保険


calculation Endow(Base) {

// P基礎基数
module CT_P{
    double CIR = Asm.get_double("CIR_P")
    double[] qx =
       if (sex == "M"){ Asm.get_double("qx_m_SLT1996", x) }
       else           { Asm.get_double("qx_f_SLT1996", x) }
}

// V基礎基数
module CT_V{
    double CIR = Asm.get_double("CIR_V")
    double[] qx =
       if (sex == "M"){ Asm.get_double("qx_m_SLT1996_V", x) }
       else           { Asm.get_double("qx_f_SLT1996_V", x) }
}

// レート計算
module Rate{

    // 予定事業費
    double gamma = 0.0
    double alpha = 0.015
    double beta =  0.1
    double zill_alpha = alpha

    // 保険料
    double grossP = baseP * 12.0
    double baseP =
              ( benefit_P(0) + alpha + CT_P.annuity_xn(x, n) * gamma )
                / ( (1.0 - beta) * CT_P.annuity_xn_12(x, m) * 12.0 )

    // 純保険料
    double netP_P = (benefit_P(0) + CT_P.annuity_xn(x, n) * gamma) / CT_P.annuity_xn(x, m)
    double netP_V = (benefit_V(0) + CT_V.annuity_xn(x, n) * gamma) / CT_V.annuity_xn(x, m)

    // 経過t年での給付現価
    double[] benefit_P = if (t > n)                     { 0.0 }
                         elseif (CT_P.Dx(x + t) <= 0.0) { 0.0 }
                         else   { (CT_P.Mx(x + t) - CT_P.Mx(x + n) + CT_P.Dx(x + n)) / CT_P.Dx(x + t) }
    double[] benefit_V = if (t > n)                     { 0.0 }
                         elseif (CT_V.Dx(x + t) <= 0.0) { 0.0 }
                         else   { (CT_V.Mx(x + t) - CT_V.Mx(x + n) + CT_V.Dx(x + n)) / CT_V.Dx(x + t) }

    // NetV, 解約返戻金、全チルV
    double[] netV_P =
        if (t == 0 || t > n)           { 0.0 }
        elseif (CT_P.Dx(x + t) <= 0.0) { 0.0 }
        else { Utl.max( benefit_P(t)
                        + CT_P.annuity_xn(x + t, n - t) * gamma
                        - CT_P.annuity_xn(x + t, m - t) * netP_P
                        , 0.0 )
             }

    double[] netV_V =
        if (t == 0 || t > n)           { 0.0 }
        elseif (CT_V.Dx(x + t) <= 0.0) { 0.0 }
        else { Utl.max( benefit_V(t)
                        + CT_V.annuity_xn(x + t, n - t) * gamma
                        - CT_V.annuity_xn(x + t, m - t) * netP_V
                        , 0.0 )
             }

    double[] CV =
        if (t < 10) { Utl.max( netV_P(t) - zill_alpha * (10.0 - t) / 10.0, 0.0) }
        else        { netV_P(t) }

    double[] azilV_V =
        if (t < m)
            {   netV_V(t)
              - zill_alpha * CT_V.annuity_xn(x + t, m - t) / CT_V.annuity_xn(x, m)
            }
        else { netV_V(t) }

}

// キャッシュフロー
module CashFlow{

    // 前提(死亡率・解約率・選択効果)- 動的解約あり
    double[] qx_crude =
            if (t == 0)         { 0.0 }
            elseif (sex == "M") { Asm.get_double("qx_m_SLT1996", x + t - 1) }
            else                { Asm.get_double("qx_f_SLT1996", x + t - 1) }
    double[] qwx_crude = Asm.get_double("qwx_crude_Endow", t)
    double[] dynamic_lapse = if(investment_yield(t) > 0.03) { 2.0 }
                             else                           { 1.0 }
    double[] qwx_base = if (t == 0 || t > n) { 0.0 }
                        else { Utl.clip(qwx_crude(t) * (1.0 + lapse_shock_ex) * dynamic_lapse(t), 0.0, 1.0) }

    double[] selection_factor = Asm.get_double("selection_factor_death", t)

    // コミッション
    double comm_ratio_first = Asm.get_double("comm_ratio_first")
    double comm_ratio_recur = Asm.get_double("comm_ratio_recur")
    double comm_ratio_year = Asm.get_double("comm_ratio_year")

    // 給付の定義
    double[] death_benefit_perS =
            if (t == 0 || t > n) { 0.0 }
            else { 1.0 }
    double[] surrender_benefit_perS =
            if (t == 0 || t > n) { 0.0 }
            else { Rate.CV(t) }
    double[] endow_benefit_perS =
            if (t == n) { 1.0 }
            else { 0.0 }

    // ユニットコスト
    double expense_acq_perN = Asm.get_double("expense_acq_perN")
    double expense_acq_perS = Asm.get_double("expense_acq_perS")
    double expense_acq_perP = Asm.get_double("expense_acq_perP")
    double expense_maint_paying_perS = Asm.get_double("expense_maint_paying_perS")
    double expense_maint_paying_perN = Asm.get_double("expense_maint_paying_perN")
    double expense_maint_paid_perS = Asm.get_double("expense_maint_paid_perS")
    double expense_maint_paid_perN = Asm.get_double("expense_maint_paid_perN")
    double expense_maint_perP = Asm.get_double("expense_maint_perP")

}

}

終身保険


calculation WL(Base) {

// P基礎基数
module CT_P{
    double CIR = Asm.get_double("CIR_P")
    double[] qx =
       if (sex == "M"){ Asm.get_double("qx_m_SLT1996", x) }
       else           { Asm.get_double("qx_f_SLT1996", x) }
}

// V基礎基数
module CT_V{
    double CIR = Asm.get_double("CIR_V")
    double[] qx =
       if (sex == "M"){ Asm.get_double("qx_m_SLT1996_V", x) }
       else           { Asm.get_double("qx_f_SLT1996_V", x) }
}

// レート計算
module Rate{

    // 予定事業費
    double gamma = 0.0
    double alpha = 0.015
    double beta =  0.1
    double zill_alpha = alpha

    // 保険料
    double grossP = baseP * 12.0
    double baseP =
              ( benefit_P(0) + alpha + CT_P.annuity_xn(x, n) * gamma )
                / ( (1.0 - beta) * CT_P.annuity_xn_12(x, m) * 12.0 )

    // 純保険料
    double netP_P = (benefit_P(0) + CT_P.annuity_xn(x, n) * gamma) / CT_P.annuity_xn(x, m)
    double netP_V = (benefit_V(0) + CT_V.annuity_xn(x, n) * gamma) / CT_V.annuity_xn(x, m)

    // 経過t年での給付現価
    double[] benefit_P = if (t > n)                     { 0.0 }
                         elseif (CT_P.Dx(x + t) <= 0.0) { 0.0 }
                         else   { (CT_P.Mx(x + t) - CT_P.Mx(x + n)) / CT_P.Dx(x + t) }
    double[] benefit_V = if (t > n)                     { 0.0 }
                         elseif (CT_V.Dx(x + t) <= 0.0) { 0.0 }
                         else   { (CT_V.Mx(x + t) - CT_V.Mx(x + n)) / CT_V.Dx(x + t) }

    // NetV, 解約返戻金、全チルV
    double[] netV_P =
        if (t == 0 || t > n)           { 0.0 }
        elseif (CT_P.Dx(x + t) <= 0.0) { 0.0 }
        else { Utl.max( benefit_P(t)
                        + CT_P.annuity_xn(x + t, n - t) * gamma
                        - CT_P.annuity_xn(x + t, m - t) * netP_P
                        , 0.0)
             }

    double[] netV_V =
        if (t == 0 || t > n)           { 0.0 }
        elseif (CT_V.Dx(x + t) <= 0.0) { 0.0 }
        else { Utl.max( benefit_V(t)
                        + CT_V.annuity_xn(x + t, n - t) * gamma
                        - CT_V.annuity_xn(x + t, m - t) * netP_V
                        , 0.0)
             }

    double[] CV =
        if (t < 10) { Utl.max( netV_P(t) - zill_alpha * (10.0 - t) / 10.0, 0.0) }
        else        { netV_P(t) }

    double[] azilV_V =
        if (t < m)
            {   netV_V(t)
              - zill_alpha * CT_V.annuity_xn(x + t, m - t) / CT_V.annuity_xn(x, m)
            }
        else { netV_V(t) }

}

// キャッシュフロー
module CashFlow{

    // 前提(死亡率・解約率・選択効果)- 動的解約あり
    double[] qx_crude =
            if (t == 0)         { 0.0 }
            elseif (sex == "M") { Asm.get_double("qx_m_SLT1996", x + t - 1) }
            else                { Asm.get_double("qx_f_SLT1996", x + t - 1) }
    double[] qwx_crude = Asm.get_double("qwx_crude_WL", t)
    double[] dynamic_lapse = if(investment_yield(t) > 0.03) { 2.0 }
                             else                           { 1.0 }
    double[] qwx_base = if (t == 0 || t > n) { 0.0 }
                        else { Utl.clip(qwx_crude(t) * (1.0 + lapse_shock_ex) * dynamic_lapse(t), 0.0, 1.0) }

    double[] selection_factor = Asm.get_double("selection_factor_death", t)

    // コミッション
    double comm_ratio_first = Asm.get_double("comm_ratio_first")
    double comm_ratio_recur = Asm.get_double("comm_ratio_recur")
    double comm_ratio_year = Asm.get_double("comm_ratio_year")

    // 給付の定義
    double[] death_benefit_perS =
            if (t == 0 || t > n) { 0.0 }
            else { 1.0 }
    double[] surrender_benefit_perS =
            if (t == 0 || t > n) { 0.0 }
            else { Rate.CV(t) }
    double[] endow_benefit_perS = 0.0

    // ユニットコスト
    double expense_acq_perN = Asm.get_double("expense_acq_perN")
    double expense_acq_perS = Asm.get_double("expense_acq_perS")
    double expense_acq_perP = Asm.get_double("expense_acq_perP")
    double expense_maint_paying_perS = Asm.get_double("expense_maint_paying_perS")
    double expense_maint_paying_perN = Asm.get_double("expense_maint_paying_perN")
    double expense_maint_paid_perS = Asm.get_double("expense_maint_paid_perS")
    double expense_maint_paid_perN = Asm.get_double("expense_maint_paid_perN")
    double expense_maint_perP = Asm.get_double("expense_maint_perP")

}

}

定期保険


calculation Term(Base) {

// P基礎基数
module CT_P{
    double CIR = Asm.get_double("CIR_P")
    double[] qx =
       if (sex == "M"){ Asm.get_double("qx_m_SLT1996", x) }
       else           { Asm.get_double("qx_f_SLT1996", x) }
}

// V基礎基数
module CT_V{
    double CIR = Asm.get_double("CIR_V")
    double[] qx =
       if (sex == "M"){ Asm.get_double("qx_m_SLT1996_V", x) }
       else           { Asm.get_double("qx_f_SLT1996_V", x) }
}

// レート計算
module Rate{

    // 予定事業費
    double gamma = 0.0
    double alpha = 0.015
    double beta =  0.1
    double zill_alpha = alpha

    // 保険料
    double grossP = baseP * 12.0
    double baseP =
              ( benefit_P(0) + alpha + CT_P.annuity_xn(x, n) * gamma )
                / ( (1.0 - beta) * CT_P.annuity_xn_12(x, m) * 12.0 )

    // 純保険料
    double netP_P = (benefit_P(0) + CT_P.annuity_xn(x, n) * gamma) / CT_P.annuity_xn(x, m)
    double netP_V = (benefit_V(0) + CT_V.annuity_xn(x, n) * gamma) / CT_V.annuity_xn(x, m)

    // 経過t年での給付現価
    double[] benefit_P = if (t > n)                     { 0.0 }
                         elseif (CT_P.Dx(x + t) <= 0.0) { 0.0 }
                         else   { (CT_P.Mx(x + t) - CT_P.Mx(x + n)) / CT_P.Dx(x + t) }
    double[] benefit_V = if (t > n)                     { 0.0 }
                         elseif (CT_V.Dx(x + t) <= 0.0) { 0.0 }
                         else   { (CT_V.Mx(x + t) - CT_V.Mx(x + n)) / CT_V.Dx(x + t) }

    // NetV, 解約返戻金、全チルV
    double[] netV_P =
        if (t == 0 || t > n)           { 0.0 }
        elseif (CT_P.Dx(x + t) <= 0.0) { 0.0 }
        else { Utl.max( benefit_P(t)
                        + CT_P.annuity_xn(x + t, n - t) * gamma
                        - CT_P.annuity_xn(x + t, m - t) * netP_P
                        , 0.0 )
             }

    double[] netV_V =
        if (t == 0 || t > n)           { 0.0 }
        elseif (CT_V.Dx(x + t) <= 0.0) { 0.0 }
        else { Utl.max( benefit_V(t)
                        + CT_V.annuity_xn(x + t, n - t) * gamma
                        - CT_V.annuity_xn(x + t, m - t) * netP_V
                        , 0.0 )
             }

    double[] CV =
        if (t < 10) { Utl.max( netV_P(t) - zill_alpha * (10.0 - t) / 10.0, 0.0) }
        else        { netV_P(t) }

    double[] azilV_V =
        if (t < m)
            {   netV_V(t)
              - zill_alpha * CT_V.annuity_xn(x + t, m - t) / CT_V.annuity_xn(x, m)
            }
        else { netV_V(t) }

}

// キャッシュフロー
module CashFlow{

    // 前提(死亡率・解約率・選択効果)
    double[] qx_crude =
            if (t == 0)         { 0.0 }
            elseif (sex == "M") { Asm.get_double("qx_m_SLT1996", x + t - 1) }
            else                { Asm.get_double("qx_f_SLT1996", x + t - 1) }
    double[] qwx_crude = Asm.get_double("qwx_crude_Term", t)
    double[] selection_factor = Asm.get_double("selection_factor_death", t)

    // コミッション
    double comm_ratio_first = Asm.get_double("comm_ratio_first")
    double comm_ratio_recur = Asm.get_double("comm_ratio_recur")
    double comm_ratio_year = Asm.get_double("comm_ratio_year")

    // 給付の定義
    double[] death_benefit_perS =
            if (t == 0 || t > n) { 0.0 }
            else { 1.0 }
    double[] surrender_benefit_perS =
            if (t == 0 || t > n) { 0.0 }
            else { Rate.CV(t) }
    double[] endow_benefit_perS = 0.0

    // ユニットコスト
    double expense_acq_perN = Asm.get_double("expense_acq_perN")
    double expense_acq_perS = Asm.get_double("expense_acq_perS")
    double expense_acq_perP = Asm.get_double("expense_acq_perP")
    double expense_maint_paying_perS = Asm.get_double("expense_maint_paying_perS")
    double expense_maint_paying_perN = Asm.get_double("expense_maint_paying_perN")
    double expense_maint_paid_perS = Asm.get_double("expense_maint_paid_perS")
    double expense_maint_paid_perN = Asm.get_double("expense_maint_paid_perN")
    double expense_maint_perP = Asm.get_double("expense_maint_perP")

}

}