mortalitylaws
Mortality Laws: Applies shortcut formulas for Beta, Uniform, Makeham and Gompertz
MIT License. Copyright 2022-2023 Terence Lim
- class actuarialmath.mortalitylaws.MortalityLaws(**kwargs)[source]
Bases:
Reserves
Apply shortcut formulas for special mortality laws
- l_r(x: int, s: int = 0, r: float = 0.0) float [source]
Fractional lives given special mortality law: l_[x]+s+r
- Parameters:
x – age of selection
s – years after selection
r – fractional year after selection
- p_r(x: int, s: int = 0, r: float = 0.0, t: float = 1.0) float [source]
Fractional age survival probability given special mortality law
- Parameters:
x – age of selection
s – years after selection
r – fractional year after selection
t – death within next t fractional years
- q_r(x: int, s: int = 0, r: float = 0.0, t: float = 1.0, u: float = 0.0) float [source]
Fractional age deferred mortality given special mortality law
- Parameters:
x – age of selection
s – years after selection
r – fractional year after selection
u – survive u fractional years, then…
t – death within next t fractional years
- mu_r(x: int, s: int = 0, r: float = 0.0) float [source]
Fractional age force of mortality given special mortality law
- Parameters:
x – age of selection
s – years after selection
r – fractional year after selection
- class actuarialmath.mortalitylaws.Beta(omega: int, alpha: float, radix: int = 100000, **kwargs)[source]
Bases:
MortalityLaws
Shortcuts with beta distribution of deaths (is Uniform when alpha = 1)
- Parameters:
omega – maximum age
alpha – alpha paramter of beta distribution
radix – assumed starting number of lives for survival function
Examples
>>> print(Beta(omega=60, alpha=1/3).mu_x(35) * 1000)
- e_r(x: int, s: int = 0, t: float = -999) float [source]
Expectation of future lifetime through fractional age: e_[x]+s:t
- Parameters:
x – age of selection
s – years after selection
t – limited at t years
- e_x(x: int, s: int = 0, n: int = -999, curtate: bool = False, moment: int = 1) float [source]
Shortcut formula for complete expectation
- Parameters:
x – age of selection
s – years after selection
n – death within next n fractional years
t – limited at t years
curtate – whether curtate (True) or complete (False) lifetime
moment – whether to compute first (1) or second (2) moment
- class actuarialmath.mortalitylaws.Uniform(omega: int, **kwargs)[source]
Bases:
Beta
Shortcuts with uniform distribution of deaths aka DeMoivre’s Law
- Parameters:
omega – maximum age
Examples
>>> print(Uniform(95).e_x(30, t=40, curtate=False)) # 27.692
- e_x(x: int, s: int = 0, t: int = -999, curtate: bool = False, moment: int = 1) float [source]
Shortcut for expected future lifetime
- Parameters:
x – age of selection
s – years after selection
t – limited at t years
curtate – whether curtate (True) or complete (False) lifetime
moment – whether to compute first (1) or second (2) moment
- E_x(x: int, s: int = 0, t: int = -999, moment: int = 1) float [source]
Shortcut for Pure Endowment
- Parameters:
x – age of selection
s – years after selection
t – term of pure endowment
endowment – amount of pure endowment
moment – compute first or second moment
- whole_life_insurance(x: int, s: int = 0, moment: int = 1, b: int = 1, discrete: bool = True) float [source]
Shortcut for whole life insurance
- Parameters:
x – age of selection
s – years after selection
b – amount of benefit
moment – compute first or second moment
discrete – benefit paid year-end (True) or moment of death (False)
- term_insurance(x: int, s: int = 0, t: int = 1, b: int = 1, moment: int = 1, discrete: bool = False) float [source]
Shortcut for term insurance
- Parameters:
x – age of selection
s – years after selection
t – term of insurance
b – amount of benefit
moment – compute first or second moment
discrete – benefit paid year-end (True) or moment of death (False)
- class actuarialmath.mortalitylaws.Makeham(A: float, B: float, c: float, **kwargs)[source]
Bases:
MortalityLaws
Includes element in force of mortality that does not depend on age
- Parameters:
A – parameters of Makeham distribution
B – parameters of Makeham distribution
c – parameters of Makeham distribution
Examples
>>> print(Makeham(A=0.00022, B=2.7e-6, c=1.124).mu_x(60) * 0.9803) # 0.00316