Source code for ifrs17sim.projection
"""Source module to create ``Projection`` space from.
.. rubric:: Project Templates
This module is included in the following project templates.
* :mod:`simplelife`
* :mod:`nestedlife`
.. rubric:: References
Attributes:
pol: Alias to :py:mod:`Policy<simplelife.policy>` space
asmp: Alias to :py:mod:`Assumption<simplelife.assumption>` space
scen: Alias to :py:mod:`Economic<simplelife.economic>` space
"""
def last_t():
return min(asmp.LastAge - pol.IssueAge, pol.PolicyTerm)
[docs]def AttAge(t):
"""Attained age at time ``t``"""
return pol.IssueAge + t
[docs]def SizeSumAssured(t):
"""Sum assured per policy at time ``t``"""
return pol.SumAssured
[docs]def SizeAnnPrem(t):
"""Annualized premium per policy at time ``t``"""
return SizeSumAssured(t) * pol.AnnPremRate
# --- Income ---
[docs]def SizePremium(t):
"""Premium income per policy from t to t+1"""
return SizeSumAssured(t) * pol.GrossPremRate * pol.PremFreq
[docs]def SizeInvstIncome(t):
"""Investment Income per policy from t to t+1"""
return (SizeReserveTotalAftMat(t) + SizePremium(t)) * scen.InvstRetRate(t)
# --- Comissions ---
[docs]def SizeExpsCommInit(t):
"""Initial commission per policy at time t"""
if t == 0:
return SizePremium(t) * asmp.CommInitPrem * (1 + asmp.CnsmpTax)
else:
return 0
[docs]def SizeExpsCommRen(t):
"""Renewal commission per policy at time t"""
if t == 0:
return 0
elif t < asmp.CommRenTerm:
return SizePremium(t) * asmp.CommRenPrem * (1 + asmp.CnsmpTax)
else:
return 0
# --- Expenses ---
[docs]def SizeExpsAcq(t):
"""Acquisition expense per policy at time t"""
if t == 0:
return (SizeAnnPrem(t) * asmp.ExpsAcqAnnPrem
+ (SizeSumAssured(t) * asmp.ExpsAcqSA + asmp.ExpsAcqPol)
* scen.InflFactor(t) / scen.InflFactor(0))
else:
return 0
[docs]def SizeExpsMaint(t):
"""Maintenance expense per policy at time t"""
return (SizeAnnPrem(t) * asmp.ExpsMaintAnnPrem
+ (SizeSumAssured(t) * asmp.ExpsMaintSA + asmp.ExpsMaintPol)
* scen.InflFactor(t))
[docs]def SizeExpsOther(t):
"""Other expenses per policy at time t"""
return 0
# --- Benfeits ---
[docs]def SizeBenefitDeath(t):
"""Death benefit per policy"""
return SizeSumAssured(t)
[docs]def SizeBenefitAccDth(t):
"""Accidental death benefit per policy"""
return 0
[docs]def SizeBenefitSurr(t):
"""Surrender benefit per policy"""
return SizeSumAssured(t) * (pol.CashValueRate(t)
+ pol.CashValueRate(t+1)) / 2
[docs]def SizeBenefitAnn(t):
"""Annuity benefit per policy"""
return 0
[docs]def SizeBenefitMat(t):
"""Maturity benefit per policy"""
return 0
[docs]def SizeBenefitAccHosp(t):
"""Accidental hospitalization benefit per policy"""
return 0
[docs]def SizeBenefitSickHosp(t):
"""Sickness hospitalization benefit per policy"""
return 0
[docs]def SizeBenefitSurg(t):
"""Surgery benefit per policy"""
return 0
[docs]def SizeBenefitLiving(t):
"""Living benefit per policy"""
return 0
[docs]def SizeBenefitOther(t):
"""Other benefit per policy"""
return 0
# --- Reserve ---
[docs]def SizeReservePremRsrvAftMat(t):
"""Premium reserve per policy: After maturity"""
return SizeSumAssured(t) * pol.ReserveNLP_Rate('VAL', t)
[docs]def SizeReserveUernPremAftMat(t):
"""Unearned premium: After maturity"""
return 0 # SizeSumAssured(t) * polset.UnernPremRate(polset, tt, True)
[docs]def SizeReserveTotalAftMat(t):
"""Total reserve per policy: After maturity"""
return (SizeReservePremRsrvAftMat(t)
+ SizeReserveUernPremAftMat(t))
[docs]def SizeReservePremRsrvEnd(t):
"""Premium reserve per policy: End of period"""
return SizeSumAssured(t) * pol.ReserveNLP_Rate('VAL', t)
[docs]def SizeReserveUernPremEnd(t):
"""Unearned reserve per policy: End of period"""
return 0 # SizeSumAssured(t) * pol.UnernPremRate(polset, tt)
# --------------------------------------------------------------------------
# Number of Policies
[docs]def PolsIF_Beg(t):
"""Number of policies: Beginning of period"""
return PolsIF_AftMat(t)
[docs]def PolsRenewal(t):
"""Number of policies: Renewal policies"""
return 0
[docs]def PolsNewBiz(t):
"""Number of policies: New business"""
return pol.PolicyCount if t == 0 else 0
[docs]def PolsIF_Beg1(t):
"""Number of policies: Beginning of period 1"""
return PolsIF_Beg(t) + PolsRenewal(t) + PolsNewBiz(t)
[docs]def PolsDeath(t):
"""Number of policies: Death"""
return PolsIF_Beg1(t) * asmp.BaseMortRate(AttAge(t)) * asmp.MortFactor(t)
[docs]def PolsAccDeath(t):
"""Number of policies: Accidental death"""
return 0
[docs]def PolsSurr(t):
"""Number of policies: Surrender"""
return PolsIF_Beg1(t) * asmp.SurrRate(t)
[docs]def PolsAnnuity(t):
"""Number of policies: Annuity"""
return 0
[docs]def PolsAccHosp(t):
"""Number of policies: Accidental Hospitalization"""
return 0
[docs]def PolsSickHosp(t):
"""Number of policies: Sickness Hospitalization"""
return 0
[docs]def PolsSurg(t):
"""Number of policies: Surgery"""
return 0
[docs]def PolsLiving(t):
"""Number of policies: Living benefits"""
return 0
[docs]def PolsOther(t):
"""Number of policies: Other benefits"""
return 0
[docs]def PolsIF_End(t):
"""Number of policies: End of period"""
if t == 0:
return 0 # pol.PolicyCount
else:
return PolsIF_Beg1(t-1) - PolsDeath(t-1) - PolsSurr(t-1)
[docs]def PolsMaturity(t):
"""Number of policies: Maturity"""
if t == pol.PolicyTerm:
return PolsIF_End(t)
else:
return 0
[docs]def PolsIF_AftMat(t):
"""Number of policies: Maturity"""
return PolsIF_End(t) - PolsMaturity(t)
#--- Per Policy * Policy Counts ---
[docs]def PremIncome(t):
"""Premium income"""
return SizePremium(t) * PolsIF_Beg1(t)
[docs]def InvstIncome(t):
"""Investment income"""
return SizeInvstIncome(t) * PolsIF_Beg1(t)
[docs]def IncomeTotal(t):
"""Income Total"""
return PremIncome(t) + InvstIncome(t)
[docs]def ExpsCommInit(t):
"""Initial commissions"""
return SizeExpsCommInit(t) * PolsIF_Beg1(t)
[docs]def ExpsCommRen(t):
"""Renewal commissions"""
return SizeExpsCommRen(t) * PolsIF_Beg1(t)
[docs]def ExpsCommTotal(t):
"""Commissions Total"""
return ExpsCommInit(t) + ExpsCommRen(t)
[docs]def ExpsAcq(t):
"""Acquisition expenses"""
return SizeExpsAcq(t) * (PolsNewBiz(t) + PolsRenewal(t))
[docs]def ExpsAcqTotal(t):
"""Commissions and acquisition expenses"""
return ExpsCommTotal(t) + ExpsAcq(t)
[docs]def ExpsMaint(t):
"""Maintenance expenses"""
return SizeExpsMaint(t) * PolsIF_Beg1(t)
[docs]def ExpsOther(t):
"""Other expenses"""
return 0
[docs]def ExpsMaintTotal(t):
"""Total maintenance expenses including other expenses"""
return ExpsMaint(t) + ExpsOther(t)
[docs]def ExpsTotal(t):
"""Total expenses"""
return (ExpsCommInit(t)
+ ExpsCommRen(t)
+ ExpsAcq(t)
+ ExpsMaint(t)
+ ExpsOther(t))
[docs]def BenefitDeath(t):
"""Death benefits"""
return SizeBenefitDeath(t) * PolsDeath(t)
[docs]def BenefitAccDth(t):
"""Accidental death benefits"""
return SizeBenefitAccDth(t) * PolsAccDeath(t)
[docs]def BenefitSurr(t):
"""Surrender benefits"""
return SizeBenefitSurr(t) * PolsSurr(t)
[docs]def BenefitAnn(t):
"""Annuity benefits"""
return SizeBenefitAnn(t) * PolsAnnuity(t)
[docs]def BenefitMat(t):
"""Matuirty benefits"""
return SizeBenefitMat(t) * PolsMaturity(t)
[docs]def BenefitAccHosp(t):
"""Accidental hospitalization benefits"""
return SizeBenefitAccHosp(t) * PolsAccHosp(t)
[docs]def BenefitSickHosp(t):
"""Sickness hospitalization benefits"""
return SizeBenefitSickHosp(t) * PolsSickHosp(t)
[docs]def BenefitSurg(t):
"""Surgery benefits"""
return SizeBenefitSurg(t) * PolsSurg(t)
[docs]def BenefitLiving(t):
"""Living benefits"""
return SizeBenefitLiving(t) * PolsLiving(t)
[docs]def BenefitOther(t):
"""Other benefits"""
return SizeBenefitOther(t) * PolsOther(t)
[docs]def BenefitTotal(t):
"""Benefit Total"""
return (BenefitMat(t)
+ BenefitDeath(t)
+ BenefitAccDth(t)
+ BenefitSurr(t)
+ BenefitAnn(t)
+ BenefitAccHosp(t)
+ BenefitSickHosp(t)
+ BenefitSurg(t)
+ BenefitLiving(t)
+ BenefitOther(t))
[docs]def NetInsurCF(t):
"""Net liability cashflow"""
return (PremIncome(t)
- BenefitTotal(t)
- ExpsTotal(t))
[docs]def IntAccumCF(t):
"""Intrest on accumulated cashflows"""
return (AccumCF(t)
+ PremIncome(t)
- ExpsTotal(t)) * scen.DiscRate(t)
[docs]def AccumCF(t):
"""Accumulated cashflows"""
if t == 0:
return 0
else:
return (AccumCF(t-1)
+ IntAccumCF(t-1)
+ NetInsurCF(t-1))
[docs]def ChangeRsrv(t):
"""Change in reserve"""
return ReserveTotal_End(t+1) - ReserveTotal_End(t)
[docs]def ProfitBefTax(t):
"""Profit before Tax"""
return (PremIncome(t)
+ InvstIncome(t)
- BenefitTotal(t)
- ExpsTotal(t)
- ChangeRsrv(t))
[docs]def ReservePremRsrvEnd(t):
"""Premium reserve: End of period"""
return SizeReservePremRsrvEnd(t) * PolsIF_End(t)
[docs]def ReserveUernPremEnd(t):
"""Unearned Premium: End of period"""
return 0
[docs]def ReserveHospRsrvEnd(t):
"""Hospitalization reserve: End of period"""
return 0
[docs]def ReserveTotal_End(t):
"""Total reserve: End of period"""
return (ReservePremRsrvEnd(t)
+ ReserveUernPremEnd(t)
+ ReserveHospRsrvEnd(t))
[docs]def InsurIF_End(t):
"""Insurance in-force: End of period"""
return PolsIF_End(t) * SizeSumAssured(t)
[docs]def InsurIF_Beg1(t):
"""Insurance in-force: Beginning of period 1"""
return PolsIF_Beg1(t) * SizeSumAssured(t)