Python For Actuary
Python For Actuary
Version: 1.3
Abstract
lifeactuary is a Python library to perform actuarial mathematics on life contingencies and classical
financial mathematics computations. Versatile, simple and easy to use. The main functions are implemented
using the usual actuarial approach, making it a natural choice for the life actuary.
This document is produced as a descriptive tool on how to use the package and as a user guide for the
developed actuarial functions. For each actuarial function, an illustrative example is provided.
The package uses Python version 3.7 or higher. The package and functions herein provided were tested,
but authors distribute them without any guarantee regarding the accuracy of calculations. It’s distributed
using the MIT License and the authors disclaim any liability arising from any losses due to direct or indirect
use of this package.
Version 1.3 includes new functions devoted to joint mortality of two lives that allows for the evaluation
of Joint Life insurance policies. The new functions allow for the computation of joint life probabilities,
annuities and insurance benefits, for both joint life and last survivor benefits.
– We changed the class annuities.py and now all the life annuity functions do not rely on the compu-
tation of the actuarial table. The previous functions are still available in commutationtable.py.
– We developed a new class mortality insurance.py where functions for evaluating life insurance con-
tracts are available without the need to compute the commutation table. Several new functions were
included. The previous functions are still available in commutationtable.py.
– We made a small correction to the function “present value” and a large correction to the functions
“t nIArx” and “t nIArx ” in commutation table.py.
1
– We made a small correction to the function “get integral px method” in mortality table.py.
– We made a small correction to the function “annuity x” in annuities.py.
– We made a small correction to the “npx” and “nqx” functions in the module mortality table.py, when
producing the fractional commutation tables using the Balducci and the Constant Mortality Force.
This package is still under development and further useful and interesting functions will be available any
time soon.
2
Contents
1 Introduction 7
2 Mortality Tables 8
2.1 Class MortalityTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2 Importing Mortality Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.1 Reading from lifeactuary Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.2 Importing from File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3 Demographic Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3.1 lx[x] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3.2 dx[x] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3.3 qx[x] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3.4 px[x] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3.5 ex[x] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3.6 w . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.4 Survival Probabilities Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.4.1 nqx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.4.2 npx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.4.3 t nqx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.5 Life Expectancy Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.6 Some Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4 Life Annuities 23
4.1 Whole Life Annuities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.1.1 ax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.1.2 aax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.1.3 t ax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.1.4 t aax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.2 Temporary Life Annuities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.2.1 nax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.2.2 naax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2.3 t nax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3
4.2.4 t naax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.3 Life Annuities with variable terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.3.1 nIax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.3.2 nIaax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.3.3 t nIax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.3.4 t nIaax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.3.5 Geometric Life Annuities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.3.6 Present Value Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4
6.2.5 naxy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
6.2.6 naaxy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
6.2.7 t naxy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
6.2.8 t naaxy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
6.3 Multiple Lives Insurance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
6.3.1 Pure Endowment/ Deferred Capital/ Expected Present Value / nExy . . . . . . . . . . . 59
6.3.2 Axy and Axy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
6.3.3 t Axy and t Axy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
6.3.4 nAxy and nAxy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
6.3.5 t nAxy and t nAxy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
6.3.6 nAExy and nAExy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
6.3.7 t nAExy and t nAExy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
6.3.8 t nIArxy and t nIArxy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
7 Actuarial Tables 68
7.1 Class CommutationTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
7.2 Class CommutationTableFrac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
7.2.1 Function age to index() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
7.3 Commutation Table Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
7.3.1 v . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
7.3.2 Dx and Dx frac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
7.3.3 Nx and Nx frac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
7.3.4 Sx and Sx frac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
7.3.5 Cx and Cx frac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
7.3.6 Mx and Mx frac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
7.3.7 Rx and Rx frac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
7.4 Life Annuities using Commutation Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
7.4.1 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
7.5 Life Insurance using Commutation Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.5.1 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.6 Export Actuarial Table to Excel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
8 Financial Annuities 81
8.1 Class Annuities Certain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
8.1.1 im . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
8.1.2 vm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
8.1.3 dm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
8.2 Constant Terms Financial Annuities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
8.2.1 an . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
8.2.2 aan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
8.3 Variable Terms Financial Annuities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
8.3.1 Ian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
8.3.2 Iaan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
8.3.3 Iman . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
8.3.4 Gan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
8.3.5 Gaan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
5
8.3.6 Gman . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
8.3.7 Gmaan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
9 Examples 88
9.1 Survival Probabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
9.2 Life Tables and Life Annuities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
9.3 Life Tables and Life Insurance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
9.4 Life Annuities and Life Insurance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
9.5 Multiple Lifes Annuities and Insurance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
6
1 Introduction
The lifeactuary library for Python aims to provide a wide range of actuarial functions for life contingencies.
The names of the functions follow the International Actuarial Notation and are intuitive (qx, px, lx, an, axn,
nEx, Ax, . . . ) and the common parameters are set as usual (x for actuarial age, n for term of the contract, p
for term of payments, . . . ). This aims to provide with an easy to use and “guessable” list of functions.
Using mortality tables, the library provides functions for computing (a) survival probabilities for integer and
non-integer ages and terms, (b) life expectancy for both integer and non integer ages and terms, (c) expected
present value of life annuities and (d) expected present value of traditional life insurances. All these features
allow for the development of simple or more complicated actuarial evaluations and product developments.
This library can be used for academic or professional purposes. The library contains the functions of main
traditional products in Life Insurance, allows for an easy computation of actuarial tables but also provides the
tools for designing new products, building tariffs, computing reserves.
It incorporates a very generic and simple to use function to compute the Expected Present Value (aka actuarial
expected present value) what is becoming a very relevant tool in the solvency analysis.
A set of examples is presented in the end of this manual, showing some potential uses of this library in life
contingencies products and evaluations.
This library is still under development and further useful functions will be available any time soon. In the next
release, the package will include functions that allow the use of continuous models as well as the computation
of variance of life annuities and variance of classical life insurances.
7
2 Mortality Tables
The functions developed on this section are related to common actuarial biometric functions, computed upon a
mortality table.
class MortalityTable
This class instantiates a life table. Data can be provided in the form of the lx , qx or px . Note that the first value
is the first age considered in the table. The life table will be complete, that is, from age 0 to age ω (the last age
where lx > 0). It includes the computation of common biometric functions: lx , px , qx , dx , ex for integer ages
and for non-integers ages, using methods as Uniform Distribution of Death (udd), Constant Force of Mortality
(cfm) and Balducci approximation (bal).
Usage
1 Mort alityTab le ( data_type = ’q ’ , mt = None , perc =100 , last_q =1)
Description
Initializes the MortalityTable class so that we can construct a mortality table with the usual fields.
Parameters
data type Use ’l’ for lx , ’p’ for px and ’q’ for qx .
mt The mortality table, in array format, according to the data type defined
perc The percentage of qx to use, e.g., use 50 for 50%.
last q The value for qω .
Example
1 from lifeactuary import mo rt al i ty _t ab l e as mt
2 from soa_tables import r e a d _ s o a _ t a b l e _ x m l as rst
3
8
2.2.2 Importing from File
When building a new mortality table to import from a file, please note that the first value of the table corresponds
to the first age considered in the table. For instance, if the first value of the table is 20, it means that lx = 0,
for x = 0, . . . , 19.
Usage
1 from lifeactuary import mo rt al i ty _t ab l e as mt
2 import pandas as pd
3
2.3.1 lx[x]
Actuarial Notation lx
Usage mt.lx[x]
Args x: age as an integer number
Example tv7377.lx[50]
Result 94055.99997478718
2.3.2 dx[x]
Actuarial Notation dx
Usage mt.dx[x]
Args x: age as an integer number
Example tv7377.dx[50]
Result 353.99999675630613
2.3.3 qx[x]
Actuarial Notation qx
Usage mt.qx[x]
Args x: age as an integer number
Example tv7377.qx[50]
Result 0.0037637152
9
2.3.4 px[x]
Actuarial Notation px
Usage mt.qx[x]
Args x: age as an integer number
Example tv7377.px[50]
Result 0.9962362848
2.3.5 ex[x]
Actuarial Notation ex
Usage mt.ex[x]
Args x: age as an integer number
Example tv7377.ex[50]
Result 30.07981415164423
2.3.6 w
Actuarial Notation ω
Usage mt.w
Example tv7377.w
Result 106
Other Examples
1 # # Consulting information from an object
2
10
2.4.1 nqx
Actuarial Notation: n qx
Usage
1 nqx (x , n =1 , method = ’ udd ’)
Parameters
x age at the beginning
n number of years
method For non-integer ages and periods, use ’udd’ for Uniform Distribution of Death, ’cfm’ for
Constant Force of Mortality and ’bal’ for Balducci approximation
Examples
1 # probability that (50) dies before age 52.
2 tv7377 . nqx (50 , 2) # 0 . 0 0 7 8 0 3 8 6 1 4 9 2 8 6 9 8 2 3 6
3
2.4.2 npx
Actuarial Notation: n px
Usage
1 npx (x , n =1 , method = ’ udd ’)
Parameters
x age at the beginning
n number of years
method For non-integer ages and periods, use ’udd’ for Uniform Distribution of Death, ’cfm’ for
Constant Force of Mortality and ’bal’ for Balducci approximation
Examples
1 # probability that (80) reaches age 82.
2 tv7377 . npx (80 , 2) # 0 . 8 5 6 3 2 5 7 4 4 6 9 0 4 9 6 9
3
11
2.4.3 t nqx
Usage
1 t_nqx (x , t =1 , n =1 , method = ’ udd ’)
Description: Returns the probability of (x) surviving beyond age x + t and die before age x + t + n.
Parameters
x age at the beginning
t deferment period
n number of years
method For non-integer ages and periods, use ’udd’ for Uniform Distribution of Death, ’cfm’ for
Constant Force of Mortality and ’bal’ for Balducci approximation
Examples
1 # probability that (30) reaches age 40 , but dies before age 50.
2 tv7377 . t_nqx (30 , 10 , 20) # 0 . 0 7 5 0 5 2 0 8 3 9 7 8 2 0 3 1 4
3
4 # probability that an aged 80.5 individual reaches age 85 but dies before age 90.5.
5 tv7377 . t_nqx (80.5 , 4.5 , 10.5 , ’ udd ’) # 0 . 5 7 7 5 5 8 2 0 7 7 7 7 4 3 5
6 tv7377 . t_nqx (80.5 , 4.5 , 10.5 , ’ cfm ’) # 0 . 5 7 8 7 5 7 7 1 0 2 0 6 8 3 0 3
7 tv7377 . t_nqx (80.5 , 4.5 , 10.5 , ’ bal ’) # 0 . 5 7 9 9 4 9 2 2 9 3 5 6 7 5 6 3
Usage
1 exn (x , n , method = ’ udd ’)
Description: Returns the life expectancy for (x) over the next n years.
Parameters
x age at the beginning
n number of years
method For non-integer ages, use ’udd’ for Uniform Distribution of Death, ’cfm’ for Constant Force of
Mortality and ’bal’ for Balducci approximation
Examples
1 # complete life expectancy for (60) over the next 10 years
2 tv7377 . exn (60 , 10) # 9.498277332706456
3 tv7377 . exn (60 , 10 , ’ cfm ’) # 9 . 4 9 8 1 4 6 5 6 0 0 7 6 1 5 6
4 tv7377 . exn (60 , 10 , ’ bal ’) # 9 . 4 9 8 0 1 5 7 8 8 4 0 6 4 1 4
5
12
6 # complete life expectancy for (60.1) over the next 10.2 years
7 tv7377 . exn (60.1 , 10.2) # 9.673511678284852
8 tv7377 . exn (60.1 , 10.2 , ’ cfm ’) # 9 . 6 7 3 3 8 7 8 6 3 4 7 05 4
9 tv7377 . exn (60.1 , 10.2 , ’ bal ’) # 9 . 6 7 3 2 6 4 0 4 1 7 7 3 3 4 2
3 import numpy as np
4 import matplotlib . pyplot as plt
5
6 # 1 - Compute the probability of (65) to survive $t$ years , $t =0 , 0.5 , 1 , 1.5 , ... , 19.5 , 40 $ .
Plot the probability .
7
8 x = 65
9 n = np . linspace (0 , 40 , num =2*40+1)
10 sprob = [ tv7377 . npx ( x =x , n =i , method = ’ cfm ’) for i in n ]
11 plt . stem (n , sprob )
12 plt . xlabel ( ’n ’)
13 plt . ylabel ( r ’$ {} _ { n } p_ {65} $ ’)
14 plt . title ( ’ Survival Probability of (65) ’)
15 plt . savefig ( ’ example26 ’ + ’. eps ’ , format = ’ eps ’ , dpi =3600)
16 plt . show ()
17
18 # 2 - Compute the mortality rate for ages (65+ t ) , $t =0 , 0.5 , 1 , 1.5 , ... , 19.5 , 40 $ . Plot the
obtained results , highlighting the differences to a 0.5 probability .
19
0.5
0.6
0.4
np65
qx
0.4 0.3
0.2
0.2
0.1
0.0 0.0
0 5 10 15 20 25 30 35 40 65 70 75 80 85 90 95 100 105
n x
13
3 Some lifeactuary Functions and Syntax
3.1 Mortality Table data and Survival Probabilities
Table 2: Actuarial Notation and Syntax Formula for Survival Probabilities in joint-life groups
Notation Description Syntax
n pxy Probability of a joint-life group survives at least n years npxy(mtx, mty, x, y, n, ’joint-life’, method)
n qxy Probability of a joint-life group extinguishes in the following nqxy(mtx, mty, x, y, n, ’joint-life’, method)
n years
t|n qxy Probability of a joint-life group at least t years and extin- t npxy(mtx, mty, x, y, n, ’joint-life’, method)
guishes before t + n years
exy Complete life expectancy for a joint-life group exy(mtx, mty, x, y, n, ’joint-life’, method)
exy:n Life expectancy for a joint-life group, for the next n years nexy(mtx, mty, x, y, n, ’joint-life’, method)
Table 3: Actuarial Notation and Syntax Formula for Survival Probabilities in last survivor groups
Notation Description Syntax
n pxy Probability of a last-survivor group survives at least n npxy(mtx, mty, x, y, n, ’last-survivor’, method)
years
n qxy Probability of a last-survivor group extinguishes in the nqxy(mtx, mty, x, y, n, ’last-survivor’, method)
following n years
t|n qxy Probability of a last-survivor group at least t years and t npxy(mtx, mty, x, y, n, ’last-survivor’, method)
extinguishes before t + n years
exy Complete life expectancy for a last-survivor group exy(mtx, mty, x, y, n, ’last-survivor’, method)
exy:n Life expectancy for a last-survivor group, for the next n nexy(mtx, mty, x, y, n, ’last-survivor’, method)
years
14
3.3 Life Annuities
Table 5: Actuarial Notation and Syntax Formula for Increasing Life Annuities
Notation Description Syntax
(m)r
(Ia)x:n n-year temporary increasing life an- nIax(mt, x, n, i, m=m, first amount=1, increase amount=r, method)
nuity, payable m times per year.
First payment 1 and increasing/de-
creasing amount r
(m)r
(Iä)x:n n-year temporary due increasing life nIaax(mt, x, n, i, m=m, first amount=1, increase amount=r, method)
annuity, payable m times per year.
First payment 1 and increasing/de-
creasing amount r
(m)r
t| (Ia)x:n t-years deferred n-year temporary t nIax(mt, x, n, i, m=m, defer=t, first amount=1, increase amount=r, method)
increasing life annuity, payable m
times per year. First payment 1 and
increasing/decreasing amount r
(m)r
t| (Iä)x:n t-years deferred n-year temporary t nIaax(mt, x, n, i, m=m, defer=t, first amount=1, increase amount=r, method)
due increasing life annuity, payable
m times per year. First payment 1
and increasing/decreasing amount r
15
Remark - Geometric Annuities:
For life annuities with terms varying geometrically, the Actuarial Table must be built with a growth rate g and
the functions from Table 4 are applied.
Table 6: Actuarial Notation and Syntax Formula for Life Insurances - fixed capitals
Remarks:
• For life insurance with terms varying geometrically, the Actuarial Table must be built with a growth rate
g and the functions from Table 6 are applied.
• For Life Insurances with capitals varying arithmetically, the set of available functions are resumed in
Tables 7 and 8.
• For negative values of “inc” parameter, provided that the capitals are positive, the functions in Tables 7
and 8 may reflect decreasing capital insurance.
16
Table 7: Actuarial Notation and Syntax Formula for Life Insurances - variable capitals (First Capital ̸= Increase
Amount)
Table 8: Actuarial Notation and Syntax Formula for Life Insurances - variable capitals (First Capital=Increase
Amount)
17
3.5 Life Annuities for groups of two lives
3.5.1 Joint-Life Annuities
Table 9: Actuarial Notation/Syntax Formula for Joint-life annuities (yearly constant payments)
For joint-life annuities, payable m times per year, functions on Table 9 also apply, by defining an integer m > 1.
Table 10: Actuarial Notation/Syntax Formula for Joint-life annuities payable m times per year (constant
payments and integer ages)
18
For annuities payable m times per year, with geometric growth g, a g ̸= 0 and an integer m > 1 should be
considered. Table 11 resumes the functions, for general m and g.
Table 11: Actuarial Notation/Syntax Formula for Joint-life annuities payable m times per year (geometric
growth payments and integer ages). Payments change in each payment period.
19
3.5.2 Last-Survivor Annuities
All the functions presented in Tables 9, 10 and 11 are available in the package for last-survivor groups. The
user should only change the status to ’last-survivor’, in order to compute the expected value of the annuities
with the correspondent probabilities.
All the actuarial notations should be updated to xy instead of xy.
The following tables present the syntax for Life Insurance contracts for joint-life groups of two individuals. For
last survivor groups, the xy in the actuarial notation is replaced by xy and in the Python syntax, ’joint-life’
should be replaced by ’last-survivor’.
For non-integer ages, terms and deferment periods, the method must be included and defined in the signature.
Table 12: Actuarial Notation and Syntax Formula for Life Insurance in groups of two individuals
(constant capital, payments in the end of the periods)
For fractional life insurance (assume that payments may occur the end of the m-th period of the year, an m > 1
should be defined.
Table 13: Actuarial Notation and Syntax Formula for Life Insurance in groups of two individuals
(geometrically increasing/decreasing capital, payments in the end of the periods)
For fractional life insurance (assume that payments may occur the end of the m-th period of the year, an m > 1
should be defined. For fractional ages, terms and deferrement periods, method should be included and defined
in the end of the signature.
For Endowment Insurance, user can use AExy instead of Axy in all functions included in Tables 12 and 13.
For the cases where first is different from the rate of increment, both parameters should be defined with the
adequate amounts.
20
Table 14: Actuarial Notation and Syntax Formula for Life Insurance in groups of two individuals
(arithmetically increasing/decreasing capital, payments in the end of the periods)
If the evaluation is performed considering payments in the moment of death, all the functions in tables 12, 13
and 14 are replaved by similar functions with syntax Axy , t Axy , nAxy , t nIArxy , respectively.
21
3.7 Financial Annuities
Table 15: Actuarial Notation and Syntax Formula for Financial Annuities
For annuities paid m times per year, the class Annuities Certain must be initiated with the correspondent
frequency m. Examples are presented in Chapter 8.
22
4 Life Annuities
A life annuity corresponds to a series of payments paid as long as an individual is alive on the payment date.
The life annuity can be temporary or payable for whole life, the payments are due in the beginning (annuity
due) or at the end of the periods (annuity immediate) and starts immediately in the next period or after some
delay (deferred annuities). The payments are constant through the all term of contract or are variable (with or
without a mathematical regularity). The number of payments in each period of the interest rate may also be
defined.
The computation of the present value of all these life annuities is available in the library, and are presented in this
chapter. For a more general approach, the library includes a function, see subsection 4.3.6, which computes the
present value of a given series of cash-flows, with a given set of interest rates and a defined set of probabilities.
The developed functions allow for the computation of present values for integer and non-integer ages and terms.
If using the CommutationTable or CommutationTableFrac classes, defined in section 7, all the life annuities
presented in this chapter may also be computed by means of a Commutation Table, for either integer and
fractional ages and terms. This approach is adequate for academic purposes, when commutation tables are
used.
For using Life Annuities functions, the following code must be initiated if choosing, for instance, TV7377 SOA
Table as the mortality table to adopt.
1 from soa_tables import r e a d _ s o a _ t a b l e _ x m l as rst
2 from lifeActuary import mo rt al i ty _t ab l e as mt
3 from lifeActuary import annuities as la
4
4.1.1 ax
(m)
Actuarial Notation: ax and ax
Usage
1 ax ( mt , x , i = None , g =0 , m =1 , method = ’ udd ’)
Description: Returns the actuarial present value of a whole life annuity of 1 per time period. Payments of
1/m are made m times per year at the end of the periods. If g̸=0, payments increase by (1 + g/100) each period.
23
Parameters
mt mortality table
x age at the beginning of the contract
i interest rate, in percentage (e.g. 2 for 2%
g rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant pauments
m number of payments in each period of the interest rate
method approximation method for non-integer ages, periods and terms. Use ’udd’ for Uniform Distribution
of Death, ’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Aproximation.
Examples
1 la . ax ( mt = tv7377 , x =50 , i =2 , g =0 , m =1) # 21.554432773700235
2 la . ax ( mt = tv7377 , x =50 , i =2 , g =0 , m =4 , method = ’ udd ’) # 21.927012923715320
3
4.1.2 aax
(m)
Actuarial Notation: äx and äx
Usage
1 aax ( mt , x , i = None , g =0 , m =1 , method = ’ udd ’)
Description: Returns the actuarial present value of a whole life annuity due of 1 per time period. The payments
of 1/m are made m times per year at the beginning of the periods. If g̸=0, payments increase by (1+g/100)
each period.
Parameters
mt mortality table
x age at the beginning of the contract
i interest rate, in percentage (e.g. 2 for 2%
g rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant pauments
m number of payments in each period of the interest rate
method approximation method for non-integer ages. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Aproximation.
Examples
1 la . aax ( mt = tv7377 , x =50 , i =2 , g =0 , m =1) # 22.55443277370024
2 la . aax ( mt = tv7377 , x =50 , i =2 , g =0 , m =4 , method = ’ udd ’) # 22.17701292371532
3
24
4.1.3 t ax
(m)
Actuarial Notation: t| ax and t| ax
Usage
1 t_ax ( mt , x , i = None , g =0 , m =1 , defer =0 , method = ’ udd ’)
Description: Returns the actuarial present value of an immediate whole life annuity of 1 per time period,
deferred t periods. The payments of 1/m are made m times per year at the end of the periods. If g̸=0,
payments increase by (1+g/100) each period.
Parameters
mt mortality table
x age at the beginning of the contract
i interest rate, in percentage (e.g. 2 for 2%
g rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant pauments
m number of payments in each period of the interest rate
defer number of deferment years
method approximation method for non-integer ages. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Aproximation.
Examples
1 la . t_ax ( mt = tv7377 , x =50 , i =2 , g =0 , m =1 , defer =5) # 16.89919659176826
2 la . t_ax ( mt = tv7377 , x =50 , i =2 , g =0 , m =4 , defer =5 , method = ’ udd ’) # 17.229163322375726
3
4.1.4 t aax
(m)
Actuarial Notation: t| äx and t| äx
Usage
1 t_aax ( mt , x , i = None , g =0 , m =1 , defer =0 , method = ’ udd ’)
Description: Returns the actuarial present value of a whole life annuity due of 1 per time period, deferred t
periods. The payments of 1/m are made m times per year at the beginning of the periods. If g̸=0, payments
increase by (1+g/100) each period.
25
Parameters
mt mortality table
x age at the beginning of the contract
i interest rate, in percentage (e.g. 2 for 2%
g rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant pauments
m number of payments in each period of the interest rate
defer number of deferment years
method approximation method for non-integer ages. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Aproximation.
Observation: t aax(mt, x, i, g, m, defer=0, method) = aax(mt, x, i, g, m, method)
Examples
1 la . t_aax ( mt = tv7377 , x =50 , i =2 , g =0 , m =1 , defer =5) # 17.78500355792074
2 la . t_aax ( mt = tv7377 , x =50 , i =2 , g =0 , m =4 , defer =5 , method = ’ udd ’) # 1 7 . 4 5 0 6 1 5 0 6 3 9 1 3 8 4 8
3
(m)
Actuarial Notation: ax:n and ax:n
Usage
1 nax ( mt , x , n , i = None , g =0 , m =1 , method = ’ udd ’)
Description: Returns the actuarial present value of an immediate n term life annuity of 1 per time period.
The payments of 1/m are made m times per year at the end of the periods. If g̸=0, payments increase by
(1+g/100) each period.
Parameters
mt mortality table
x age at the beginning of the contract
n number of years of the contract
i interest rate, in percentage (e.g. 2 for 2%
g rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant pauments
m number of payments in each period of the interest rate
method approximation method for non-integer ages. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Aproximation.
26
Examples
1 la . nax ( mt = tv7377 , x =50 , n =10 , i =2 , g =0 , m =1) # 8.756215803256637
2 la . nax ( mt = tv7377 , x =50 , n =10 , i =2 , g =0 , m =2 , method = ’ udd ’) # 8 . 8 1 1 5 8 7 8 6 0 3 1 1 2 6 0
3 la . nax ( mt = tv7377 , x =50 , n =10 , i =2 , g =0 , m =2 , method = ’ cfm ’) # 8 . 8 1 1 5 7 1 4 6 4 6 2 1 4 5 8
4.2.2 naax
(m)
Actuarial Notation: äx:n and äx:n
Usage
1 naax ( mt , x , n , i = None , g =0 , m =1 , method = ’ udd ’)
Description: Returns the actuarial present value of a n term life annuity due of 1 per time period. The
payments of 1/m are made m times per year at the beginning of the periods. If g̸=0, payments increase by
(1+g/100) each period.
Parameters
mt mortality table
x age at the beginning of the contract
n number of years of the contract
i interest rate, in percentage (e.g. 2 for 2%
g rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant pauments
m number of payments in each period of the interest rate
method approximation method for non-integer ages. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Aproximation.
Examples
1 la . nax ( mt = tv7377 , x =50 , n =10 , i =2 , g =0 , m =1) # 8.756215803256637
2 la . nax ( mt = tv7377 , x =50 , n =10 , i =2 , g =0 , m =2) # 8. 8 1 1 5 8 7 8 6 0 3 1 1 2 6
3 la . nax ( mt = tv7377 , x =50 , n =10 , i =2 , g =0 , m =2 , method = ’ cfm ’) # 8.811571464621458
4.2.3 t nax
(m)
Actuarial Notation: t| ax:n and t| ax:n
Usage
1 t_nax ( mt , x , n , i = None , g =0 , m =1 , defer =0 , method = ’ udd ’)
Description: Returns the actuarial present value of an immediate n term life annuity of 1 per time period,
deferred t periods. The payments of 1/m are made m times per year at the end of the periods. If g̸=0, payments
increase by (1+g/100) each period.
27
Parameters
mt mortality table
x age at the beginning of the contract
n number of years of the contract
i interest rate, in percentage (e.g. 2 for 2%
g rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant pauments
m number of payments in each period of the interest rate
defer number of deferment years
method approximation method for non-integer ages. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Aproximation.
Examples
1 la . t_nax ( mt = tv7377 , x =50 , n =10 , i =2 , g =0 , m =1 , defer =2) # 8 . 3 1 6 8 8 1 5 4 40 1 3 7 5 9
2 la . t_nax ( mt = tv7377 , x =50 , n =10 , i =2 , g =0 , m =2 , defer =1.5) # 8 . 4 8 0 5 5 4 1 7 72 1 8 1 2 4
3 la . t_nax ( mt = tv7377 , x =50 , n =10 , i =2 , g =0 , m =2 , defer =1.5 , method = ’ cfm ’) # 8 . 4 8 0 5 3 3 4 5 1 2 4 3 0 8 3
4.2.4 t naax
(m)
Actuarial Notation: t| äx:n and t| äx:n
Usage
1 t_naax ( mt , x , n , i = None , g =0 , m =1 , defer =0 , method = ’ udd ’)
Description: Returns the actuarial present value of a n term life annuity due of 1 per time period, deferred t
periods. The payments of 1/m are made m times per year at the beginning of the periods. If g̸=0, payments
increase by (1+g/100) each period.
Parameters
mt mortality table
x age at the beginning of the contract
n number of years of the contract
i interest rate, in percentage (e.g. 2 for 2%
g rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments
m number of payments in each period of the interest rate
defer number of deferment years
method approximation method for non-integer ages. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Aproximation.
28
Examples
1 la . t_naax ( mt = tv7377 , x =50 , n =10 , i =2 , g =0 , m =1 , defer =2) # 8.535558101895862
2 la . t_naax ( mt = tv7377 , x =50 , n =10 , i =2 , g =0 , m =2 , defer =1.5) # 8.590388221834296
3 la . t_naax ( mt = tv7377 , x =50 , n =10 , i =2 , g =0 , m =2 , defer =1.5 , method = ’ bal ’) # 8 . 5 9 0 3 5 1 4 1 3 6 2 7 8 7 2
4.3.1 nIax
(m) (m)
Actuarial Notation: (Ia)x:n , (Ia)x:n and (Da)x:n , (Da)x:n
Usage
1 nIax ( mt , x , n , i = None , m =1 , first_amount =1 , in c re as e_ a mo un t =1 , method = ’ udd ’)
Description: Returns the actuarial present value of an immediate n term life annuity with payments evolving
in arithmetic progression. Payments of 1/m are made m times per year at the end of the periods. First amount
and Increase amount may be different. For decreasing life annuities, the Increase Amount should be negative.
Parameters
mt mortality table
x age at the beginning of the contract
n number of years of the contract
i interest rate, in percentage (e.g. 2 for 2%)
m number of payments in each period of the interest rate
first amount amount of the first payment
increase amount amount of the increase rate
increasing life annuities: increase amount > 0
decreasing life annuities: increase amount < 0
method approximation method for non-integer ages. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Aproximation.
29
Examples
1 la . nIax ( mt = tv7377 , x =50 , n =10 , i =2 , m =1)
2 # 46.330171698412386
3 la . nIax ( mt = tv7377 , x =50 , n =10 , i =2 , m =1 , first_amount =1 , in cr e as e_ a mo un t =2)
4 # 83.90412759356813
5 la . nIax ( mt = tv7377 , x =50 , n =10 , i =2 , m =1 , first_amount =100 , i nc re a se _a m ou nt = -2)
6 # 800.4736685353522
7 la . nIax ( mt = tv7377 , x =50 , n =10 , i =2 , m =1 , first_amount =1 , in cr e as e_ a mo un t =2)
8 # 83.90412759356813
9 la . nIax ( mt = tv7377 , x =50.3 , n =10 , i =2 , m =4 , first_amount =1 , i nc re a se _a mo u nt =2 , method = ’ cfm ’)
10 # 84.66224090334902
4.3.2 nIaax
(m) (m)
Actuarial Notation: (Iä)x:n , (Iä)x:n and (Dä)x:n , (Dä)x:n
Usage
1 nIaax ( mt , x , n , i = None , m =1 , first_amount =1 , i n cr ea se _ am ou n t =1 , method = ’ udd ’)
Description: Returns the actuarial present value of a due n term life annuity with payments evolving in
arithmetic progression. Payments of 1/m are made m times per year at the beginning of the periods. First
amount and Increase amount may be different. For decreasing life annuities, the Increase Amount should be
negative.
Parameters
mt mortality table
x age at the beginning of the contract
n number of periods of the contract (measured in periods of the interest rate)
i interest rate, in percentage (e.g. 2 for 2%)
m number of payments in each period of the interest rate
defer number of deferment years
first amount amount of the first payment
increase amount amount of the increase amount
increasing life annuities: increase amount > 0
decreasing life annuities: increase amount < 0
method approximation method for non-integer ages. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Aproximation.
30
Examples
1 la . nIaax ( mt = tv7377 , x =50 , n =10 , i =2 , m =1)
2 # 47.53746439543621
3 la . nIaax ( mt = tv7377 , x =50 , n =10 , i =2 , m =1 , first_amount =1 , i nc re as e _a mo un t =2)
4 # 86.09588781545513
5 la . nIaax ( mt = tv7377 , x =50 , n =10 , i =2 , m =1 , first_amount =100 , i n cr ea se _ am ou nt = -2)
6 # 8 2 0 . 78 7 2 5 0 7 0 1 6 9 1
7 la . nIaax ( mt = tv7377 , x =50 , n =10 , i =2 , m =1 , first_amount =1 , i nc re as e _a mo un t =2)
8 # 86.09588781545513
9 la . nIaax ( mt = tv7377 , x =50.3 , n =10 , i =2 , m =4 , first_amount =1 , i n cr ea se _ am ou nt =2 , method = ’ cfm ’)
10 # 85.21250336665355
4.3.3 t nIax
(m) (m)
Actuarial Notation: t| (Ia)x:n , t| (Ia)x:n and (Da)x:n , t| (Da)x:n
Usage
1 t_nIax ( mt , x , n , i = None , m =1 , defer =0 , first_amount =1 , i n cr ea se _ am ou nt =1 , method = ’ udd ’)
Description: Returns the actuarial present value of an immediate n term life annuity, deferred t periods, with
payments evolving in arithmetic progression. Payments of 1/m are made m times per year at the end of the
periods. First amount and Increase amount may be different. For decreasing life annuities, the Increase Amount
should be negative.
Parameters
mt mortality table
x age at the beginning of the contract
n number of periods of the contract (measured in periods of the interest rate)
i interest rate, in percentage (e.g. 2 for 2%)
m number of payments in each period of the interest rate
defer number of deferment years
first amount amount of the first payment
increase amount amount of the increase amount
increasing life annuities: increase amount > 0
decreasing life annuities: increase amount < 0
method approximation method for non-integer ages. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Aproximation.
31
Examples
1 la . t_nIax ( mt = tv7377 , x =50 , n =10 , i =2 , m =1 , defer =2)
2 # 45.89083743916951
3 la . t_nIax ( mt = tv7377 , x =50 , n =10 , i =2 , m =1 , defer =2 , first_amount =1 , i n cr ea se _ am ou nt =2)
4 # 83.46479333432525
5 la . t_nIax ( mt = tv7377 , x =50 , n =10 , i =2 , m =1 , defer =10 , first_amount =100 , i nc re a se _a mo u nt = -2)
6 # 585.2087875846838
7 la . t_nIax ( mt = tv7377 , x =50 , n =10 , i =2 , m =1 , defer =1 , first_amount =1 , i n cr ea se _ am ou nt =2)
8 # 83.68346989220736
9 la . t_nIax ( mt = tv7377 , x =50.3 , n =10 , i =2 , m =4 , defer =1 , first_amount =1 , in c re as e_ a mo un t =2 ,
10 method = ’ cfm ’) # 84.43983387860666
4.3.4 t nIaax
(m) (m)
Actuarial Notation: t| (Iä)x:n , t| (Iä)x:n and t| (Dä)x:n , t| (Dä)x:n
Usage
1 t_nIaax ( mt , x , n , i = None , m =1 , defer =0 , first_amount =1 , in cr e as e_ a mo un t =1 , method = ’ udd ’)
Description: Returns the actuarial present value of a n term life annuity due, deferred t periods, with payments
evolving in arithmetic progression. The payments are made m times per year at the beginning of the periods
and the payment of each period is divided into m equal payments. First amount and Increase amount may be
different. For decreasing life annuities, the Increase Amount should be negative.
Parameters
mt mortality table
x age at the beginning of the contract
n number of years of the contract
i interest rate, in percentage (e.g. 2 for 2%)
m number of payments in each period of the interest rate
defer number of deferment years
first amount amount of the first payment
increase amount amount of the increase amount
increasing life annuities: increase amount > 0
decreasing life annuities: increase amount < 0
method approximation method for non-integer ages. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Aproximation.
32
Examples
1 la . t_nIaax ( mt = tv7377 , x =50 , n =10 , i =2 , m =1 , defer =2)
2 # 47.093981521914785
3 la . t_nIaax ( mt = tv7377 , x =50 , n =10 , i =2 , m =1 , defer =2 , first_amount =1 , in cr e as e_ am o un t =2)
4 # 8 5 . 6 52 4 0 4 9 4 1 9 3 3 7
5 la . t_nIaax ( mt = tv7377 , x =50 , n =10 , i =2 , m =1 , defer =10 , first_amount =100 , i nc r ea se _a m ount = -2)
6 # 606.6457012514408
7 la . t_nIaax ( mt = tv7377 , x =50 , n =10 , i =2 , m =1 , defer =1 , first_amount =1 , in cr e as e_ am o un t =2)
8 # 604.6767662017144
9 la . t_nIaax ( mt = tv7377 , x =50.3 , n =10 , i =2 , m =4 , defer =1 , first_amount =1 , i nc re as e _a mo u nt =2 ,
method = ’ cfm ’)
10 # 84.98956500937922
For life annuities with payments evolving in geometric progression (increasing or decreasing) the growth rate
(g) should be included when computing the annuities functions presented in the previous sections.
This function generalizes any of the above, returning the present value of a series of cash-flows (introduced
in vector mode), where the interest rate for each period may differ as well as the probability assigned to each
payment/benefit. According to the defined probabilities, the function returns the present value (for probabilities
equal to 1) or the actuarial present value of the series of cash-flows.
Usage
1 present_value ( mt , age , spot_rates , capital , probs = None )
Description: This function computes the expected present value of a cash-flow, that can be contingent on
some probabilities. The payments are considered at the end of the period.
Parameters
mt mortality table. If mt=None, probabilities must be defined in probs.
age age at the beginning of the contract
spot rates vector of interest rates for the considered time periods. Use 1 for 1%.
capital vector of cash-flow amounts
probs vector of probabilities. For using the mortality table mt, use probs=None.
Examples
1 pv1 = la . present_value ( mt = None , age = None , spot_rates =[1.2 , 1.4 , 1.8 , 1.6 , 1.9] , capital =[100 ,
-25 , 120 , 300 , -50] , probs =1)
2 print ( ’ Present Value : ’ , pv1 )
3 # 4 2 5 . 75 0 7 0 1 2 3 3 0 3 4
4
5 pv2 = la . present_value ( mt = tv7377 , age =35 , spot_rates =[1.2 , 1.4 , 1.8 , 1.6 , 1.9] , capital =[100 ,
-25 , 120 , 300 , -50] , probs = None )
6 print ( ’ Present Value : ’ , pv2 )
7 # 424.2408517830521
33
5 Pricing Life Insurance
When pricing life insurance, there is a need to compute the present value of the benefit payment, for a given
mortality table and an interest rate.
This library includes functions that allow for pricing the most common contracts in life insurance, such as
Pure Endowment, Whole Life and Temporary Insurances, Endowment Insurance as well as the traditional life
insurance with increasing (or decreasing) capitals.
The available functions allow for the pricing of any other type of life insurance, whose actuarial evaluation
makes use of the functions available in this library.
For using Life Insurance functions, the following code must be initiated if choosing, for instance, TV7377 SOA
Table as the mortality table.
1 from soa_tables import r e a d _ s o a _ t a b l e _ x m l as rst
2 from lifeActuary import mo rt al i ty _t ab l e as mt
3 from lifeActuary import annuities as la
4 from lifeActuary import m o r t a l i t y _ i n s u r a n c e as lins
5
Actuarial Notation: n Ex
Usage
1 nEx ( mt , x , i = None , g =0 , n =0 , method = ’ udd ’)
Description: Returns the present value of a Pure Endowment of 1 for an aged x individual, paid at age x + n.
Parameters
mt mortality table
x age at the beginning of the contract
i interest rate, in percentage (e.g. 2 for 2%)
g rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments
n number of years of the contract
method approximation method for non-integer ages and terms. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Approximation.
Examples
1 la . nEx ( mt = tv7377 , x =50 , i =2 , g =0 , n =5) # 0 . 8 8 5 8 0 6 9 6 6 1 5 2 4 8 5 3
2 la . nEx ( mt = tv7377 , x =50 , i =2 , g =0 , n =10) # 0 . 7 7 7 1 7 4 8 2 7 8 3 9 3 4 7 8
3 la . nEx ( mt = tv7377 , x =80 , i =2 , g =0 , n =10) # 0 . 2 2 8 3 0 8 1 3 2 0 2 3 0 2 7 8
4 la . nEx ( mt = tv7377 , x =50.4 , i =2 , g =0 , n =10.5 , method = ’ bal ’) # 0 . 7 6 5 3 1 3 2 0 6 3 7 9 6 8 9 8
34
5.2 Whole Life Insurance
5.2.1 Ax
Actuarial Notation: Ax
Usage
1 Ax ( mt , x , i = None , g =0 , method = ’ udd ’)
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of a whole life
insurance (i.e. net single premium), that pays 1 at the end of the year of death.
Parameters
mt mortality table
x age at the beginning of the contract
i interest rate, in percentage (e.g. 2 for 2%)
g rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments
method approximation method for non-integer ages and terms. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Approximation.
Examples
1 lins . Ax ( mt = tv7377 , x =50 , i =2) # 0.5577562201235239
2 lins . Ax ( mt = tv7377 , x =50.7 , i =2) # 0 . 5 6 1 3 7 7 6 8 9 6 9 0 6 8 5 8
3 lins . Ax ( mt = tv7377 , x =50.7 , i =2 , method = ’ cfm ’) # 0 . 5 6 1 5 3 5 8 2 9 4 6 2 4 9 5 7
5.2.2 Ax
Usage
1 Ax_ ( x )
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of a whole life
insurance (i.e. net single premium), that pays 1 at the moment of death.
Parameters
mt mortality table
x age at the beginning of the contract
i interest rate, in percentage (e.g. 2 for 2%)
g rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments
method approximation method for non-integer ages and terms. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Approximation.
35
Examples
1 lins . Ax_ ( mt = tv7377 , x =50 , i =2) # 0.5633061699539693
2 lins . Ax_ ( mt = tv7377 , x =50.7 , i =2) # 0 . 5 6 6 9 6 3 6 7 4 9 3 1 7 3 7 6
3 lins . Ax_ ( mt = tv7377 , x =50.7 , i =2 , method = ’ cfm ’) # 0 . 5 6 7 1 2 3 3 8 8 2 7 2 3 7 2 1
5.2.3 t Ax
Actuarial Notation: t| Ax
Usage
1 t_Ax ( mt , x , defer =0 , i = None , g =0 , method = ’ udd ’)
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of a deferred whole
life insurance (i.e. net single premium), that pays 1 at the end of year of death.
Parameters
mt mortality table
x age at the beginning of the contract
defer deferment period (in years)
i interest rate, in percentage (e.g. 2 for 2%)
g rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments
method approximation method for non-integer ages and terms. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Approximation.
Examples
1 lins . t_Ax ( mt = tv7377 , x =50 , defer =2 , i =2) # 0 . 5 5 0 1 8 3 0 4 0 7 7 2 4 3 8
5.2.4 t Ax
Usage
1 t_Ax_ ( mt , x , defer =0 , i = None , g =0 , method = ’ udd ’)
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of a deferred whole
life insurance (i.e. net single premium), that pays 1 at the moment of death.
36
Parameters
mt mortality table
x age at the beginning of the contract
defer deferment period (in years)
i interest rate, in percentage (e.g. 2 for 2%)
g rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments
method approximation method for non-integer ages and terms. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Approximation.
Examples
1 lins . t_Ax_ ( mt = tv7377 , x =50 , defer =2 , i =2) # 0 . 5 5 5 6 5 7 6 3 3 7 2 8 4 3 0 1
5.3.1 nAx
Usage
1 nAx ( mt , x , n , i = None , g =0 , method = ’ udd ’)
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of a term (tempo-
rary) life insurance (i.e. net single premium), that pays 1, at the end of the year of death.
Parameters
mt mortality table
x age at the beginning of the contract
n number of years of the contract
i interest rate, in percentage (e.g. 2 for 2%)
g rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments
method approximation method for non-integer ages and terms. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Approximation.
Examples
1 lins . nAx ( mt = tv7377 , x =50 , n =10 , i =2) # 0.04676554519168518
2 lins . nAx ( mt = tv7377 , x =50 , n =10 , i =2 , g =3) # 0 . 0 5 4 2 1 9 2 5 9 5 5 0 2 2 5 0 4 5
37
5.3.2 nAx
Usage
1 nAx_ ( mt , x , n , i = None , g =0 , method = ’ udd ’)
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of a term (tempo-
rary) life insurance (i.e. net single premium), that pays 1, at the moment of death.
Parameters
mt mortality table
x age at the beginning of the contract
n number of years of the contract
i interest rate, in percentage (e.g. 2 for 2%)
g rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments
method approximation method for non-integer ages and terms. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Approximation.
Examples
1 lins . nAx_ ( mt = tv7377 , x =50 , n =10 , i =2) # 0.04723088546086194
2 lins . nAx_ ( mt = tv7377 , x =50 , n =10 , i =2 , g =3) # 0 . 0 5 4 7 5 8 7 6 7 9 5 8 1 8 3 3 1
5.3.3 t nAx
1
Actuarial Notation: t| Ax:n
Usage
1 t_nAx ( mt , x , n , defer =0 , i = None , g =0 , method = ’ udd ’)
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of a deferred term
(temporary) life insurance (i.e. net single premium), that pays 1, at the end of the year of death.
Parameters
mt mortality table
x age at the beginning of the contract
n number of years of the contract
defer number of years of deferment
i interest rate, in percentage (e.g. 2 for 2%)
g rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments
method approximation method for non-integer ages and terms. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Approximation.
38
Examples
1 lins . t_nAx ( mt = tv7377 , x =50 , n =10 , defer =5 , i =2 , g =0) # 0 . 0 5 9 6 1 5 3 2 9 7 7 9 3 3 5 0 5 6
2 lins . t_nAx ( mt = tv7377 , x =50 , n =10 , defer =5 , i =2 , g =10) # 0 . 0 9 8 8 3 7 1 4 5 6 1 4 3 6 1 6 7
5.3.4 t nAx
1
Actuarial Notation: t| Āx:n
Usage
1 t_nAx_ ( mt , x , n , defer =0 , i = None , g =0 , method = ’ udd ’)
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of a deferred term
(temporary) life insurance (i.e. net single premium), that pays 1, at the moment of death.
Parameters
mt mortality table
x age at the beginning of the contract
n number of years of the contract
defer number of years of deferment
i interest rate, in percentage (e.g. 2 for 2%)
g rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments
method approximation method for non-integer ages and terms. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Approximation.
Examples
1 lins . t_nAx_ ( mt = tv7377 , x =50 , n =10 , defer =5 , i =2 , g =0) # 0 . 0 6 0 2 0 8 5 3 1 7 5 0 8 4 7 8 2 4
2 lins . t_nAx_ ( mt = tv7377 , x =50 , n =10 , defer =5 , i =2 , g =10) # 0 . 0 9 9 8 2 0 6 2 4 0 2 2 5 8 5 7 5
5.4.1 nAEx
Usage
1 nAEx ( mt , x , n , i = None , g =0 , method = ’ udd ’)
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of an Endowment
life insurance (i.e. net single premium), that pays 1, at the end of year of death or 1 if (x) survives to age x + n.
39
Parameters
mt mortality table
x age at the beginning of the contract
n number of years of the contract
i interest rate, in percentage (e.g. 2 for 2%)
g rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments
method approximation method for non-integer ages and terms. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Approximation.
Examples
1 lins . nAEx ( mt = tv7377 , x =50 , n =10 , i =2) # 0.823940373031033
2 lins . nAEx ( mt = tv7377 , x =50 , n =10 , i =2 , g =12) # 0 . 8 6 2 7 3 3 7 1 4 1 8 1 5 3 5 8
5.4.2 nAEx
Usage
1 nAEx_ ( mt , x , n , i = None , g =0 , method = ’ udd ’)
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of an Endowment
life insurance (i.e. net single premium), that pays 1, at the moment of death or 1 if (x) survives to age x + n.
Parameters
mt mortality table
x age at the beginning of the contract
n number of years of the contract
i interest rate, in percentage (e.g. 2 for 2%)
g rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments
method approximation method for non-integer ages and terms. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Approximation.
Examples
1 lins . nAEx_ ( mt = tv7377 , x =50 , n =10 , i =2) # 0.8244057133002097
2 lins . nAEx_ ( mt = tv7377 , x =50 , n =10 , i =2 , g =12) # 0 . 8 6 3 5 8 5 0 6 7 3 5 2 7 1 6 6
3
40
5.4.3 t nAEx
Usage
1 t_nAEx ( mt , x , n , defer =0 , i = None , g =0 , method = ’ udd ’)
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of a deferred
Endowment life insurance (i.e. net single premium) that pays 1, at the end of year of death or 1 if (x) survives
to age x + t + n.
Parameters
mt mortality table
x age at the beginning of the contract
n number of years of the contract
defer number of years of deferment
i interest rate, in percentage (e.g. 2 for 2%)
g rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments
method approximation method for non-integer ages and terms. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Approximation.
Examples
1 lins . t_nAEx ( mt = tv7377 , x =50 , n =10 , defer =2 , i =2) # 0.786304068847034
2 lins . t_nAEx ( mt = tv7377 , x =50 , n =10 , defer =10 , i =2 , g =12) # 0 . 7 1 3 3 6 5 3 7 4 2 5 8 2 5 2 9
5.4.4 t AEx
Usage
1 t_nAEx_ ( mt , x , n , defer =0 , i = None , g =0 , method = ’ udd ’)
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of a deferred
Endowment life insurance (i.e. net single premium) that pays 1, at the moment of death or 1 if (x) survives to
age x + t + n.
Parameters
mt mortality table
x age at the beginning of the contract
n number of years of the contract
defer number of years of deferment
i interest rate, in percentage (e.g. 2 for 2%)
g rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments
method approximation method for non-integer ages and terms. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Approximation.
41
Examples
1 lins . t_nAEx_ ( mt = tv7377 , x =50 , n =10 , defer =2 , i =2) # 0.7868146552887255
2 lins . t_nAEx_ ( mt = tv7377 , x =50 , n =10 , defer =10 , i =2 , g =12) # 0 . 7 1 4 8 6 3 5 1 7 4 5 6 7 8 6 2
In this section we introduce functions that allow for the computation of the present value of life insurance
contracts with capitals increasing/decreasing in arithmetic progression.
The common actuarial functions for increasing life insurance, where the capital of the first year is equal to the
rate of the progression are developed (see sections 5.5.1 to 5.5.4), but the library also contains general functions
(see section ??) where the capital of first year may differ from the rate of progression. These last functions
allow for the computation of life insurance with decreasing capital (in arithmetic progression).
In section ??, the library also includes functions that compute the present value of Increasing/Decreasing
Endowment Insurance.
As in the previous sections, the library contains functions that evaluate the liability of the contract, if payments
are performed in the end of the year or in the “moment of death” (approximated by the the middle of the
year). The syntax of each of these function follow the same rational of the previous sections. In this section,
for simplicity, we present both approaches in the same sub-sections.
Usage
1 IAx ( mt , x , i = None , inc =1 , method = ’ udd ’) # end of the year
2
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of a Whole Life
Insurance (i.e. net single premium), that pays 1 + k, at the end of year/moment of death, if death occurs
between ages x + k and x + k + 1, for k=0, 1, . . . . The capital of the first year equals the rate of the progression.
Parameters
mt mortality table
x age at the beginning of the contract
i interest rate, in percentage (e.g. 2 for 2%)
inc rate of the progression (in monetary units)
method approximation method for non-integer ages and terms. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Approximation.
Examples
1 lins . IAx ( mt = tv7377 , x =50 , i =2 , inc =1) # 15.807431562003352
2 lins . IAx_ ( mt = tv7377 , x =50 , i =2 , inc =1) # 15.964723312327344
3
42
5.5.2 t IAx and t IAx
Usage
1 t_IAx ( mt , x , defer =0 , i = None , inc =1 , method = ’ udd ’) # end of the year
2
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of a deferred Whole
Life Insurance (i.e. net single premium), that pays 1 + k, at the end of year/moment of death, if death occurs
between ages x + t + k and x + t + k + 1, for k=0, 1, . . . . The capital of the first year equals the rate of the
progression.
Parameters
mt mortality table
x age at the beginning of the contract
defer number of years of deferment
i interest rate, in percentage (e.g. 2 for 2%)
inc rate of the progression (in monetary units)
method approximation method for non-integer ages and terms. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Approximation.
Examples
1 lins . t_IAx ( mt = tv7377 , x =50 , defer =5 , i =2 , inc =1) # 1 3 . 0 5 7 6 8 6 2 7 5 2 4 7 6 8 5
2 lins . t_IAx_ ( mt = tv7377 , x =50 , defer =5 , i =2 , inc =1) # 1 3 . 1 8 7 6 1 6 7 0 2 0 4 4 6 7 2
3 lins . t_IAx ( mt = tv7377 , x =50 , defer =5 , i =2 , inc =10) # 1 3 0 . 5 7 6 8 6 2 7 5 2 4 7 6 8 4
Usage
1 nIAx ( mt , x , n , i = None , inc =1 , method = ’ udd ’) # end of the year
2
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of an arithmetically
increasing Term Life Insurance (i.e. net single premium), that pays 1 + k, at the end of the year/moment of
death if death happens between age x + k and x + k + 1, k=0,. . . , n − 1.
43
Parameters
mt mortality table
x age at the beginning of the contract
n number of years of the contract
i interest rate, in percentage (e.g. 2 for 2%)
inc rate of the progression (in monetary units)
method approximation method for non-integer ages and terms. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Approximation.
Examples
1 lins . nIAx ( mt = tv7377 , x =50 , n =10 , i =2 , inc =1) # 0.2751855520152558
2 lins . nIAx_ ( mt = tv7377 , x =50 , n =10 , i =2 , inc =1) # 0.27792378415439706
3
Usage
1 t_nIAx ( mt , x , n , defer =0 , i = None , inc =1 , method = ’ udd ’) # end of the year
2
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of a deferred Term
Life Insurance (i.e. net single premium), that pays 1 + k, at the end of year/moment of death, if death occurs
between ages x + t + k and x + t + k + 1, for k=0, 1, . . . , n − 1. The capital of the first year equals the rate of
the progression.
Parameters
mt mortality table
x age at the beginning of the contract
n number of years of the contract
defer number of years of deferment
i interest rate, in percentage (e.g. 2 for 2%)
inc rate of the progression (in monetary units)
method approximation method for non-integer ages and terms. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Approximation.
Examples
1 lins . t_nIAx ( mt = tv7377 , x =50 , n =10 , defer =5 , i =2 , inc =1) # 0 . 3 5 2 9 0 8 6 5 1 6 8 2 5 1 6 2
2 lins . t_nIAx_ ( mt = tv7377 , x =50 , n =10 , defer =5 , i =2 , inc =1) # 0 . 3 5 6 4 2 0 2 6 7 0 4 5 8 2 7 4 7
3 lins . t_nIAx ( mt = tv7377 , x =50 , n =10 , defer =5 , i =2 , inc =10) # 3 . 5 2 9 0 8 6 5 1 6 8 2 5 1 6 1 7
44
5.5.5 t nIArx and t nIArx
This function computes the actuarial present value of a term insurance whose capitals increase/decrease arith-
metically, allowing for different amounts of initial capital and increase amount. It also corresponds to a gener-
alization of functions nIAx and t nIAx, of sections 5.5.3 and 5.5.4 which also allows for decreasing capitals.
r
Actuarial Notation: t| (IA)x:n , t| (I Ā)rx:n and t| (DA)rx:n , t| (DĀ)rx:n
Usage
1 t_nIArx ( mt , x , n , defer =0 , i = None , first_amount =1 , inc =1 , method = ’ udd ’) # end of the year
2
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of a term life insur-
ance (i.e. net single premium), that pays (first amount + k× increase amount), at the end of the year/moment
of death, if death occurs between ages x + def er + k and x + k + def er + 1, for k = 0, . . . , n − 1. Allows the
computation for decreasing capitals. The first capital may differ from the increasing/decreasing amount.
Parameters
mt mortality table
x age at the beginning of the contract
n number of years of the contract
defer number of deferment years
i interest rate, in percentage (e.g. 2 for 2%)
first amount insured amount in the first year of the contract
inc rate of increasing (if inc> 0) or decreasing (if inc< 0)
method approximation method for non-integer ages and terms. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality or ’bal’ for Balducci Approximation.
Examples
1 lins . t_nIArx ( mt = tv7377 , x =50 , n =10 , defer =0 , i =2 , first_amount =1 , inc =1)
2 # 0.2751855520152558
3 lins . t_nIArx ( mt = tv7377 , x =50 , n =10 , defer =0 , i =2 , first_amount =1000 , inc =50)
4 # 58.18654553286372
5 lins . t_nIArx ( mt = tv7377 , x =50 , n =10 , defer =10 , i =2 , first_amount =1000 , inc =50)
6 # 101.10261167944806
7 lins . t_nIArx ( mt = tv7377 , x =50 , n =10 , defer =0 , i =2 , first_amount =1000 , inc = -50)
8 # 35.34454485050665
9 lins . t_nIArx ( mt = tv7377 , x =50 , n =10 , defer =10 , i =2 , first_amount =1000 , inc = -50)
10 # 60.26561732559179
11
45
Observations:
• t nIArx (mt, x, n, i, defer=0, first=1, amount=1, inc=1, method) = nIAx (mt, x, n, i, method)
This function computes the actuarial present value of an endowment insurance with capital evolving arithmeti-
cally, allowing for different amounts of initial capital and increase/decrease amount.
Usage
1 t_nIAErx ( mt , x , n , defer =0 , i = None , first_amount =1 , inc =1 , method = ’ udd ’) # end of the year
2
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of an endowment
life insurance (i.e. net single premium), that pays (first amount + k× increase amount), at the end of the
year/moment of death if death happens between age x + k and x + k + 1, for k = 0, . . . , n − 1 and a capital of
first amount + (n − 1)× increase amount in case of life at the end of the contract.
Parameters
x age at the beginning of the contract
n number of years of the contract
defer number of deferment years
first amount insured amount in the first year of the contract
increase amount rate of increasing (if > 0) or decreasing (if < 0)
Examples
1 lins . t_nIAErx ( mt = tv7377 , x =50 , n =10 , defer =0 , i =2 , first_amount =1 , inc =1)
2 # 8.046933830408733
3 lins . t_nIAErx ( mt = tv7377 , x =50 , n =10 , defer =0 , i =2 , first_amount =1000 , inc =50)
4 # 1185.0900458999179
5 lins . t_nIAErx ( mt = tv7377 , x =50 , n =10 , defer =0 , i =2 , first_amount =1000 , inc = -50)
6 # 462.7907001621479
7
46
6 Multiple Lives Contracts
In this section, we present the developed functions that allow for the evaluation of insurance contracts in which
the benefits are dependent on the joint mortality of a group of lives. As commonly, we develop functions for
groups of two lives, allowing for the computation of probabilities, annuities and insurance benefits when risk is
evaluated under joint life and last survivor contingencies.
Focusing on a group of two lives aged x and y, and using the common actuarial notation for groups of two lives,
we consider (x, y) and (x, y) for the joint life group and last survivor group, respectively.
In the examples of this chapter, the following mortality tables will be used:
1 from lifeActuary import mo rt al i ty _t ab l e as mt
2 from lifeActuary import life_2heads as l2h
3 from soa_tables import r e a d _ s o a _ t a b l e _ x m l as rst
4
6.1.1 npxy
Usage
1 npxy ( mtx , mty ,x ,y , n =1 , status = ’ joint - life ’ , method = ’ udd ’)
Description: Returns the probability of survival of a joint life or last survival group with ages (x, y).
Parameters
mtx mortality table for (x)
mty mortality table for (y)
x age of (x) at the beginning of the contract
y age of (y) at the beginning of the contract
n number of years
status status under which the probability is to be computed: ’joint-life’ or ’last-survivor’
method For non-integer ages and periods, use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality and ’bal’ for Balducci approximation
47
Examples
1 l2h . npxy ( mtx = grf95 , mty = tv7377 , x =25 , y =28 , n =10 , status = ’ joint - life ’) # 0.9849888566208177
2 l2h . npxy ( mtx = grf95 , mty = tv7377 , x =25 , y =28 , n =10 , status = ’ last - survivor ’) # 0 . 9 9 9 9 4 5 5 8 8 7 5 2 0 3 3 4
3
4 l2h . npxy ( mtx = grf95 , mty = tv7377 , x =20.5 , y =50.75 , n =10.25 , status = ’ joint - life ’ , method = ’ bal ’)
5 # 0.9382616738238869
6 l2h . npxy ( mtx = grf95 , mty = tv7377 , x =20.5 , y =50.75 , n =10.25 , status = ’ last - survivor ’ , method = ’ bal ’)
7 # 0.9997296719615928
6.1.2 nqxy
Usage
1 nqxy ( mtx , mty ,x ,y ,n , status = ’ joint - life ’ , method = ’ udd ’)
Description: Returns the probability of extinction of a group of two individuals (x) and (y) for joint life or
last survival methods, ie, (x, y) and (x, y)
Parameters
mtx mortality table for (x)
mty mortality table for (y)
x age of (x) at the beginning of the contract
y age of (y) at the beginning of the contract
n number of years of the contract
status status under which the probability is to be computed: ’joint-life’ or ’last-survivor’
method For non-integer ages and periods, use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality and ’bal’ for Balducci approximation
Examples
1 l2h . nqxy ( mtx = grf95 , mty = tv7377 , x =25 , y =28 , n =10 , status = ’ joint - life ’) # 0 . 0 1 5 0 1 1 1 4 3 3 7 9 1 8 2 3 0 1
2 l2h . nqxy ( mtx = grf95 , mty = tv7377 , x =25 , y =28 , n =10 , status = ’ last - survivor ’) # 5.44112479666 e -05
3
4 l2h . nqxy ( mtx = grf95 , mty = tv7377 , x =25.3 , y =28.9 , n =10.2 , status = ’ joint - life ’)
5 # 0.016149189892446625
6 l2h . nqxy ( mtx = grf95 , mty = tv7377 , x =25.3 , y =28.9 , n =10.2 , status = ’ last - survivor ’)
7 # 6 . 2 3 5 8 1 6 0 7 8 5 2 4 7 5 7 e -05
6.1.3 t nqxy
Usage
1 t_nqxy ( mtx , mty ,x ,y ,n ,t , status = ’ joint - life ’ , method = ’ udd ’)
Description: Returns the probability of a group (x, y) (joint life) or (x, y) (last survivor) to survive t years
and extinguishes before t + n years.
48
Parameters
mtx mortality table for (x)
mty mortality table for (y)
x age of (x) at the beginning of the contract
y age of (y) at the beginning of the contract
t deferment period
n period of time
status status under which the probability is to be computed: ’joint-life’ or ’last-survivor’
method For non-integer ages and periods, use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality and ’bal’ for Balducci approximation
Examples
1 l2h . t_nqxy ( mtx = grf95 , mty = tv7377 , x =25 , y =28 , n =10 , t =5 , status = ’ joint - life ’)
2 # 0.02113247574184618
3 l2h . t_nqxy ( mtx = grf95 , mty = tv7377 , x =25 , y =28 , n =10 , t =5 , status = ’ last - survivor ’)
4 # 0.0001707562649220229
6.1.4 exy
Usage
1 exy ( mtx , mty , x , y , status = ’ joint - life ’ , method = ’ udd ’)
Description: Returns the life expectancy of a group of two individuals (x) and (y) for joint life or last survival
methods, ie, (x, y) and (x, y).
Parameters
x age of (x) at the beginning of the contract
y age of (y) at the beginning of the contract
status status under which the probability is to be computed: ’joint-life’ or ’last-survivor’
49
Examples
1 l2h . exy ( mt_GRF95 , mt_TV7377 , x =50 , y =45 , status = ’ joint - life ’) # 30.61022001821019
2 l2h . exy ( mt_GRF95 , mt_TV7377 , x =50 , y =45 , status = ’ last - survivor ’) # 4 4 . 7 3 2 4 4 8 7 2 4 1 4 7 9 6 4
Using the previous presented functions, it is possible to compute some probabilities for groups with more that two
heads. Although the package does not contain specific functions for more than two heads, the following example
illustrates how to use the available functions to evaluate some probabilities for a group of three individuals
(x), (y) and (z).
Example:
Let us consider a group of three individuals, which extinguishes upon the second death.
The probability of such a group survives at least n years may be computed by
Considering (x) = (35), (y) = (40), (z) = (50) and n = 10, the above probability may be computed as:
1 x = 35
2 y = 40
3 z = 50
4
Example:
Let us consider a group of three individuals, which exists as long as exactly two individuals are alive.
The probability of two of the individuals are alive after n years is given by:
and for the same (x) = (35), (y) = (40), (z) = (50) individuals of the previous example, and again for n = 10,
the previous probability may be computed as:
50
1 x = 35
2 y = 40
3 z = 50
4 px = grf95 . npx (x , 10)
5 py = tv7377 . npx (y , 10)
6 pz = tv7377 . npx (z , 10)
7 pxy = l2h . npxy ( mtx = grf95 , mty = tv7377 , x =x , y =y , n =10 , status = ’ joint - life ’)
8 pxz = l2h . npxy ( mtx = grf95 , mty = tv7377 , x =x , y =z , n =10 , status = ’ joint - life ’)
9 pyz = l2h . npxy ( mtx = tv7377 , mty = tv7377 , x =y , y =z , n =10 , status = ’ joint - life ’)
10
6.2.1 axy
Usage
1 axy ( mtx , mty , x , y , i = None , g =0 , m =1 , status = ’ joint - life ’ , method = ’ udd ’)
Description: Returns the actuarial present value of an immediate whole life annuity paid for a group of two
lives. For constant annuities, pays 1 per time period. For fractional annuities, payments of 1/m are made m
times per year at the end of the periods. For annuities with geometric growth, the rate is g for each payment
period.
Parameters
mtx Mortality table for (x)
mty Mortality table for (y)
x Age of (x) at the beginning of the contract
y Age of (x) at the beginning of the contract
i Interest rate, in percentage (e.g. 2 for 2%)
g Rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments.
m Number of payments in each period of the interest rate
status Use joint-life or last-survivor
method Approximation method for non-integer ages. Use ‘udd’ for Uniform Distribution of Death,
‘cfm’ for Constant Force of Mortality and ‘bal’ for Balducci approximation
51
Examples
1 # Whole life unitary , immediate annuity , paid annually
2 l2h . axy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , i =2 , g =0 , m =1 , status = ’ joint - life ’)
3 # 2 .1 9 93 51 23 3 36 48
4 l2h . axy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , i =2 , g =0 , m =1 , status = ’ last - survivor ’)
5 # 6 .8 2 25 88 52 0 17 28
6
13 # Whole life unitary , immediate annuity , paid annually , with geometric growth of payments
14 l2h . axy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , i =2 , g =1 , m =1 , status = ’ joint - life ’)
15 # 2 .2 3 90 97 97 6 86 51
16 l2h . axy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , i =2 , g =1 , m =1 , status = ’ last - survivor ’)
17 # 2 .4 8 86 70 22 8 18 77
18
19 # Whole life unitary , immediate annuity , paid semi - annually , with geometric growth of payments
20 l2h . axy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , i =2 , g =1 , m =2 , status = ’ joint - life ’)
21 # 7 .1 3 46 82 70 5 21 50
22 l2h . axy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , i =2 , g =1 , m =2 , status = ’ last - survivor ’)
23 # 7 .4 2 69 93 69 0 74 18
6.2.2 aaxy
Usage
1 aaxy ( mtx , mty , x , y , i = None , g =0 , m =1 , status = ’ joint - life ’ , method = ’ udd ’)
Description: Returns the actuarial present value of a due whole life annuity paid for a group of two lives.
For constant annuities, pays 1 per time period. For fractional annuities, payments of 1/m are made m times
per year at the beginning of the periods. For annuities with geometric growth, the rate is g for each payment
period.
Parameters
mtx Mortality table for (x)
mty Mortality table for (y)
x Age of (x) at the beginning of the contract
y Age of (x) at the beginning of the contract
i Interest rate, in percentage (e.g. 2 for 2%)
g Rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments.
m Number of payments in each period of the interest rate
status Use joint-life or last-survivor
method Approximation method for non-integer ages. Use ‘udd’ for Uniform Distribution of Death,
‘cfm’ for Constant Force of Mortality and ‘bal’ for Balducci approximation
52
Examples
1 # Whole life unitary , immediate annuity , paid annually
2 l2h . aaxy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , i =2 , g =0 , m =1 , status = ’ joint - life ’)
3 # 3 .1 9 93 51 23 3 36 48
4 l2h . aaxy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , i =2 , g =0 , m =1 , status = ’ last - survivor ’)
5 # 7 .8 2 25 88 52 0 17 28
6
13 # Whole life unitary , immediate annuity , paid annually , with geometric growth of payments
14 l2h . aaxy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , i =2 , g =1 , m =1 , status = ’ joint - life ’)
15 # 3 .2 6 14 88 95 6 63 37
16 l2h . aaxy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , i =2 , g =1 , m =1 , status = ’ last - survivor ’)
17 # 8 .2 0 60 29 53 2 26 71
18
19 # Whole life unitary , immediate annuity , paid semi - annually , with geometric growth of payments
20 l2h . aaxy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , i =2 , g =1 , m =2 , status = ’ joint - life ’)
21 # 3 .0 0 10 82 62 5 52 73
22 l2h . aaxy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , i =2 , g =1 , m =2 , status = ’ last - survivor ’)
23 # 7 .9 6 40 36 28 3 08 04
6.2.3 t axy
Usage
1 t_axy ( mtx , mty , x , y , i = None , g =0 , m =1 , defer =0 , status = ’ joint - life ’ , method = ’ udd ’)
Description: Returns the actuarial present value of an immediate whole life annuity paid for a group of two
lives. For constant annuities, pays 1 per time period. For fractional annuities, payments of 1/m are made m
times per year at the end of the periods. For annuities with geometric growth, the rate is g for each payment
period.
Parameters
mtx Mortality table for (x)
mty Mortality table for (y)
x Age of (x) at the beginning of the contract
y Age of (x) at the beginning of the contract
i Interest rate, in percentage (e.g. 2 for 2%)
g Rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments.
m Number of payments in each period of the interest rate
defer number of deferment years
status Use joint-life or last-survivor
method Approximation method for non-integer ages. Use ‘udd’ for Uniform Distribution of Death,
‘cfm’ for Constant Force of Mortality and ‘bal’ for Balducci approximation
53
Examples
1 # Whole life unitary , annuity , paid annually , with 2 years deferment
2 l2h . t_axy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , i =2 , g =0 , m =1 , defer =2 , status = ’ joint - life ’)
3 # 0 .9 6 70 66 01 0 17 40
4 l2h . t_axy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , i =2 , g =0 , m =1 , defer =2 , status = ’ last - survivor ’)
5 # 4 .9 5 49 32 15 3 72 68
6.2.4 t aaxy
Usage
1 t_aaxy ( mtx , mty , x , y , i = None , g =0 , m =1 , defer =0 , status = ’ joint - life ’ , method = ’ udd ’)
Description: Returns the actuarial present value of a due whole life annuity paid for a group of two lives.
For constant annuities, pays 1 per time period. For fractional annuities, payments of 1/m are made m times
per year at the beginning of the periods. For annuities with geometric growth, the rate is g for each payment
period.
Parameters
mtx Mortality table for (x)
mty Mortality table for (y)
x Age of (x) at the beginning of the contract
y Age of (x) at the beginning of the contract
i Interest rate, in percentage (e.g. 2 for 2%)
g Rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments.
m Number of payments in each period of the interest rate
defer number of deferment years
status Use joint-life or last-survivor
method Approximation method for non-integer ages. Use ‘udd’ for Uniform Distribution of Death,
‘cfm’ for Constant Force of Mortality and ‘bal’ for Balducci approximation
Examples
1 # Temporary life annuity due , paid annually , with two years deferment
2 l2h . t_aaxy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , i =2 , g =0 , m =1 , defer =2 , status = ’ joint - life ’)
3 # 1 .4 7 65 85 61 6 75 54
4 l2h . t_aaxy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , i =2 , g =0 , m =1 , defer =2 , status = ’ last - survivor ’)
5 # 5 .8 5 81 43 80 4 52 73
54
6.2.5 naxy
Usage
1 naxy ( mtx , mty , x , y , n , i = None , g =0 , m =1 , status = ’ joint - life ’ , method = ’ udd ’)
Description: Returns the actuarial present value of an immediate temporary life annuity paid for a group of
two lives. For constant annuities, pays 1 per time period. For fractional annuities, payments of 1/m are made
m times per year at the end of the periods. For annuities with geometric growth, the rate is g for each payment
period.
Parameters
mtx Mortality table for (x)
mty Mortality table for (y)
x Age of (x) at the beginning of the contract
y Age of (x) at the beginning of the contract
n number of periods
i Interest rate, in percentage (e.g. 2 for 2%)
g Rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments.
m Number of payments in each period of the interest rate
status Use joint-life or last-survivor
method Approximation method for non-integer ages. Use ‘udd’ for Uniform Distribution of Death,
‘cfm’ for Constant Force of Mortality and ‘bal’ for Balducci approximation
Examples
1 # Temporary immediate life annuity , paid semi - annually with 10 years term
2 l2h . naxy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , n =10 , i =2 , g =0 , m =2 , status = ’ joint - life ’)
3 # 2 .4 3 19 17 66 0 47 55
4 l2h . naxy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , n =10 , i =2 , g =0 , m =2 , status = ’ last - survivor ’)
5 # 6 .2 4 83 53 58 2 39 22
6.2.6 naaxy
Usage
1 naaxy ( mtx , mty , x , y , n , i = None , g =0 , m =1 , status = ’ joint - life ’ , method = ’ udd ’)
Description: Returns the actuarial present value of a temporary life annuity due paid for a group of two lives.
For constant annuities, pays 1 per time period. For fractional annuities, payments of 1/m are made m times
per year at the end of the periods. For annuities with geometric growth, the rate is g for each payment period.
55
Parameters
mtx Mortality table for (x)
mty Mortality table for (y)
x Age of (x) at the beginning of the contract
y Age of (x) at the beginning of the contract
n number of periods
i Interest rate, in percentage (e.g. 2 for 2%)
g Rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments.
m Number of payments in each period of the interest rate
status Use joint-life or last-survivor
method Approximation method for non-integer ages. Use ‘udd’ for Uniform Distribution of Death,
‘cfm’ for Constant Force of Mortality and ‘bal’ for Balducci approximation
Examples
1 # Temporary due life annuity , paid semi - annually with 10 years term
2 l2h . naaxy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , n =10 , i =2 , g =0 , m =2 , status = ’ joint - life ’)
3 # 2 .9 2 78 37 05 8 52 19
4 l2h . naaxy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , n =10 , i =2 , g =0 , m =2 , status = ’ last - survivor ’)
5 # 6.62436464286
6.2.7 t naxy
Usage
1 t_naxy ( mtx , mty , x , y , n , i = None , g =0 , m =1 , defer =0 , status = ’ joint - life ’ , method = ’ udd ’)
Description: Returns the actuarial present value of a deferred temporary life annuity paid for a group of two
lives. For constant annuities, pays 1 per time period. For fractional annuities, payments of 1/m are made m
times per year at the end of the periods. For annuities with geometric growth, the rate is g for each payment
period.
56
Parameters
mtx Mortality table for (x)
mty Mortality table for (y)
x Age of (x) at the beginning of the contract
y Age of (x) at the beginning of the contract
n number of periods
i Interest rate, in percentage (e.g. 2 for 2%)
g Rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments.
m Number of payments in each period of the interest rate
defer Number of deferment periods
status Use joint-life or last-survivor
method Approximation method for non-integer ages. Use ‘udd’ for Uniform Distribution of Death,
‘cfm’ for Constant Force of Mortality and ‘bal’ for Balducci approximation
Examples
1 # Temporary deferred life annuity , paid semi - annually with 10 years term
2 l2h . t_naxy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , n =10 , i =2 , g =0 , m =2 , defer =2 , status = ’ joint - life ’)
3 # 1 .0 8 74 29 38 2 67 44
4 l2h . t_naxy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , n =10 , i =2 , g =0 , m =2 , defer =2 , status = ’ last - survivor ’)
5 # 4 .7 1 99 41 58 2 42 77
6.2.8 t naaxy
Usage
1 t_naaxy ( mtx , mty , x , y , n , i = None , g =0 , m =1 , defer =0 , status = ’ joint - life ’ , method = ’ udd ’)
Description: Returns the actuarial present value of a deferred temporary life annuity paid for a group of two
lives. For constant annuities, pays 1 per time period. For fractional annuities, payments of 1/m are made m
times per year at the beginning of the periods. For annuities with geometric growth, the rate is g for each
payment period.
57
Parameters
mtx Mortality table for (x)
mty Mortality table for (y)
x Age of (x) at the beginning of the contract
y Age of (x) at the beginning of the contract
n number of periods
i Interest rate, in percentage (e.g. 2 for 2%)
g Growth rate (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constant payments.
m Number of payments in each period of the interest rate
defer Number of deferment periods
status Use joint-life or last-survivor
method Approximation method for non-integer ages. Use ‘udd’ for Uniform Distribution of Death,
‘cfm’ for Constant Force of Mortality and ‘bal’ for Balducci approximation
Examples
1 # Temporary deferred life annuity , paid semi - annually with 10 years term paid in the beginning
of periods
2 l2h . t_naaxy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , n =10 , i =2 , g =0 , m =2 , defer =2 , status = ’ joint - life ’)
3 # 1 .3 4 17 11 06 1 34 38
4 l2h . t_naaxy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , n =10 , i =2 , g =0 , m =2 , defer =2 , status = ’ last - survivor ’)
5 # 5 .0 9 67 61 61 5 63 46
58
6.3.1 Pure Endowment/ Deferred Capital/ Expected Present Value / nExy
Usage
1 nExy ( mtx , mty , x , y , i = None , n =1 , status = ’ joint - life ’ , method = ’ udd ’)
Description: Returns the actuarial expected present value of an unitary capital paid in n years term, upon the
survival of a group of two lives. Probabilities for a group of two lives (x) and (y), for joint life or last survival
methods, ie, (x, y) and (x, y) are considered.
Parameters
mtx mortality table for (x)
mty mortality table for (y)
x age of (x) at the beginning
y age of (y) at the beginning
i Interest rate, in percentage (e.g. 2 for 2%)
n number of years until term
status status under which the probability is to be computed: ’joint-life’ or ’last-survivor’
method For non-integer ages and periods, use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality and ’bal’ for Balducci approximation
Examples
1 l2h . nExy ( mtx = grf95 , mty = tv7377 , x =35 , y =40 , i =2 , n =1 , status = ’ joint - life ’)
2 # 0.9780058667674981
3 l2h . nExy ( mtx = grf95 , mty = tv7377 , x =35 , y =40 , i =2 , n =1 , status = ’ last - survivor ’)
4 # 0.9803908602913254
5
6 l2h . nExy ( mtx = grf95 , mty = tv7377 , x =51.8 , y =48.3 , i =2 , n =10.5 , status = ’ joint - life ’ , method = ’ bal ’)
7 # 0.7501997252543674
8 l2h . nExy ( mtx = grf95 , mty = tv7377 , x =51.8 , y =48.3 , i =2 , n =10.5 , status = ’ last - survivor ’ , method = ’ bal ’)
9 # 0 . 8 1 11 3 6 5 9 7 8 2 5 6 6
59
6.3.2 Axy and Axy
Usage
1 Axy ( mtx , mty , x , y , i = None , g =0 , m =1 , status = ’ joint - life ’ , method = ’ udd ’) # end of the year
2
3 Axy_ ( mtx , mty , x , y , i = None , g =0 , status = ’ joint - life ’ , method = ’ udd ’) # moment of death
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of a whole life
insurance (i.e. net single premium), that pays 1 at the end of the period/moment of death of a group of two
individuals, for joint-life or last survivor methods. For fractional years, payments are made in the end of the
periods.
Parameters
mtx mortality table for (x)
mty mortality table for (y)
x age of (x)
y age of (y)
i Interest rate (e.g. use 2 for 2%)
g Growth rate (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constants payments.
m Number of fractions for each period of the interest rate
status status under which the probability is to be computed: ’joint-life’ or ’last-survivor’
method For non-integer ages and periods, use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality and ’bal’ for Balducci approximation
Examples
1 # End of the Year
2 l2h . Axy ( mtx = grf95 , mty = tv7377 , x =35 , y =40 , i =2 , status = ’ joint - life ’) # 0.4883589555345963
3 l2h . Axy ( mtx = grf95 , mty = tv7377 , x =35 , y =40 , i =2 , status = ’ last - survivor ’)
4 # 0.3279490658724815
5 l2h . Axy ( mtx = grf95 , mty = tv7377 , x =35 , y =40 , i =2 , m =2 , status = ’ joint - life ’)
6 # 0.4908020439476468
7 l2h . Axy ( mtx = grf95 , mty = tv7377 , x =35 , y =40 , i =2 , m =2 , status = ’ last - survivor ’)
8 # 0.3295673114271598
9 l2h . Axy ( mtx = grf95 , mty = tv7377 , x =35 , y =40 , i =2 , g =1 , status = ’ joint - life ’)
10 # 0.6947836396955362
11 l2h . Axy ( mtx = grf95 , mty = tv7377 , x =35 , y =40 , i =2 , g =1 , status = ’ last - survivor ’)
12 # 0.5709211125564813
13
14 # Moment of Death
15 l2h . Axy_ ( mtx = grf95 , mty = tv7377 , x =35 , y =40 , i =2 , status = ’ joint - life ’) # 0.4932183683115002
16 l2h . Axy_ ( mtx = grf95 , mty = tv7377 , x =35 , y =40 , i =2 , status = ’ last - survivor ’)
17 # 0.33121232103103576
18 l2h . Axy_ ( mtx = grf95 , mty = tv7377 , x =35.5 , y =40.8 , i =2 , status = ’ joint - life ’)
19 # 0.49972941203977206
20 l2h . Axy_ ( mtx = grf95 , mty = tv7377 , x =55.5 , y =40.8 , i =2 , status = ’ last - survivor ’)
21 # 0.4263873876757644
60
6.3.3 t Axy and t Axy
Usage
1 # end of the period
2 t_Axy ( mtx , mty , x , y , i = None , g =0 , m =1 , defer =0 , status = ’ joint - life ’ , method = ’ udd ’)
3
4 # moment of death
5 t_Axy_ ( mtx , mty , x , y , i = None , g =0 , defer =0 , status = ’ joint - life ’ , method = ’ udd ’)
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of a deferred whole
life insurance (i.e. net single premium), that pays 1 at the end of the period/moment of death of a group of
two individuals, for joint-life or last survivor methods.
Parameters
mtx mortality table for (x)
mty mortality table for (y)
x age of (x) at the beginning of the contract
y age of (y) at the beginning of the contract
i Interest rate (e.g. use 2 for 2%)
g Growth rate (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constants payments.
m Number of fractions for each period of the interest rate
defer Number of deferment periods
status status under which the probability is to be computed: ’joint-life’ or ’last-survivor’
method For non-integer ages and periods, use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality and ’bal’ for Balducci approximation
Examples
1 # End of the Period
2 l2h . t_Axy ( mtx = grf95 , mty = tv7377 , x =35.2 , y =40.6 , i =2 , defer =3 , status = ’ joint - life ’ , method = ’
udd ’) # 0 . 4 8 5 0 9 3 3 1 5 2 2 1 2 8 0 9 6
3 l2h . t_Axy ( mtx = grf95 , mty = tv7377 , x =35.2 , y =40.6 , i =2 , defer =3 , status = ’ last - survivor ’ , method =
’ udd ’) # 0 . 3 2 9 2 4 9 6 6 3 7 6 2 5 0 3 9
4 l2h . t_Axy ( mtx = grf95 , mty = tv7377 , x =35.2 , y =40.6 , i =2 , g =1 , m =4 , defer =3 , status = ’ joint - life ’ ,
method = ’ bal ’) # 0 . 6 7 2 3 3 7 9 0 4 6 9 6 6 9 9 2
5 l2h . t_Axy ( mtx = grf95 , mty = tv7377 , x =35.2 , y =40.6 , i =2 , g =1 , m =4 , defer =3 , status = ’ last - survivor
’ , method = ’ bal ’) # 0 . 5 5 7 3 8 2 4 4 7 9 6 2 7 3 8 7
6
7 # Moment of Death
8 l2h . t_Axy_ ( mtx = grf95 , mty = tv7377 , x =35.2 , y =40 , i =2 , defer =3 , status = ’ joint - life ’ , method = ’ udd
’) # 0.485844005557544
9 l2h . t_Axy_ ( mtx = grf95 , mty = tv7377 , x =35.2 , y =40 , i =2 , defer =3 , status = ’ last - survivor ’ , method = ’
udd ’) # 0.33174709690035026
10 l2h . t_Axy_ ( mtx = grf95 , mty = tv7377 , x =35.2 , y =40.6 , i =2 , g =1 , defer =3 , status = ’ joint - life ’ ,
method = ’ cfm ’) # 0.676502134404232
11 l2h . t_Axy_ ( mtx = grf95 , mty = tv7377 , x =35.2 , y =40.6 , i =2 , g =1 , defer =3 , status = ’ last - survivor ’ ,
method = ’ cfm ’) # 0.5608068279976409
61
6.3.4 nAxy and nAxy
Usage
1 nAxy ( mtx , mty , x , y , n , i = None , g =0 , m =1 , status = ’ joint - life ’ , method = ’ udd ’) # end of the year
2
3 nAxy_ ( mtx , mty , x , y , n , i = None , g =0 , status = ’ joint - life ’ , method = ’ udd ’) # moment of death
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of a temporary life
insurance (i.e. net single premium), that pays 1 at the end of the period/moment of death of a group of two
individuals, for joint-life or last survivor methods.
Parameters
mtx mortality table for (x)
mty mortality table for (y)
x age of (x) at the beginning of the contract
y age of (y) at the beginning of the contract
n number of terms of years of the contract
i Interest rate (e.g. use 2 for 2%)
g Rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constants payments.
m Number of fractions for each period of the interest rate
status status under which the probability is to be computed: ’joint-life’ or ’last-survivor’
method For non-integer ages and periods, use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality and ’bal’ for Balducci approximation
Examples
1 # End of the Period
2 l2h . nAxy ( mtx = grf95 , mty = tv7377 , x =55.8 , y =40 , n =10 , i =2 , status = ’ joint - life ’ , method = ’ bal ’)
3 # 0.051536194942196634
4 l2h . nAxy ( mtx = grf95 , mty = tv7377 , x =55.8 , y =40 , n =10 , i =2 , status = ’ last - survivor ’ , method = ’ bal ’)
5 # 0.0007237026849450379
6 l2h . nAxy ( mtx = grf95 , mty = tv7377 , x =35.9 , y =40.6 , n =15 , i =2 , g =1 , m =4 , status = ’ joint - life ’)
7 # 0.17823058360706845
8 l2h . nAxy ( mtx = grf95 , mty = tv7377 , x =35.9 , y =40.6 , n =15 , i =2 , g =1 , m =4 , status = ’ last - survivor ’)
9 # 0.12669408363288304
10
11
12 # Moment of Death
13 l2h . nAxy_ ( mtx = grf95 , mty = tv7377 , x =55.8 , y =40 , n =10 , i =2 , status = ’ joint - life ’ , method = ’ bal ’)
14 # 0.052049005532310566
15 l2h . nAxy_ ( mtx = grf95 , mty = tv7377 , x =55.8 , y =40 , n =10 , i =2 , status = ’ last - survivor ’ , method = ’ bal ’)
16 # 0.0007309038840508306
17 l2h . nAxy_ ( mtx = grf95 , mty = tv7377 , x =35.9 , y =40.6 , n =15 , i =2 , g =1 , status = ’ joint - life ’)
18 # 0.17372546866918934
19 l2h . nAxy_ ( mtx = grf95 , mty = tv7377 , x =35.9 , y =40.6 , n =15 , i =2 , g =1 , status = ’ last - survivor ’)
20 # 0.1214957914607578
62
6.3.5 t nAxy and t nAxy
Usage
1 # End of the period
2 t_nAxy ( mtx , mty , x , y , n , i = None , g =0 , m =1 , defer =0 , status = ’ joint - life ’ , method = ’ udd ’)
3
4 # Moment of Death
5 t_nAxy_ ( mtx , mty , x , y , n , i = None , g =0 , defer =0 , status = ’ joint - life ’ , method = ’ udd ’)
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of a deferred
temporary life insurance (i.e. net single premium), that pays 1 at the end of the period/moment of death of a
group of two individuals, for joint-life or last survivor methods.
Parameters
mtx mortality table for (x)
mty mortality table for (y)
x age of (x) at the beginning of the contract
y age of (y) at the beginning of the contract
n number of terms of years of the contract
i Interest rate (e.g. use 2 for 2%)
g Rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constants payments.
m Number of fractions for each period of the interest rate
defer number of years of deferment
status status under which the probability is to be computed: ’joint-life’ or ’last-survivor’
method For non-integer ages and periods, use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality and ’bal’ for Balducci approximation
Examples
1 # End of the period
2 l2h . t_nAxy_ ( mtx = grf95 , mty = tv7377 , x =35 , y =40 , n =20 , i =2 , defer =3 , status = ’ joint - life ’)
3 # 0.09156020490195788
4 l2h . t_nAxy_ ( mtx = grf95 , mty = tv7377 , x =35 , y =40 , n =20 , i =2 , defer =3 , status = ’ last - survivor ’)
5 # 0.00212904926970781
6 l2h . t_nAxy_ ( mtx = grf95 , mty = tv7377 , x =35.2 , y =40.6 , n =20 , i =2 , g =1 , defer =3 , status = ’ joint - life
’ , method = ’ cfm ’) # 0 . 2 2 8 9 9 2 1 8 3 2 1 1 2 3 4 2 4
7 l2h . t_nAxy_ ( mtx = grf95 , mty = tv7377 , x =35.2 , y =40.6 , n =20 , i =2 , g =1 , defer =3 , status = ’ last -
survivor ’ , method = ’ cfm ’) # 0.14319533154878325
8 # Moment of Death
9 l2h . t_nAxy_ ( mtx = grf95 , mty = tv7377 , x =35 , y =40 , n =15 , i =2 , g =1 , defer =20 , status = ’ joint - life ’)
10 # 0.20792147954614337
11 l2h . t_nAxy_ ( mtx = grf95 , mty = tv7377 , x =35 , y =40 , n =15 , i =2 , g =1 , defer =20 , status = ’ last - survivor ’)
12 # 0.08858787155153025
13 l2h . t_nAxy_ ( mtx = grf95 , mty = tv7377 , x =55.8 , y =40 , n =10 , i =2 , defer =10 , status = ’ joint - life ’ ,
method = ’ bal ’) # 0 . 0 9 2 0 1 2 4 8 0 7 8 6 6 5 4 3 6
14 l2h . t_nAxy_ ( mtx = grf95 , mty = tv7377 , x =55.8 , y =40 , n =10 , i =2 , defer =10 , status = ’ last - survivor ’ ,
method = ’ bal ’) # 0 . 0 0 3 1 6 6 7 1 3 1 7 7 7 4 0 7 3 0 4
63
6.3.6 nAExy and nAExy
Usage
1 # End of the period
2 nAExy ( mtx , mty , x , y , n , i = None , g =0 , m =1 , status = ’ joint - life ’ , method = ’ udd ’)
3
4 # Moment of Death
5 nAExy_ ( mtx , mty , x , y , n , i = None , g =0 , status = ’ joint - life ’ , method = ’ udd ’)
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of an Endowment
life insurance (i.e. net single premium), that pays 1 at the end of the period/moment of death of a group of
two individuals or pays 1 if the group is alive at the end of the contract, for joint-life or last survivor methods.
Parameters
mtx mortality table for (x)
mty mortality table for (y)
x age of (x) at the beginning of the contract
y age of (y) at the beginning of the contract
n number of terms of years of the contract
i Interest rate (e.g. use 2 for 2%)
g Rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constants payments.
m Number of fractions for each period of the interest rate
status status under which the probability is to be computed: ’joint-life’ or ’last-survivor’
method For non-integer ages and periods, use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality and ’bal’ for Balducci approximation
Examples
1 # End of the period
2 l2h . nAExy ( mtx = grf95 , mty = tv7377 , x =36 , y =41 , n =15 , i =2 , g =1 , status = ’ joint - life ’)
3 # 0.8660767908641055
4 l2h . nAExy ( mtx = grf95 , mty = tv7377 , x =36 , y =41 , n =15 , i =2 , g =1 , status = ’ last - survivor ’)
5 # 0.8626451905971021
6 l2h . nAExy ( mtx = grf95 , mty = tv7377 , x =55.8 , y =40 , n =10 , i =2 , status = ’ joint - life ’ , method = ’ cfm ’)
7 # 0.8242538413270563
8 l2h . nAExy ( mtx = grf95 , mty = tv7377 , x =55.8 , y =40 , n =10 , i =2 , status = ’ last - survivor ’ , method = ’ cfm ’)
9 # 0.8203804618128456
10 # Moment of Death
11 l2h . nAExy_ ( mtx = grf95 , mty = tv7377 , x =36 , y =41 , n =15 , i =2 , g =1 , status = ’ joint - life ’)
12 # 0.8678007454005405
13 l2h . nAExy_ ( mtx = grf95 , mty = tv7377 , x =36 , y =41 , n =15 , i =2 , g =1 , status = ’ last - survivor ’)
14 # 0.8638424731901125
15 l2h . nAExy_ ( mtx = grf95 , mty = tv7377 , x =55.8 , y =40 , n =10 , i =2 , status = ’ joint - life ’ , method = ’ cfm ’)
16 # 0.8247666396432718
17 l2h . nAExy_ ( mtx = grf95 , mty = tv7377 , x =55.8 , y =40 , n =10 , i =2 , status = ’ last - survivor ’ , method = ’ cfm ’)
18 # 0.8203876627116821
64
6.3.7 t nAExy and t nAExy
Usage
1 # End of the Period
2 t_nAExy ( mtx , mty , x , y , n , i = None , g =0 , m =1 , defer =0 , status = ’ joint - life ’ , method = ’ udd ’)
3
4 # Moment of Death
5 t_nAExy_ ( mtx , mty , x , y , n , i = None , g =0 , defer =0 , status = ’ joint - life ’ , method = ’ udd ’)
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of a deferred
Endowment life insurance (i.e. net single premium), that pays 1 at the end of the period/moment of death of a
group of two individuals or pays 1 at the end of the contract, if the group is alive, for joint-life or last survivor
methods.
Parameters
mtx mortality table for (x)
mty mortality table for (y)
x age of (x) at the beginning of the contract
y age of (y) at the beginning of the contract
n number of terms of years of the contract
i Interest rate (e.g. use 2 for 2%)
g Rate of growing (in percentage), for payments evolving geometrically (e.g. 1 for 1%)
g > 0 for increasing payments, g < 0 for decreasing payments and g = 0 for constants payments.
m Number of fractions for each period of the interest rate
status status under which the probability is to be computed: ’joint-life’ or ’last-survivor’
defer number of years of deferment
method For non-integer ages and periods, use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality and ’bal’ for Balducci approximation
Examples
1 # End of the period
2 l2h . t_nAExy ( mtx = grf95 , mty = tv7377 , x =40 , y =45 , n =15 , i =2 , g =0 , defer =10 , status = ’ joint - life ’)
3 # 0.5922187614008853
4 l2h . t_nAExy ( mtx = grf95 , mty = tv7377 , x =40 , y =45 , n =15 , i =2 , g =0 , defer =10 , status = ’ last - survivor ’)
5 # 0.6076108022457168
6
7 # Moment of Death
8 l2h . t_nAExy_ ( mtx = grf95 , mty = tv7377 , x =40 , y =45 , n =15 , i =2 , g =0 , defer =10 , status = ’ joint - life ’)
9 # 0.5933881039489882
10 l2h . t_nAExy_ ( mtx = grf95 , mty = tv7377 , x =40 , y =45 , n =15 , i =2 , g =0 , defer =10 , status = ’ last -
survivor ’)
11 # 0.6076500583192895
65
6.3.8 t nIArxy and t nIArxy
r (m) r r (m) r
Actuarial Notation: t| IAxy:n , t| IAxy:n , t| I Āxy:n , t| I Āxy:n
r (m) r r (m) r
t| IAxy:n , t| IAxy:n , t| I Āxy:n , t| I Āxy:n
Usage
1 # End of the Year
2 t_nIArxy ( mtx , mty , x , y , n , i = None , defer =0 , first_payment =1 , inc =1 , status = ’ joint - life ’ ,
method = ’ udd ’)
3
4 # Moment of Death
5 t_nIArxy_ ( mtx , mty , x , y , n , i = None , defer =0 , first_payment =1 , inc =1 , status = ’ joint - life ’ ,
method = ’ udd ’)
Description: Returns the Expected Present Value (EPV) [Actuarial Present Value (APV)] of a deferred Term
Life Insurance (i.e. net single premium), that pays 1 + k, at the end of year/moment of death of a group of two
individuals, if death occurs between ages x + t + k and x + t + k + 1, for k=0, 1, . . . , n − 1. The capital of the
first year may differ from the rate of the progression.
Parameters
mtx mortality table for (x)
mty mortality table for (y)
x age of (x) at the beginning of the contract
y age of (y) at the beginning of the contract
n number of terms of years of the contract
i Interest rate (e.g. use 2 for 2%)
defer number of deferment years
first payment amount of capital in the first year
inc rate of the progression (in monetary units)
status status under which the probability is to be computed: ’joint-life’ or ’last-survivor’
method For non-integer ages and periods, use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality and ’bal’ for Balducci approximation
Examples
1 # End of the year
2 l2h . t_nIArxy ( mtx = grf95 , mty = tv7377 , x =40 , y =45 , n =15 , i =2 , defer =0 , first_payment =1 , inc =1 ,
status = ’ joint - life ’)
3 # 0.6490737001595632
4 l2h . t_nIArxy ( mtx = grf95 , mty = tv7377 , x =40 , y =45 , n =15 , i =2 , defer =1 , first_payment =1 , inc =1 ,
status = ’ joint - life ’)
5 # 0.6753668707865095
6 l2h . t_nIArxy ( mtx = grf95 , mty = tv7377 , x =40 , y =45 , n =15 , i =2 , defer =0 , first_payment =1 , inc =1 ,
status = ’ last - survivor ’)
7 # 0.6547667655641614
8 l2h . t_nIArxy ( mtx = grf95 , mty = tv7377 , x =40 , y =45 , n =15 , i =2 , defer =1 , first_payment =1 , inc =1 ,
status = ’ last - survivor ’)
9 # 0.6826053359315403
66
1 # Moment of Death
2 l2h . t_nIArxy_ ( mtx = grf95 , mty = tv7377 , x =40 , y =45 , n =15 , i =2 , defer =0 , first_payment =1 , inc =1 ,
status = ’ joint - life ’)
3 # 0.6555323040122456
4 l2h . t_nIArxy_ ( mtx = grf95 , mty = tv7377 , x =40 , y =45 , n =15 , i =2 , defer =1 , first_payment =1 , inc =1 ,
status = ’ joint - life ’)
5 # 0.6820871046714496
6 l2h . t_nIArxy_ ( mtx = grf95 , mty = tv7377 , x =40 , y =45 , n =15 , i =2 , defer =0 , first_payment =1 , inc =1 ,
status = ’ last - survivor ’)
7 # 0.6612820182290613
8 l2h . t_nIArxy_ ( mtx = grf95 , mty = tv7377 , x =40 , y =45 , n =15 , i =2 , defer =1 , first_payment =1 , inc =1 ,
status = ’ last - survivor ’)
9 # 0.6893975961192896
67
7 Actuarial Tables
From a given Mortality Table, the library allows for the construction of an Actuarial Table (or Commutation
Table) providing and allowing to access the values of the common commutation symbols.
This functions are useful for academic purposes, or to implement “old” life contingency products where com-
mutation symbols were commonly used.
At the moment, actuarial evaluation should use cashflow projections, for which interest rate curves should be
considered instead of a fixed one, as in the case of actuarial tables. Despite this, this library allows for the
computation of traditional methods in life insurance and, for that purpose, present value of life annuities and
life insurance contracts are defined, in the library, as properties of the actuarial table.
Tables 16 and 17, in section 7.4 and Tables 18 and 19, in section 7.5, resume the syntax to compute these values
from an actuarial table.
class CommutationTable
This class instantiates, for a specific mortality table and interest rate, all the usual commutation functions: Dx ,
Nx , Sx , Cx ,Mx and Rx .
Usage
1 C o m m u t a t i o n F u n c t i o n s ( i = None , g =0 , data_type = ’q ’ , mt = None , perc =100 , app_cont = False )
Description
Initializes the CommutationTable class so that we can construct an actuarial table with the usual fields.
Parameters
i Interest Rate, in percentage. For instance, use 5 for 5%.
g Rate of growing (in percentage), for capitals evolving geometrically.
g > 0 for increasing capitals and g < 0 for decreasing capitals
data type Use ’l’ for lx , ’p’ for px and ’q’ for qx .
mt The mortality table, in array format, according to the data type defined
perc The percentage of qx to use, e.g., use 50 for 50%.
app cont Use True for continuous approach (deaths occur, in average, in the middle of the year)
or False for considering death payments are considered in the end of the year.
Examples
1 from soa_tables import r e a d _ s o a _ t a b l e _ x m l as rst
2 from lifeactuary import c o m m u t a t i o n _ t a b l e as ct
3
68
10
With the construction of the commutation table (ct), the class computes methods that are useful when com-
puting actuarial evaluations, which are described in sections 7.3.1 to 7.3.7.
class CommutationTableFrac
This class instantiates, for a specific mortality
table and interest rate, all the
usual commutation functions: Dx ,
1 1 f rac − 1
Nx , Sx , Cx , Mx and Rx , for ages x + ∈ 0, ,...,ω + .
f rac f rac f rac
Usage
1 C o m m u t a t i o n F u n c t i o n s ( i = None , g =0 , data_type = ’q ’ , mt = None , perc =100 , frac =2 , method = ’ udd ’)
Description
Initializes the CommutationTableFrac class so that we can construct an actuarial table with the usual fields,
for all indented fractional ages, considering that payments are made in the end of the fractional times.
Parameters
i Interest Rate, in percentage. For instance, use 5 for 5%.
g Rate of growing (in percentage), for capitals evolving geometrically.
g > 0 for increasing capitals and g < 0 for decreasing capitals. For instance, use 2 for 2%.
data type Use ’l’ for lx , ’p’ for px and ’q’ for qx .
mt The mortality table, in array format, according to the data type defined
perc The percentage of qx to use, e.g., use 50 for 50%.
frac Number of fractional ages for each age x
method Approximation method for non-integer ages. Use ’udd’ for Uniform Distribution of Death,
’cfm’ for Constant Force of Mortality and ’bal’ for Balducci approximation.
Examples
1 from soa_tables import r e a d _ s o a _ t a b l e _ x m l as rst
2 from lifeActuary . c o m m u t a t i o n _ t a b l e _ f r a c import C o m m u t a t i o n F u n c t i o n s F r a c
3
69
4 # reads SOA table
5 soa = rst . SoaTable ( ’ soa_tables / ’ + ’ TV7377 ’ + ’. xml ’)
6
7 # creates an actuarial table from qx of SOA table , for ages x + k *0.5 , x =0 ,... , w , k =0 ,1.
8 tv7377_ct_f2 = C o m m u t a t i o n F u n c t i o n s F r a c ( i =2 , g =0 , data_type = ’q ’ , mt = soa . table_qx , perc =100 ,
frac =2 , method = ’ udd ’)
9
10 # creates an actuarial table from qx of SOA table , for ages x + k *0.25 , x =0 ,... , w , k =0 ,1 ,2 ,3
11 tv7377_ct_f4 = C o m m u t a t i o n F u n c t i o n s F r a c ( i =2 , g =0 , data_type = ’q ’ , mt = soa . table_qx , perc =100 ,
frac =4 , method = ’ udd ’)
12
13 # creates an actuarial table from qx of SOA table , for ages x + k *1/6 , x =0 ,... , w , k =0 ,1 ,... ,5
14 tv7377_ct_f6 = C o m m u t a t i o n F u n c t i o n s F r a c ( i =2 , g =0 , data_type = ’q ’ , mt = soa . table_qx , perc =100 ,
frac =6 , method = ’ udd ’)
15
16 # creates an actuarial table from qx of SOA table , for ages x + k *1/365 , x =0 ,... , w ,
k =0 ,1 ,... ,364
17 tv73 77_ct_f3 65 = C o m m u t a t i o n F u n c t i o n s F r a c ( i =2 , g =0 , data_type = ’q ’ , mt = soa . table_qx , perc =100 ,
frac =365 , method = ’ udd ’)
18
19 # creates an actuarial table from qx of SOA table , for ages x + k *0.5 , x =0 ,... , w , k =0 ,1 with
rate of growing of 1%
20 t v7 37 7_ c t_ f2 _g 1 = C o m m u t a t i o n F u n c t i o n s F r a c ( i =2 , g =1 , data_type = ’q ’ , mt = soa . table_qx , perc =100 ,
frac =2 , method = ’ udd ’)
With the construction of the fractional commutation table, the class computes methods that may be useful
when computing actuarial evaluations, described in section 7.3.
Observation: Naturally, the CommutationTableFrac class with frac=1 produces the same results as the class
CommutationTable.
The CommutationTableFrac class produces, for each commutation symbol, a vector with ω + (f rac − 1) × ω
components. To simplify the access of each method to each fractional age, the user should use the following
function:
Usage
1 age_to_index ( age_int , age_frac )
Description: Returns the index of the vector position in a given method of an actuarial table, corresponding
to the age int+age frac position.
Parameters
age int integer part of the age
age frac fractional part of the age
Examples
1 tv7377_ct_f2 . age_to_index (50 , 0.5) # 101
2 tv7377_ct_f4 . age_to_index (50 , 0.75) # 203
3 tv7377_ct_f6 . age_to_index (50 , 5/6) # 305
70
7.3 Commutation Table Methods
In the following sections we detail the available methods in a commutation table object, which we will denote
by ct, where we included the commutation symbols, as well as methods for evaluating standard life annuities
and life insurance from commutation symbols.
Naturally, for life annuities and life insurance (for integer ages and terms) the results are coincident with the
ones presented in the correspondent previous chapters, where life annuities and life insurance functions were
presented and illustrated. In the case of life annuities paid m times per year, within the commutation table
object, we follow the standard approximations as, for instance,
m−1 m+1
a(m)
x = ax + and ä(m)
x = ax +
2m 2m
7.3.1 v
Actuarial Notation v
1
Definition 1+i
Usage ct.v
Example tv7377 ct.v
Result 0.9803921568627451
As for the Dx frac method, the following examples illustrate the use of the method:
Examples
1 x =50.5
2 index_age = tv7377_ct_f2 . age_to_index ( int ( x ) , x - int ( x ) ) # 101
3 a = tv7377_ct_f2 . Dx_frac [ index_age ]
4 print ( f ’ For age { x } with index { index_age } , Dx ={ a } ’)
5 # For age 50.5 , with index 101 , Dx = 3 4 5 3 5 . 0 2 5 4 7 9 2 6 7 5 4
71
As for the Nx frac method, the following examples illustrates the use of the method:
Examples
1 x =35+1/6
2 index_age = tv7377_ct_f6 . age_to_index ( int ( x ) , x - int ( x ) ) # 211
3 a = tv7377_ct_f6 . Nx_frac [ index_age ]
4 print ( f ’ For age { x } with index { index_age } , Nx ={ a } ’)
5 # For age 35.166666666666664 , with index 211 , Nx = 8 3 3 3 8 2 2 . 5 8 7 4 9 5 9 1 1
6
8 # # Present value of an unitary whole life annuity due , paid quarterly to an individual aged
x =65.25
9 x =65.25
10 index_age = tv7377_ct_f4 . age_to_index ( int ( x ) , x - int ( x ) ) # 261
11 a = tv7377_ct_f4 . Nx_frac [ index_age ]/ tv7377_ct_f4 . Dx_frac [ index_age ]
12 print ( f ’ For age { x } with index { index_age } , ax ={ a } ’)
13 # For age 65.25 , with index 261 , ax = 5 6 . 9 1 2 3 2 5 7 9 5 3 8 6 8
14
15
16 # # Present value of an unitary whole life annuity due , paid annually to an individual aged
x =65.25
17 print ( f ’ For age { x } , with index { index_age } , ax (4) ={ a /4} ’)
18 # For age 65.25 , with index 261 , ax (4) = 1 4 . 2 2 8 0 8 1 4 4 8 8 4 6 7
19
20
21 # # Present value of an unitary whole life annuity immediate , paid daily to an individual aged
x =66+120/365
22 x =66+120/365
23 index_age = tv7377_ ct_f365 . age_to_index ( int ( x ) , x - int ( x ) ) # 24210
24 a = tv7377_c t_f365 . Nx_frac [ index_age ]/ tv7377 _ct_f36 5 . Dx_frac [ index_age ]
25 print ( f ’ For age { x } with index { index_age } , ax ={ a } ’)
26 # For age 6 6 . 3 2 8 7 6 7 1 2 3 2 8 7 6 8 with index 24210 , ax = 4 9 3 1 . 6 2 6 6 3 1 8 9 5 1 9 5
27
28
29 # # Present value of an unitary whole life annuity immediate , paid annually to an individual
aged x =66+120/365
30 print ( f ’ For age { x } , with index { index_age } , ax (365) ={ a /365} ’)
31 # For age 66.32876712328768 , with index 24210 , ax (365) = 1 3 . 5 1 1 3 0 5 8 4 0 8 0 8 7 5 3
Examples for using Sx frac are similar to the previous methods and will be omitted.
In the following methods, the choice between payments made in the “end of the year” or in the “moment of
death” must be performed when constructing the commutation table (False or True in the app cont parameter,
respectively). In that sense, the actuarial notation in each of the following methods is given for both scenarios.
72
As for the computation of these commutation symbols for non-integer ages, the reasoning is the same as the
previous sub-sections: define a fractional actuarial table and use the methods for non-integer ages, according
the defined fractions of the year. In that sense, examples will not the included.
Examples
1 # Actuarial present value of a unitary due whole life annuity for (50) paid annually
2 tv7377_ct . Nx [50]/ tv7377_ct . Dx [50] # 22.55443277
3
4 # Actuarial present value of a whole life insurance for (50) with 100.000 m . u . capital .
Payment is made in the moment of death
5 tv7377_ct_md = ct . C o m m u t a t i o n F u n c t i o n s (2 , 0 , ’q ’ , soa . table_qx , 100 , True )
6 100000* tv7377_ct_md . Mx [50]/ tv7377_ct_md . Dx [50] # 56330.616995
7
8 # Present value of an unitary whole life annuity due , paid quarterly to an individual aged
x =65.25
9 x = 65.25
10 index_age = tv7377_ct_f4 . age_to_index ( int ( x ) , x - int ( x ) ) # 261
11 a = tv7377_ct_f4 . Nx_frac [ index_age ] / tv7377_ct_f4 . Dx_frac [ index_age ]
12 print ( f ’ For age { x } , with index { index_age } , ax (4) ={ a } ’)
13 # For age 65.25 , with index 261 , ax (4) = 5 6 . 9 1 2 3 2 5 7 9 5 3 8 6 8
14
15 # # Actuarial present Value of unitary annuity due , paid semiannually with 10 terms for (35.5)
16 x = 35.5
17 n =10/2
18 index_age = tv7377_ct_f2 . age_to_index ( int ( x ) , x - int ( x ) )
19 index_age_end = tv7377_ct_f2 . age_to_index ( int ( x + n ) , x + n - int ( x + n ) )
73
20 b = ( tv7377_ct_f2 . Nx_frac [ index_age ] - tv7377_ct_f2 . Nx_frac [ index_age_end ]) / tv7377_ct_f2 .
Dx_frac [ index_age ]
21 print ( f ’ For age { x } , with index { index_age } , with semiannual payments until age { x + n } , with
index { index_age_end } , ax : n ={ b } ’)
22 # For age 35.5 , with index 71 , with semiannual payments until age 40.5 , with index 81 ,
ax : n = 9 . 5 4 2 7 1 4 9 8 0 6 4 4 4 6 5
23
24 # # Actuarial present value of a whole life insurance for (50.75) with 100.000 m . u . capital .
25 x =50.75
26 index_age = tv7377_ct_f4 . age_to_index ( int ( x ) , x - int ( x ) ) # 203
27 b =100000* tv7377_ct_f4 . Mx_frac [ index_age ]/ tv7377_ct_f4 . Dx_frac [ index_age ]
28 print ( f ’ For age { x } , with index { index_age } , the risk premium is Ax ={ b } ’)
29 # For age 50.75 , with index 203 , the risk premium is Ax = 5 6 9 0 9 . 9 6 9 5 6 1 1 8 8 1 6
30
31 # # Actuarial present Value of a whole life annuity paid semiannually to an individual aged
x = 35.5. Payments have a growth rate of 1%
32 x = 35.5
33 index_age = t v7 37 7 _c t_ f2 _ g1 . age_to_index ( int ( x ) , x - int ( x ) ) # 151
34 a = t v7 37 7_ c t_ f2 _g 1 . Nx_frac [ index_age ] / tv 73 77 _ ct _f 2_ g 1 . Dx_frac [ index_age ]
35 print ( f ’ For age { x } , with index { index_age } , Gax (2) ={ a } ’)
36 # For age 35.5 , with index 71 , Gax (2) = 7 0 . 3 1 3 8 0 7 8 1 4 6 4 6 8 2
Table 16: Actuarial Notation and Syntax Formula for Life Annuities in Commutation Tables
74
Table 17: Actuarial Notation and Syntax for Increasing/Decreasing Life Annuities in Commutation Tables
For life annuities with terms varying geometrically, the Actuarial Table must be built with a growth rate g as
defined in section 7.1, and the functions from Table 16 are applied.
Important Remark:
When using CommutationTableFrac, all the above methods for the computation of life annuities are available.
However, since the acturial table is already fractional, parameter m should always be set to 1.
7.4.1 Examples
In this section, we illustrate the use of life annuities methods included in CommutationTable class.
Remarks:
75
9 # Deferred Life Annuities
10 tv7377_ct . t_nax ( x =50 , n =10 , m =1 , defer =5) # 7.670292001795834
11 tv7377_ct . t_nax ( x =50 , n =10 , m =4 , defer =5) # 7.750622055449898
12
Remarks:
6 # Due
7 tv7377_ct . t_nIaax ( x =50 , n =10 , m =1 , defer =0 , first_amount =1 , i n cr ea se _ am ou nt =1) # 47.5374643
8 tv7377_ct . t_nIaax ( x =50 , n =10 , m =1 , defer =0 , first_amount =1 , i n cr ea se _ am ou nt =5) # 201.771158
9 tv7377_ct . t_nIaax ( x =50 , n =10 , m =1 , defer =0 , first_amount =100 , in c re as e_ a mo un t = -5) # 705.111980
Remarks:
6 # creates an actuarial table from qx of SOA table with geometric increase of 5% on payments
7 tv73 77_ctg_i nc = ct . C o m m u t a t i o n F u n c t i o n s ( i =2 , g =5 , data_type = ’q ’ , mt = soa . table_qx , perc =100 ,
app_cont = False )
8
10 # creates an actuarial table from qx of SOA table with geometric decrease of 5% on payments
11 tv73 77_ctg_d ec = ct . C o m m u t a t i o n F u n c t i o n s ( i =2 , g = -5 , data_type = ’q ’ , mt = soa . table_qx , perc =100 ,
app_cont = False )
12
13 # actuarial present value of a geometrically evolving life annuity for a 50 years old
indidivual , for 10 years period
14 tv73 77_ctg_i nc . naax (50 ,10 ,1) # 1 1 . 1 8 0 9 1 8 2 2 1 9 5 9 9 8
15 tv73 77_ctg_d ec . naax (50 ,10 ,1) # 7 . 2 8 1 6 8 2 9 3 2 5 9 5 8 5 4
76
Present Value Function
1 # Present value of a series of cash - flows c =(100 , -25 , 120 , 300 , -50) paid to a age =35
individual .
2 # Spot rates for periods of payments are given by (1.2% , 1.4% , 1.8% , 1.6% , 1.9%) .
3
4 # 1 - Payments are made upon the survival of the individual . Survival probabilities are set by
the chosen mortality table
5 pv1 = tv7377_ct . present_value ( probs = None , age =35 ,
6 spot_rates =[1.2 , 1.4 , 1.8 , 1.6 , 1.9] , capital =[100 , -25 , 120 , 300 , -50])
7 print ( ’ Present Value : ’ , pv1 )
8 # 424.2408517830521
9
22 pv3 = tv7377_ct . present_value ( probs = survprobs , age = None , spot_rates =[1.2 , 1.4 , 1.8 , 1.6 , 1.9] ,
capital =[100 , -25 , 120 , 300 , -50])
23 print ( ’ Present Value : ’ , pv3 )
24 # 422.7070503910042
7.5.1 Examples
In this section, examples on the use of methods for pricing life insurance, available in the CommutationTable
class are illustrated.
77
Table 18: Actuarial Notation and Syntax Formula for Life Insurances - fixed capitals
Table 19: Actuarial Notation and Syntax Formula for Life Insurances - variable capitals
14 # Endowment Insurance
15 tv7377_ct . nAEx ( x =50 , n =10) # 0.8239403730310333
16 tv7377_ct . t_nAEx ( x =50 , n =10 , defer =2) # 0.7863040688470341
78
1 # Temporary Life Insurance with variable Capitals
2 # ( arithmetic progression with first amount = rate of the progression )
3 tv7377_ct . IAx ( x =50) # 15.807431562003355
4 tv7377_ct . nIAx ( x =50 , n =10) # 0 . 2 7 5 1 8 5 5 5 2 0 1 5 2 5 8 7
5 tv7377_ct . nIAx ( x =50 , n =50) # 1 5 . 7 0 2 6 0 2 7 4 7 0 4 3 0 1 3
6
14 # Decreasing Capitals
15 tv7377_ct . nIArx ( x =50 , n =10 , defer =0 , first_amount =1000 , i nc r ea se _a m ou nt = -50)
16 # 35.344544850506836
17 tv7377_ct . nIArx ( x =50 , n =10 , defer =10 , first_amount =1000 , i nc re as e _a mo un t = -50)
18 # 28.027981923486493
Remarks:
9 # Endowment Insurance
10 tv7377_ct . nAEx_ ( x =50 , n =10) # 0.8244057133002101
11 tv7377_ct . t_nAEx_ ( x = 50 , n =10 , defer =2) # 0.7868146552887256
12 tv7377_ct . t_nAEx_ ( x =50 , n =10 , defer =10) # 0.6442926524583354
13
79
Remarks:
Figure 1 illustrates an excerpt of the the produced excel file for TV7377 actuarial table for years fractioned in
semesters.
80
8 Financial Annuities
8.1 Class Annuities Certain
Usage
1 A n n u i t i e s C e r t a in ( interest_rate , m =1)
Description
Initializes the AnnuitiesCertain class so that we can compute the present value of financial annuities.
Parameters
interest rate interest rate, in percentage (e.g. use 5 for 5%)
m frequency of payments, in each period of the interest rate
Examples
1 from lifeactuary import a n n u i t i e s _ c e r t a i n as ac
2
3 # instantiates a methods for computing financial annuities with a 5% annual interest rate ,
with annual payments
4 i1 = ac . A n n u i t i e s _ C e r t a i n (5 ,1)
5
6 # instantiates a methods for computing financial annuities with a 5% annual interest rate ,
with quarterly payments
7 i4 = ac . A n n u i t i e s _ C e r t a i n (5 ,4)
8.1.1 im
Actuarial Notation im
Definition m (1 + i)1/m − 1
Usage irate.im
Example i4.im
Result 0.04908893771615741
8.1.2 vm
Actuarial Notation vm
1
Definition 1+ im
m
Usage irate.vm
Example i4.vm
Result 0.9878765474230741
81
8.1.3 dm
Actuarial Notation dm
1/m
i
Definition 1− 1+i −1
Usage irate.dm
Example i4.dm
Result 0.0484938103077039
(m) (m)
Actuarial Notation: an and an or a∞ and a∞
Usage
1 an ( terms )
Description: Returns the present value of an immediate n term financial annuity with payments equal to 1.
Payments are made in the end of the periods. In fractional annuities, payments of 1/m are made m times per
year at the end of the periods.
Parameters
terms number of periods (measured in periods of the interest rate)
(terms=None) or (terms=0) returns the present value of the perpetual annuity
Examples
1 i1 . an (10) # 7 . 7 2 1 7 3 4 9 2 9 1 8 4 8 1 3
2 i4 . an (10) # 7 . 8 6 5 0 4 5 8 6 2 0 9 7 8 2
3
4 i1 . an ( None ) # 1 9 . 9 9 9 9 9 9 9 9 9 9 9 9 9 8 2
5 i4 . an (0) # 2 0 . 3 7 1 1 8 8 4 2 9 0 9 5 9 9 8
8.2.2 aan
(m) (m)
Actuarial Notation: än and än or ä∞ and ä∞
Usage
1 aan ( terms )
Description: Returns the present value of a due n term financial annuity with payments equal to 1. Payments
are made in the beginning of periods. In fractional annuities, payments of 1/m are made m times per year at
the end of the periods.
Parameters
terms number of periods (measured in periods of the interest rate)
(terms=None) or (terms=0) returns the present value of the perpetual annuity
82
Examples
1 i1 . aan (10) # 8 . 1 0 7 8 2 1 6 7 5 6 4 4 0 5 4
2 i4 . aan (10) # 7 . 9 6 1 5 6 7 5 4 8 7 1 2 6 3 0 5
3
4 i1 . aan ( None ) # 2 0 . 9 9 9 9 9 9 9 9 9 9 9 9 9 8 2
5 i4 . aan (0) # 2 0 . 6 2 1 1 8 8 4 2 9 0 9 5 9 9 8
8.3.1 Ian
(m) (m)
Actuarial Notation: (Ia)n and (Ia)n or (Da)n and (Da)n
Usage
1 Ian ( terms , payment =1 , increase =1)
Description: Returns the present value of an immediate n term financial annuity with payments increasing/de-
creasing arithmetically. Payments are made in the end of the periods. First payment and increase amount may
differ. In fractional annuities, payments level within each interest period and increase/decrease from one interest
period to the next.
Parameters
terms number of periods (measured in periods of the interest rate)
payment amount of the first payment
increase increase amount of payments (> 0 for increasing annuities and < 0 for decreasing annuities)
Actuarial Formula
For C - first payment , r - rate of increasing/decreasing, i-annual interest rate, n - number of terms, m-frequency
of payments
83
Examples
1 a4 = ac . A n n u i t i e s _ C e r t a i n ( interest_rate =5 , m =12)
2 r4 = a4 . Ian ( terms =20 , payment =2000 * 12 , increase =400 * 12)
3 print ( r4 )
4 # 789369.5624059099
8.3.2 Iaan
(m) (m)
Actuarial Notation: Iän and Iän or Dän and Dän
Usage
1 Iaan ( terms , payment =1 , increase =1)
Description: Returns the present value of a due n term financial annuity with payments increasing/decreasing
arithmetically. Payments are made in the beginning of the periods. First payment and increase amount may
differ. In fractional annuities, payments level within each interest period and increase/decrease from one interest
period to the next.
Parameters
terms number of periods (measured in periods of the interest rate)
payment amount of the first payment
increase increase amount of payments (> 0 for increasing annuities and < 0 for decreasing annuities)
Examples
1 a5 = ac . A n n u i t i e s _ C e r t a i n ( interest_rate =2 , m =2)
2 r5 = a5 . Iaan ( terms =2 , payment =1 , increase =1)
3 print ( r5 )
4 # 2.946198813622495
8.3.3 Iman
(m) (m)
Actuarial Notation: (I (m) a)n and (I (m) a)n or (D(m) a)n and (D(m) a)n
Usage
1 Iman ( terms , payment =1 , increase =1)
Description: Returns the present value of an immediate n-term financial annuity with payments increasing/de-
creasing arithmetically. Payments are made in the end of the periods. First payment and increase amount may
differ. In fractional annuities, payments increase in each payment period.
84
Parameters
terms number of periods (measured in periods of the interest rate)
payment amount of the first payment
increase increase amount of payments (> 0 for increasing annuities and < 0 for decreasing annuities)
Actuarial Formula
For C - first payment , r - rate of increasing/decreasing, i-annual interest rate, n - number of terms, m-frequency
of payments
(m)
(m) (m) (m) ani − nv n
(C,r) (I a)n = C an + rm
i(m)
Examples
1 a3 = ac . A n n u i t i e s _ C e r t a i n ( interest_rate =3.3 , m =12)
2 r3 = a3 . Iman ( terms =8 , payment =25 * 12 , increase =2 * 12)
3 print ( r3 )
4 # 9781.284321297218
8.3.4 Gan
(m)
Actuarial Notation: g (Ga)n and g (Ga)n
Usage
1 Gan ( terms , payment =1 , grow =0)
Description: Returns the present value of an immediate n term financial annuity with payments increasing/de-
creasing geometrically. Payments are made in the end of the periods. In fractional annuities, payments level
within each interest period and increase/decrease from one interest period to the next.
Parameters
terms number of periods (measured in periods of the interest rate)
payment amount of the first payment
grow rate of growing of payments, in percentage
85
Actuarial Formula
For C - first payment , g - rate of increasing/decreasing, i-annual interest rate, n - number of terms, m-frequency
of payments
(m)
C 1
m (1+g)1/m an ig , i ̸= g
(m)
(C,g) (Ga)n =
Cnv 1/m , i=g
Examples
1 g1 = ac . A n n u i t i e s _ C e r t a i n ( interest_rate =5 , m =2)
2 g1 . Gan ( terms =5 , payment =10 , grow =10)
3 # 108.60048398210647
8.3.5 Gaan
(m)
Actuarial Notation: g (Gä)n
Usage
1 Gaan ( terms , payment =1 , grow =0)
Description: Returns the present value of an immediate n term financial annuity with payments increasing/de-
creasing geometrically. Payments are made in the end of the periods. In fractional annuities, payments level
within each interest period and increase/decrease from one interest period to the next.
Parameters
terms number of periods (measured in periods of the interest rate)
payment amount of the first payment
grow rate of growing of payments, in percentage
Examples
1 g2 = ac . A n n u i t i e s _ C e r t a i n ( interest_rate =5 , m =4)
2 g2 . Gaan ( terms =5 , payment =100 , grow =10)
3 # 2185.9539086346845
8.3.6 Gman
(m)
Actuarial Notation: g (G(m) a)n or g (G(m) a)n
Usage
1 Gman ( terms , payment =1 , grow =0)
86
Description: Returns the present value of an immediate n term financial annuity with payments increasing/de-
creasing geometrically. Payments are made in the end of the periods. In fractional annuities, payments increase
in each payment period.
Parameters
terms number of periods (measured in periods of the interest rate)
payment amount of the first payment
grow rate of growing of payments, in percentage
Actuarial Formula
For C - first payment , g - rate of increasing/decreasing, i-annual interest rate, n - number of terms, m-frequency
of payments
(m)
Ca1 i × än ig
, i ̸= g
(m)
(C,g) (Ga)n =
(m)
C n a1 i , i=g
Examples
1 g3 = ac . A n n u i t i e s _ C e r t a i n ( interest_rate =5 , m =2)
2 g3 . Gman ( terms =5 , payment =10 , grow =10)
3 # 53.022051853437205
8.3.7 Gmaan
Usage
1 Gmaan ( terms , payment =1 , grow =0)
Description: Returns the present value of an immediate n term financial annuity with payments increasing/de-
creasing geometrically. Payments are made in the beginning of the periods. In fractional annuities, payments
increase in each payment period.
Parameters
terms number of periods (measured in periods of the interest rate)
payment amount of the first payment
grow rate of growing of payments, in percentage
Examples
1 g4 = ac . A n n u i t i e s _ C e r t a i n ( interest_rate =5 , m =2)
2 g4 . Gmaan ( terms =5 , payment =10 , grow =10)
3 # 51.80299115517991
87
9 Examples
In this section we present some interesting and more complete examples of application, for which the use of
lifeactuary package is helpful and provides “easy to use” solutions and functions.
Example 1
Consider a 50 year old individual and the TV7377 mortality table.
1. Determine the probabilities of (50) being alive in the end of each month of the following ten years,
considering the Uniform Distribution of Death approximation.
2. Determine the probabilities of (50) not surviving up to the end of each month of the following ten years,
considering the Uniform Distribution of Death approximation.
4 import numpy as np
5 import pandas as pd
6 import matplotlib . pyplot as plt
7
11 # Question 1
12 x = 55
13 n = np . linspace (0 , 10 , 10*12)
14 sprobs = [ lt . npx ( x =x , n =i , method = ’ udd ’) for i in n ]
15 dprobs = [ lt . nqx ( x =x , n =i , method = ’ udd ’) for i in n ]
16 ages = x + n
17 df = pd . DataFrame . from_dict ({ ’n ’: n , ’x ’: ages , ’ npx ’: sprobs , ’ nqx ’: dprobs })
18
19 # Question 2
20 df . to_excel ( excel_writer = ’ example1 . xlsx ’ , sheet_name = ’ example1 ’ , index = False , freeze_panes =(1 ,
1) )
21
22 # Question 3
23 plt . scatter (n , sprobs , s =.5 , color = ’ blue ’)
24
88
31
Probability of Survival
1.00
0.99
0.98
0.97
n p55
0.96
0.95
0.94
0.93
0 2 4 6 8 10
n
Probability of Dying
0.07
0.06
0.05
0.04
n q55
0.03
0.02
0.01
0.00
0 2 4 6 8 10
n
89
9.2 Life Tables and Life Annuities
Example 2
In this example, let us develop the Python code for answering the following questions:
1. Import mortality tables TV7377, GRF95 and GRM95, from SOA Mortality Tables, with the columns x,
lx , px , qx , ex .
2. Construct an actuarial table considering a technical rate of interest of 4% per annum, and append the
columns Dx and Nx to the tables produced in the previous question.
3. Plot the lx , qx , px , ex and ln(Dx ), comparing, in the same graph, the values of each mortality table.
4. Determine the net single premium (risk single premium) of a whole life annuity immediate, if someone 55
years old today, wants to receive 1000e per year considering that:
5. Determine the net single premium (risk single premium) of a 10 years temporary due life annuity, if
someone 55 years old today, wants to receive 1000 m.u. per year.
4 import numpy as np
5 import os
6 import sys
7 import matplotlib . pyplot as plt
8
11 def p a r s e _ t a b l e _ n a m e ( name ) :
12 return name . replace ( ’ ’ , ’ ’) . replace ( ’/ ’ , ’ ’)
13
14 # Question 1
15 table_names = [ ’ TV7377 ’ , ’ GRF95 ’ , ’ GRM95 ’]
16 mt_lst = [ rst . SoaTable ( ’ ../../../ soa_tables / ’ + name + ’. xml ’) for name in table_names ]
17 lt_lst = [ mtable . Mo rtality Table ( mt = mt . table_qx ) for mt in mt_lst ]
18
19
20 # Question 2
21 interest_rate = 4
22 ct_lst = [ ct . C o m m u t a t i o n F u n c t i o n s ( i = interest_rate , g =0 , mt = mt . table_qx ) for mt in mt_lst ]
23
90
29 # Question 3
30 ’’’
31 Plot lx
32 ’’’
33 fig , axes = plt . subplots ()
34 for idx , lt in enumerate ( lt_lst ) :
35 ages = np . arange (0 , lt . w + 2)
36 plt . plot ( ages , lt . lx , label = table_names [ idx ])
37 plt . xlabel ( r ’ $x$ ’)
38 plt . ylabel ( r ’ $l_x$ ’)
39 plt . title ( ’ Expected Number of Individuals Alive ’)
40 plt . grid ( visible = True , which = ’ both ’ , axis = ’ both ’ , color = ’ grey ’ , linestyle = ’ - ’ , linewidth =.1)
41 plt . legend ()
42 plt . savefig ( this_py + ’ lx ’ + ’. eps ’ , format = ’ eps ’ , dpi =3600)
43 plt . show ()
44
45 ’’’
46 Plot dx
47 ’’’
48 fig , axes = plt . subplots ()
49 for idx , lt in enumerate ( lt_lst ) :
50 ages = np . arange (0 , lt . w + 1)
51 plt . plot ( ages , lt . dx , label = table_names [ idx ])
52 plt . xlabel ( r ’ $x$ ’)
53 plt . ylabel ( r ’ $d_x$ ’)
54 plt . title ( ’ Expected Number of Deaths ’)
55 plt . grid ( visible = True , which = ’ both ’ , axis = ’ both ’ , color = ’ grey ’ , linestyle = ’ - ’ , linewidth =.1)
56 plt . legend ()
57 plt . savefig ( this_py + ’ dx ’ + ’. eps ’ , format = ’ eps ’ , dpi =3600)
58 plt . show ()
59
60 ’’’
61 Plot qx
62 ’’’
63 fig , axes = plt . subplots ()
64 for idx , lt in enumerate ( lt_lst ) :
65 ages = np . arange (0 , lt . w + 1)
66 plt . plot ( ages , lt . qx , label = table_names [ idx ])
67 plt . xlabel ( r ’ $x$ ’)
68 plt . ylabel ( r ’ $q_x$ ’)
69 plt . title ( ’ Mortality Rate ’)
70 plt . grid ( visible = True , which = ’ both ’ , axis = ’ both ’ , color = ’ grey ’ , linestyle = ’ - ’ , linewidth =.1)
71 plt . legend ()
72 plt . savefig ( this_py + ’ qx ’ + ’. eps ’ , format = ’ eps ’ , dpi =3600)
73 plt . show ()
74
75 ’’’
76 Plot px
77 ’’’
78 fig , axes = plt . subplots ()
79 for idx , lt in enumerate ( lt_lst ) :
80 ages = np . arange (0 , lt . w + 1)
81 plt . plot ( ages , lt . px , label = table_names [ idx ])
82 plt . xlabel ( r ’ $x$ ’)
83 plt . ylabel ( r ’ $p_x$ ’)
84 plt . title ( ’ Probability of Survival ’)
85 plt . grid ( visible = True , which = ’ both ’ , axis = ’ both ’ , color = ’ grey ’ , linestyle = ’ - ’ , linewidth =.1)
91
86 plt . legend ()
87 plt . savefig ( this_py + ’ px ’ + ’. eps ’ , format = ’ eps ’ , dpi =3600)
88 plt . show ()
89
90 ’’’
91 Plot ex
92 ’’’
93 fig , axes = plt . subplots ()
94 for idx , lt in enumerate ( lt_lst ) :
95 ages = np . arange (0 , lt . w + 1)
96 plt . plot ( ages , lt . ex , label = table_names [ idx ])
97 plt . xlabel ( r ’ $x$ ’)
98 plt . ylabel ( r ’$ { e } _ { x }+1/2 $ ’)
99 plt . title ( ’ Complete Expectation of Life ’)
100 plt . grid ( visible = True , which = ’ both ’ , axis = ’ both ’ , color = ’ grey ’ , linestyle = ’ - ’ , linewidth =.1)
101 plt . legend ()
102 plt . savefig ( this_py + ’ ex ’ + ’. eps ’ , format = ’ eps ’ , dpi =3600)
103 plt . show ()
104
105 ’’’
106 Plot ln ( Dx )
107 ’’’
108 fig , axes = plt . subplots ()
109 for idx , lt in enumerate ( ct_lst ) :
110 ages = np . arange (0 , lt . w + 1)
111 plt . plot ( ages , np . log ( lt . Dx ) , label = table_names [ idx ])
112 plt . xlabel ( r ’ $x$ ’)
113 plt . ylabel ( r ’ $ln ( D_x ) $ ’)
114 plt . title ( r ’ ln ( D_x ) ’)
115 plt . grid ( visible = True , which = ’ both ’ , axis = ’ both ’ , color = ’ grey ’ , linestyle = ’ - ’ , linewidth =.1)
116 plt . legend ()
117 plt . savefig ( this_py + ’ lnDx ’ + ’. eps ’ , format = ’ eps ’ , dpi =3600)
118 plt . show ()
119
120 # Question 4
121 for idx , ct in enumerate ( ct_lst ) :
122 print ( table_names [ idx ] + " : " + f ’{ round (1000 * ct . ax ( x =55 , m =1) , 2) : ,} ’)
123 print ()
124
125 # Question 5
126 for idx , ct in enumerate ( ct_lst ) :
127 print ( table_names [ idx ]+ " : " + f ’{ round (1000 * ct . ax ( x =55 , m =1) / ct . naax ( x =55 , n =5 , m =1) , 2)
: ,} ’)
128
134 # Consult the values used in the computation , only for TV7377
135 ct_lst [0]. msn
92
Expected Number of Individuals Alive Expected Number of Deaths
100000 TV7377 4000 TV7377
GRF95 GRF95
GRM95 GRM95
80000
3000
60000
2000
dx
lx
40000
1000
20000
0 0
0 20 40 60 80 100 120 0 20 40 60 80 100 120
x x
0.6 0.6
qx
px
0.4 0.4
0.2 0.2
TV7377
GRF95
0.0 0.0 GRM95
60 5
ex + 1/2
ln(Dx)
40 0
20 −5
0
0 20 40 60 80 100 120 0 20 40 60 80 100 120
x x
N56
Question 4 a): 1000a55 = 1000 D55
93
9.3 Life Tables and Life Insurance
Example 3
Consider a Pure Endowment insurance with duration 10 years, if someone 55 years old today, subscribes
1000e , considering i = 4%/year. Considering the mortatily tables TV7377, GRF95 and GRM95 and using the
Commutation Table functions:
2. Determine the annual premium paid during 5 years if the insured is alive.
3. Evaluate the price of contract, including the refund of all premiums paid at the end of the year of death
and at the end of the term.
4 import numpy as np
5
12 # General Information
13 x = 55
14 capital = 1000
15 term = 10
16 term_annuity = 5
17 # pure endowment
18 pureEndow = [ ct . nEx ( x =x , n = term ) for ct in ct_lst ]
19 # temporary annuity due
20 tad = [ ct . naax ( x =x , n = term_annuity , m =1) for ct in ct_lst ]
21
22 # ## Question 1
23 print ( ’\ nnet single premium ’)
24 for idx , ct in enumerate ( ct_lst ) :
25 print ( table_names [ idx ] + " : " + f ’{ round ( capital * pureEndow [ idx ] , 5) : ,} ’)
26
27 # ## Question 2
28 print ( ’\ nlevel premium ’)
29 for idx , ct in enumerate ( ct_lst ) :
30 print ( table_names [ idx ] + " : " + f ’{ round ( capital * pureEndow [ idx ] / tad [ idx ] , 5) : ,} ’)
31
37 # ## Question 3
38
94
40 print ( ’\ nSingle Net Risk Premium Refund at End of the Year of Death ’)
41 t e r m L i f e I n s u r a n c e = [ ct . nAx ( x =x , n = term ) for ct in ct_lst ]
42 p u r e E n d o w _ r e f u nd = [ ct . nEx ( x =x , n = term ) / (1 - ct . nAx ( x =x , n = term ) ) for ct in ct_lst ]
43
48 print ( ’\ nSingle Net Premium Refund Cost at End of the Year of Death ’)
49 for idx , ct in enumerate ( ct_lst ) :
50 print ( table_names [ idx ] + " : " + f ’{ round ( capital * pureEndow [ idx ] / (1 - t e r m L i f e In s u r a n c e [
idx ]) , 5) : ,} ’)
51
67
70 print ( ’\ nLeveled Net Risk Premium Refund at End of the Year of Death ’)
71 tli_ increasi ng = [ ct . nIAx ( x =x , n = term_annuity ) for ct in ct_lst ]
72 tli_deferred = [ ct . t_nAx ( x =x , n = term - term_annuity , defer = term_annuity ) for ct in ct_lst ]
73 pureEndow_leveled_refund = [
74 pureEndow [ idx_ct ] / ( tad [ idx_ct ] - tl i_increa sing [ idx_ct ] - term_annuity * tli_deferred [
idx_ct ])
75 for idx_ct , ct in enumerate ( ct_lst ) ]
76
Solutions:
Question 1:
P P = 1000 10 E55
95
Question 2:
10 E55
P ä55 = 1000
ä55:10
Question 3:
Single Premium with Refund paid at the end of the Year of Death
10 E55
P = 1000
1 − A155:10
10 E55
P = 1000
1 − v 10 10 q55
Level Premium with Refund paid at the end of the year of death
10 E55
P = 1000
ä55:10 − (IA)55:10
96
Example 4
For the contract in Example 3.2, estimate the net premium reserves until the end of the contract, export the
estimates to and EXcel file and plot the evolution of the reserves in a graph.
4 l0 = 1000
5 reserves_dict = { ’ table ’: [] , ’x ’: [] , ’ insurer ’: [] , ’ insured ’: [] , ’ reserve ’: []}
6 fund_dict = { ’ lx ’: [] , ’ claim ’: [] , ’ premium ’: [] , ’ fund ’: []}
7
36 # fund
37 fund_dict [ ’ lx ’ ]. append ( lx )
38 qx_1 = clt . nqx ( x = age , n =1)
39 claim = 0
40 if age == x + term :
41 claim = capital * lx
42 fund_dict [ ’ claim ’ ]. append ( claim )
43 premium = 0
44 if tad2 > 0:
45 premium = p r em iu m_ l ev el ed * lx
46 fund_dict [ ’ premium ’ ]. append ( premium )
47 if age == x :
48 fund = lx * p r em iu m_ l ev el ed
49 else :
50 fund = fund_dict [ ’ fund ’ ][ -1] * (1 + interest_rate / 100) - claim + premium
51 fund_dict [ ’ fund ’ ]. append ( fund )
97
52
59 ’’’
60 plot the reserves
61 ’’’
62 for idx_clt , clt in enumerate ( ct_lst ) :
63 plt . plot ( ages , reserves_df . loc [ reserves_df [ ’ table ’] == table_names [ idx_clt ]][ ’ reserve ’] ,
64 label = table_names [ idx_clt ])
65
600
Reserves
400
200
0
56 58 60 62 64
x
98
9.4 Life Annuities and Life Insurance
Example 5
Robert and his wife, Silvia, will turn 66 this year. During the last years, they have invested in retirement
savings products having each accumulated 200,000 m.u. in their fund (they own individual and independent
funds). At the end of this year, they intend to invest the amount of each fund in the purchase of whole life
annuities. Each of them has very different options regarding the way in which they intend to receive income:
– Silvia intends to buy a whole life annuity, paid quarterly, in which the terms of even order are the double of
the odd-numbered terms, with payments made at the end of each trimester.
– Robert intends to acquire a whole life annuity, paid once a year, with the first term paid immediately, whose
terms grow by 200 m.u. each year. Additionally, to celebrate his 70-th birthday, Robert wants to double the
amount of that year. Additionally, Robert wants to buy a 10 years term life insurance, with a capital equal to
the first amount of his life annuity.
Each income will be paid individually to each member of the couple.
Determine the amount of the first term of Robert and Silvia life annuity, considering a TV7377 for Robert and
GRF95 for Silvia, both with a rate of 1%.
14 # # Silvia
15 age = 66
16 premium = 200000
17 a4_66 = la . ax ( mt = grf95 , x = age , i =1 , g =0 , m =4)
18 a2_66 = la . ax ( mt = grf95 , x = age , i =1 , g =0 , m =2)
19 T = premium /(4 * a4_66 + 2 * a2_66 )
20 print ( T )
21
22 # # Robert
23 age = 66
24 premium = 200000
25 termIa = grf95 . w
26 Ia_66 = la . nIax ( mt = tv7377 , x = age , n = termIa , i =1 , m =1 , first_amount =1 , i n cr ea se _ am ou nt =1)
27 E466 = la . nEx ( mt = tv7377 , x = age , i =1 , g =0 , n =4)
28 ad66 = la . aax ( mt = tv7377 , x = age , i =1 , g =0 , m =1)
29 A66_10 = lins . nAx_ ( mt = tv7377 , x = age , n =10 , i =1 , g =0)
30
99
Solutions:
Silvia:
(4) (2)
200 000 = 4T a66 + 2T a66 ⇔
200 000
⇔T = (4) (2)
= 1 480.91 m.u.
4 a66 + 2 a66
Robert:
Example 6
Consider that an Endowment Insurance with claim capital of 100 000 m.u. is sold to a group of 1000 insureds
aged x = 40. The capital in case of life is paid at age r = 65 and premiums are paid during p =15 years.
Using the TV7377 mortality table with an interest rate of 2%, determine:
(a) The evolution of the expected number of insureds still alive at the beginning of year t.
(b) The expected amount of collected premiums, in the beginning of year t.
(c) The expected amount of claims paid at the end of year t.
(d) The evolution of the fund of the contract.
6. Represent the amounts obtained in questions 3a, 3b, 3c and 3d in separated barplots.
100
1 from soa_tables import r e a d _ s o a _ t a b l e _ x m l as rst
2 from lifeActuary import mo rt al i ty _t ab l e as mtable , annuities as la , \
3 m o r t a l i t y _ i n s u r a n c e as lins
4
5 import pandas as pd
6 import numpy as np
7 import matplotlib . pyplot as plt
8
13 # Data
14 x = 40
15 r = 65
16 n_premiums = 15
17 i = 2
18 g =0
19 capital = 100000
20 l0 = 1000
21
22 # QUESTION 1
23 risk _premium _1 = lins . nAEx ( mt = lt , x =x , n = r - x , i =i , g = g )
24 risk_premium = risk_ premium_ 1 * capital
25 print ( f ’ risk_premium : { risk_premium } ’)
26
27 # QUESTION 2
28 aax_r = la . naax ( mt = lt , x =x , n = n_premiums , i =i , g =g , m =1)
29 p re mi um _ le ve le d = risk_premium / aax_r
30 print ( f ’ pr em i um _l ev e le d : { pr e mi um _ le ve le d : ,.2 f } ’)
31
32 # QUESTION 3
33 # lx , Premiums , Claims and Actuarial Liabilities
34 for idx_ages , ages in enumerate ( range (x , r + 1) ) :
35 p a t h _ l i a b i l i t i e s [ ’t ’ ]. append ( idx_ages )
36 p a t h _ l i a b i l i t i e s [ ’ age ’ ]. append ( ages )
37 npx = lt . npx ( x =x , n = idx_ages )
38 nqx = lt . nqx ( x = x + idx_ages , n =1)
39 p a t h _ l i a b i l i t i e s [ ’ px ’ ]. append ( npx )
40 p a t h _ l i a b i l i t i e s [ ’ qx ’ ]. append ( nqx )
41 if idx_ages <= n_premiums - 1:
42 p a t h _ l i a b i l i ti e s [ ’ premium ’ ]. append ( p re mi u m_ le ve l ed )
43 p a t h _ l i a b i l i ti e s [ ’ al ’ ]. append ( lins . nAEx ( mt = lt , x = x + idx_ages , n = r - x - idx_ages , i =i
, g = g ) * capital -
44 p re mi um _ le ve le d *
45 la . naax ( mt = lt , x = x + idx_ages , n = n_premiums - idx_ages ,
i =i , g =g , m =1) )
46 else :
47 p a t h _ l i a b i l i ti e s [ ’ premium ’ ]. append (0)
48 p a t h _ l i a b i l i ti e s [ ’ al ’ ]. append ( lins . nAEx ( mt = lt , x = x + idx_ages , n = r - x - idx_ages , i =i
, g = g ) * capital )
49
101
55 path_fund [ ’ fund ’ ]. append ( l0 * p a t h _ l i a b i l i t i e s [ ’ premium ’ ][ idx_ages ])
56 path_fund [ ’ out ’ ]. append (0)
57 else :
58 if ages < r :
59 path_fund [ ’ out ’ ]. append ( l0 * p a t h _ l i a b i l i t i e s [ ’ px ’ ][ idx_ages -1] *
60 p a t h _ l i a b i l i t i e s [ ’ qx ’ ][ idx_ages -1] * capital )
61 else :
62 path_fund [ ’ out ’ ]. append ( l0 * p a t h _ l i a b i l i t i e s [ ’ px ’ ][ idx_ages - 1] *
63 p a t h _ l i a b i l i t i e s [ ’ qx ’ ][ idx_ages - 1] * capital +
64 l0 * p a t h _ l i a bi l i t i e s [ ’ px ’ ][ idx_ages ]* capital )
65 path_fund [ ’ fund ’ ]. append ( path_fund [ ’ fund ’ ][ -1] * (1 + i / 100) + path_fund [ ’ in ’ ][ -1] -
path_fund [ ’ out ’ ][ -1])
66
67 # QUESTION 4
68 ( pd . DataFrame ( p a t h _ l i a b i l i ti e s ) ) . to_excel ( excel_writer = ’ liabilities ’ + ’. xlsx ’ , sheet_name = ’
liabilities ’ ,
69 index = False , freeze_panes =(1 , 1) )
70
74 # QUESTION 5
75 df_l iabiliti es = pd . DataFrame ( p a t h _ l i a b i l i ti e s )
76 df_fund = pd . DataFrame ( path_fund )
77
78 # QUESTION 6
79 # lx
80 fig , axes = plt . subplots ()
81 barWidth = .1
82 br1 = np . arange ( len ( df_fund [ ’ lx ’ ]) )
83 plt . bar ( br1 , df_fund [ ’ lx ’] , edgecolor = ’ gray ’ , color = ’ goldenrod ’)
84 plt . title ( ’ Expected Insured Population ’)
85 plt . savefig ( ’ example6lx ’ + ’. eps ’ , format = ’ eps ’ , dpi =3600)
86 plt . show ()
87
88 # Premiums
89 fig , axes = plt . subplots ()
90 barWidth = .1
91 br1 = np . arange ( len ( df_fund [ ’ in ’ ]) )
92 plt . bar ( br1 , df_fund [ ’ in ’] , edgecolor = ’ gray ’ , color = ’ yellowgreen ’)
93 plt . title ( ’ Expected Collected Premiums ’)
94 plt . savefig ( ’ e x a m p l e 6 p r e m i u m s ’ + ’. eps ’ , format = ’ eps ’ , dpi =3600)
95 plt . show ()
96
97 # Claims
98 fig , axes = plt . subplots ()
99 barWidth = .1
100 br1 = np . arange ( len ( df_fund [ ’ out ’ ]) )
101 plt . bar ( br1 , df_fund [ ’ out ’] , edgecolor = ’ gray ’ , color = ’ teal ’)
102 plt . title ( ’ Expected Claims ’)
103 plt . savefig ( ’ ex ample6cl aims ’ + ’. eps ’ , format = ’ eps ’ , dpi =3600)
104 plt . show ()
105
106 # Fund
107 fig , axes = plt . subplots ()
108 barWidth = .1
109 br1 = np . arange ( len ( df_fund [ ’ fund ’ ]) )
102
110 plt . bar ( br1 , df_fund [ ’ fund ’] , edgecolor = ’ gray ’ , color = ’ silver ’)
111 plt . title ( ’ Expected Fund ’)
112 plt . savefig ( ’ example6fund ’ + ’. eps ’ , format = ’ eps ’ , dpi =3600)
113 plt . show ()
114
115 # QUESTION 7
116 fig , axes = plt . subplots ()
117 barWidth = .1
118 br1 = np . arange ( len ( df_fund [ ’ in ’ ]) )
119 br2 = [ x + barWidth for x in br1 ]
120 br3 = [ x + barWidth for x in br2 ]
121 plt . bar ( br3 , df_fund [ ’ fund ’] , label = ’ Fund ’ , edgecolor = ’ gray ’ , color = ’ silver ’)
122 plt . bar ( br2 , df_fund [ ’ out ’] , label = ’ Claims ’ , edgecolor = ’ gray ’ , color = ’ teal ’) # lightblue
123 plt . bar ( br1 , df_fund [ ’ in ’] , label = ’ Premium ’ , edgecolor = ’ gray ’ , color = ’ yellowgreen ’)
124 plt . legend ()
125 plt . savefig ( ’ example6all ’ + ’. eps ’ , format = ’ eps ’ , dpi =3600)
126 plt . show ()
800
4
600 3
400 2
200 1
0 0
0 5 10 15 20 25 0 5 10 15 20 25
8 8
6 6
4 4
2 2
0 0
0 5 10 15 20 25 0 5 10 15 20 25
103
1e7
Fund
Claims
8 Premium
0
0 5 10 15 20 25
1e7
Fund
7 Claims
Premium
6
0
0 5 10 15 20
104
9.5 Multiple Lifes Annuities and Insurance
Example 7
Marc and John, two business partners, both aged 50 years old, bought a life insurance with the following
conditions:
• Payment of 500 m.u., paid monthly, over the next 20 years, as long as one of them is alive. The terms of
the life annuity increase 2% each year.
• Upon the death of the second, if the event occurs in the following 20 years, payment of 1.000.000 m.u.
1. Obtain the level premium of the contract, considering that premiums are paid semi-annually, during 20
years, as long as both of them is alive.
2. Considering that each year, the group pays the risk premium for the following year, obtain the risk
premium of the contract, for each of the following 20 years and represent them graphically. Include the
leveled premium in the same plot.
5 x =50
6 y =50
7 n =20
8 i =2
9
10 # QUESTION 1
11 a12xy = l2h . naxy ( mtx = tv7377 , mty = tv7377 , x =x , y =y , n =n , i =i , g =2 , m =12 , status = ’ last - survivor ’)
12
13 Axy = l2h . nAxy_ ( mtx = tv7377 , mty = tv7377 , x =x , y =y , n =n , i =i , g =0 , status = ’ last - survivor ’)
14
15 aa2xy = l2h . naaxy ( mtx = tv7377 , mty = tv7377 , x =x , y =y , n =n , i =i , g =0 , m =2 , status = ’ joint - life ’)
16
24 # QUESTION 2
25 # Risk Premium
26 g =2
27 prem ium_annu al = [ l2h . naxy ( mtx = tv7377 , mty = tv7377 , x = x + a , y = y + a , n =1 , i =i , g =0 , m =12 ,
status = ’ last - survivor ’ , method = ’ udd ’) * 500 * 12 * (1+ g /100) ** a +
28 l2h . nAxy_ ( mtx = tv7377 , mty = tv7377 , x = x + a , y = y + a , n =1 , i =i , g =0 , status = ’ last - survivor ’ ,
method = ’ udd ’) * 1000000
29 for a in range ( n ) ]
30
105
31 # Plot
32 fig , axes = plt . subplots ()
33 ages = range (x , x + n )
34 plt . xticks ( ages )
35 plt . plot ( ages , premium_annual , ’ ro ’ , label = ’ Risk Premium ’)
36
8000
7500
premium
7000
6500
6000
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
ages
Solutions:
Question 1:
(2) (12)
P ä50:50:20 = 500 × 12 a50:50:20 + 1.000.000 Ā50:50:20
P = 3794.41 m.u.
Question 2:
(12)
Pk = 500 × 12 a50+k:50+k:1 + 1.000.000 Ā50+k:50+k:1 , k = 0, 1, . . . , 19
or
(12)
Pk = 500 × 12 a50+k:50+k:1 + 1.000.000 × (1 + i)−0.5 q50+k:50+k , k = 0, 1, . . . , 19
106