mthly

1/Mthly - Calculates m’thly-pay insurance and annuities

MIT License. Copyright 2022-2023 Terence Lim

class actuarialmath.mthly.Mthly(m: int, life: Annuity)[source]

Bases: Actuarial

Compute 1/M’thly insurance and annuities

Parameters:
  • m – number of payments per year

  • life – original survival and life contingent functions

v_m(k: int) float[source]

Compute discount rate compounded over k m’thly periods

Parameters:

k – number of m’thly periods to compound

q_m(x: int, s_m: int = 0, t_m: int = 1, u_m: int = 0) float[source]

Compute deferred mortality over m’thly periods

Parameters:
  • x – year of selection

  • s_m – number of m’thly periods after selection

  • u_m – survive number of m’thly periods , then

  • t_m – dies within number of m’thly periods

p_m(x: int, s_m: int = 0, t_m: int = 1) float[source]

Compute survival probability over m’thly periods

Parameters:
  • x – year of selection

  • s_m – number of m’thly periods after selection

  • t_m – survives number of m’thly periods

Z_m(x: int, s: int = 0, t: int = 1, benefit: ~typing.Callable = <function Mthly.<lambda>>, moment: int = 1)[source]

Return PV of insurance r.v. Z and probability of death at mthly intervals

Parameters:
  • x – year of selection

  • s – years after selection

  • t – year of death

  • benefit – amount of benefit by year and age selected

  • moment – return first or second moment

Returns:

DataFrame, indexed by mthly period, with column names [‘Z’, ‘p’]

Examples

>>> life = LifeTable(udd=False).set_table(q={0:.16,1:.23})          >>>                            .set_interest(i_m=.18,m=2)
>>> mthly = Mthly(m=2, life=life)
>>> Z = mthly.Z_m(0, t=2, benefit=lambda x,t: 300000 + t*30000*2)
E_x(x: int, s: int = 0, t: int = 1, moment: int = 1, endowment: int = 1) float[source]

Compute pure endowment factor

Parameters:
  • x – year of selection

  • s – years after selection

  • t – term length in years

  • moment – return first or second moment

  • endowment – endowment amount

A_x(x: int, s: int = 0, t: int = 1, u: int = 0, benefit: ~typing.Callable = <function Mthly.<lambda>>, moment: int = 1) float[source]

Compute insurance factor with m’thly benefits

Parameters:
  • x – year of selection

  • s – years after selection

  • u – years deferred

  • t – term of insurance in years

  • benefit – amount of benefit by year and age selected

  • moment – return first or second moment

whole_life_insurance(x: int, s: int = 0, moment: int = 1, b: int = 1) float[source]

Whole life insurance: A_x

Parameters:
  • x – age of selection

  • s – years after selection

  • b – amount of benefit

  • moment – compute first or second moment

term_insurance(x: int, s: int = 0, t: int = 1, b: int = 1, moment: int = 1) float[source]

Term life insurance: A_x:t^1

Parameters:
  • x – year of selection

  • s – years after selection

  • t – term of insurance in years

  • b – amount of benefit

  • moment – return first or second moment

deferred_insurance(x: int, s: int = 0, n: int = 0, b: int = 1, t: int = -999, moment: int = 1) float[source]

Deferred insurance n|_A_x:t^1 = discounted whole life

Parameters:
  • x – year of selection

  • s – years after selection

  • u – years to defer

  • t – term of insurance in years

  • b – amount of benefit

  • moment – return first or second moment

endowment_insurance(x: int, s: int = 0, t: int = 1, b: int = 1, endowment: int = -1, moment: int = 1) float[source]

Endowment insurance: A_x:t = term insurance + pure endowment

Parameters:
  • x – year of selection

  • s – years after selection

  • t – term of insurance in years

  • b – amount of benefit

  • endowment – amount of endowment

  • moment – return first or second moment

insurance_twin(a: float) float[source]

Return insurance twin of m’thly annuity

Parameters:

a – twin annuity factor

annuity_twin(A: float) float[source]

Return value of annuity twin of m’thly insurance

Parameters:

A – amount of m’thly insurance

Examples

>>> mthly = Mthly(m=12, life=Annuity().set_interest(i=0.06))
>>> mthly.annuity_twin(A=0.4075)*15*12
annuity_variance(A2: float, A1: float, b: float = 1) float[source]

Variance of m’thly annuity from m’thly insurance moments

Parameters:
  • A2 – double force of interest of m’thly insurance

  • A1 – first moment of m’thly insurance

  • b – amount of benefit

Examples

>>> mthly = Mthly(m=12, life=Annuity().set_interest(i=0.06))
>>> mthly.annuity_variance(A1=0.4075, A2=0.2105, b=15*12)
whole_life_annuity(x: int, s: int = 0, b: int = 1, variance: bool = False) float[source]

Whole life m’thly annuity: a_x

Parameters:
  • x – year of selection

  • s – years after selection

  • b – amount of benefit

  • variance – return first moment (False) or variance (True)

temporary_annuity(x: int, s: int = 0, t: int = -999, b: int = 1, variance: bool = False) float[source]

Temporary m’thly life annuity: a_x:t

Parameters:
  • x – year of selection

  • s – years after selection

  • t – term of annuity in years

  • b – amount of benefit

  • variance – return first moment (False) or variance (True)

deferred_annuity(x: int, s: int = 0, u: int = 0, t: int = -999, b: int = 1) float[source]

Deferred m’thly life annuity due n|t_a_x = n+t_a_x - n_a_x

Parameters:
  • x – year of selection

  • s – years after selection

  • u – years of deferral

  • t – term of annuity in years

  • b – amount of benefit

immediate_annuity(x: int, s: int = 0, t: int = -999, b: int = 1) float[source]

Immediate m’thly annuity

Parameters:
  • x – year of selection

  • s – years after selection

  • t – term of annuity in years

  • b – amount of benefit