annuity

Life annuities - Computes present values of annuity benefits

MIT License. Copyright (c) 2022-2023 Terence Lim

class actuarialmath.annuity.Annuity(udd: bool = True, **kwargs)[source]

Bases: Insurance

Compute present values and relationships of life annuities

a_x(x: int, s: int = 0, t: int = -999, u: int = 0, benefit: ~typing.Callable = <function Annuity.<lambda>>, discrete: bool = True) float[source]

Compute EPV of life annuity from survival function

Parameters:
  • x – age of selection

  • s – years after selection

  • u – year deferred

  • t – term of insurance

  • benefit – benefit as a function of age and year

  • discrete – annuity due (True) or continuous (False)

Examples

>>> life.a_x(x=20)
immediate_annuity(x: int, s: int = 0, t: int = -999, b: int = 1, variance=False) float[source]

Compute EPV of immediate life annuity

Parameters:
  • x – age of selection

  • s – years after selection

  • t – term of insurance

  • b – benefit amount

  • variance – return EPV (False) or variance (True)

Examples

>>> life.immediate_annuity(x=20, t=30)
annuity_twin(A: float, discrete: bool = True) float[source]

Returns annuity from its WL or Endowment Insurance twin”

Parameters:
  • A – cost of insurance

  • discrete – discrete/annuity due (True) or continuous (False)

Examples

>>> life.annuity_twin(A=0.05879)
insurance_twin(a: float, moment: int = 1, discrete: bool = True) float[source]

Returns WL or Endowment Insurance twin from annuity

Parameters:
  • a – cost of annuity

  • discrete – discrete/annuity due (True) or continuous (False)

Examples

>>> life.insurance_twin(a=19.7655)
annuity_variance(A2: float, A1: float, b: float = 1.0, discrete: bool = True) float[source]

Compute variance from WL or endowment insurance twin

Parameters:
  • A2 – second moment of insurance factor

  • A1 – first moment of insurance factor

  • b – annuity benefit amount

  • discrete – discrete/annuity due (True) or continuous (False)

Examples

>>> life.annuity_variance(A2=0.22, A1=0.45)
whole_life_annuity(x: int, s: int = 0, b: int = 1, variance: bool = False, discrete: bool = True) float[source]

Whole life annuity: a_x

Parameters:
  • x – age of selection

  • s – years after selection

  • b – annuity benefit amount

  • variance – return EPV (True) or variance (False)

  • discrete – annuity due (True) or continuous (False)

Examples

>>> life.whole_life_annuity(x=24, variance=True, due=False)
temporary_annuity(x: int, s: int = 0, t: int = -999, b: int = 1, variance: bool = False, discrete: bool = True) float[source]

Temporary life annuity: a_x:t

Parameters:
  • x – age of selection

  • s – years after selection

  • t – term of annuity in years

  • b (int) – annuity benefit amount

  • variance – return EPV (True) or variance (False)

  • discrete – annuity due (True) or continuous (False)

Examples

>>> life.temporary_annuity(x=24, t=10)
deferred_annuity(x: int, s: int = 0, u: int = 0, t: int = -999, b: int = 1, discrete: bool = True) float[source]

Deferred life annuity n|t_a_x = n+t_a_x - n_a_x

Parameters:
  • x – age of selection

  • s – years after selection

  • u – years deferred

  • t – term of annuity in years

  • b – annuity benefit amount

  • discrete – annuity due (True) or continuous (False)

Examples

>>> life.deferred_annuity(x=24, u=5, t=10, discrete=False)
certain_life_annuity(x: int, s: int = 0, u: int = 0, t: int = -999, b: int = 1, discrete: bool = True) float[source]

Certain and life annuity = certain + deferred

Parameters:
  • x – age of selection

  • s – years after selection

  • u – years of certain annuity

  • t – term of life annuity in years

  • b – annuity benefit amount

  • discrete – annuity due (True) or continuous (False)

Examples

>>> life.certain_life_annuity(x=24, u=5, t=10)
increasing_annuity(x: int, s: int = 0, t: int = -999, b: int = 1, discrete: bool = True) float[source]

Increasing annuity

Parameters:
  • x – age of selection

  • s – years after selection

  • t – term of life annuity in years

  • b – benefit amount at end of first year

  • discrete – annuity due (True) or continuous (False)

Examples

>>> life.increasing_annuity(x=24, t=10)
decreasing_annuity(x: int, s: int = 0, t: int = 0, b: int = 1, discrete: bool = True) float[source]

Identity (Da)_x:n + (Ia)_x:n = (n+1) a_x:n temporary annuity

Parameters:
  • x – age of selection

  • s – years after selection

  • t – term of life annuity in years

  • b – benefit amount at end of first year

  • discrete – annuity due (True) or continuous (False)

Examples

>>> life.decreasing_annuity(x=24, t=10)
Y_t(x: int, prob: float, discrete: bool = True) float[source]

T_x given percentile of the r.v. Y = PV of WL or Temporary Annuity

Parameters:
  • x – age of selection

  • prob – desired probability threshold

  • discrete – annuity due (True) or continuous (False)

Returns:

T s.t. S(T) == 1-prob; if discrete, return K=ceil(T) s.t. S(K) <= 1-prob

Y_x(x, s: int = 0, t: float = 1.0, discrete: bool = True) float[source]

EPV of year t annuity benefit for life aged [x]+s: b_x[s]+s(t)

Parameters:
  • x – age initially insured

  • s – years after selection

  • t – year of benefit

  • discrete – annuity due (True) or continuous (False)

Y_from_t(t: float, discrete: bool = True) float[source]

PV of insurance payment Y(t), given T_x

Parameters:
  • t – year of death

  • discrete – annuity due (True) or continuous (False)

Y_from_prob(x: int, prob: float, discrete: bool = True) float[source]

Percentile of annual or continuous WL annuity PV r.v. Y, given probability

Parameters:
  • x – age initially insured

  • prob – desired probability threshold

  • discrete – annuity due (True) or continuous (False)

Y_to_t(Y: float) float[source]

T_x s.t. PV of continuous WL annuity payments is Y

Parameters:

Y – Present value of benefits paid

Y_to_prob(x: int, Y: float) float[source]

Probability that continuous WL annuity PV r.v. is no more than Y

Parameters:
  • x – age initially insured

  • Y – present value of benefits paid

Y_plot(x: int, s: int = 0, stop: int = 0, benefit: ~typing.Callable = <function Annuity.<lambda>>, T: float | None = None, discrete: bool = True, ax: ~typing.Any = None, dual: bool = False, title: str | None = None, color: str = 'r', alpha: float = 0.3) float | None[source]

Plot PV of annuity r.v. Y vs T

Parameters:
  • x – age of selection

  • s – years after selection

  • stop – time to end plot

  • benefit – benefit as a function of selection age and time

  • discrete – discrete or continuous insurance

  • ax – figure object to plot in

  • dual – whether to plot survival function on secondary axis

  • color – color of primary plot

  • alpha – transparency of plot area

  • title – title of plot