0% found this document useful (0 votes)
11 views

Python For Actuary

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Python For Actuary

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 106

Library lifeactuary

Pedro Corte Real & Gracinda Rita Guerreiro

June 17, 2023

Type: Python Package

Version: 1.3

Authors: Pedro Corte Real & Gracinda R. Guerreiro

Contact: [email protected] & [email protected]

License: MIT License

Repository: https://github.com/parcr/lifeactuary 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.

Additionally, in this version:

– 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

3 Some lifeactuary Functions and Syntax 14


3.1 Mortality Table data and Survival Probabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.2 Survival Probabilities for groups of two individuals . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.3 Life Annuities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.4 Life Insurances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.5 Life Annuities for groups of two lives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.5.1 Joint-Life Annuities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.5.2 Last-Survivor Annuities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.6 Life Insurance for groups of two lives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.6.1 Indemnities paid in the end of periods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.6.2 Indemnities paid in the “moment of death” . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.7 Financial Annuities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

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

5 Pricing Life Insurance 34


5.1 Pure Endowment / Deferred Capital / Expected Present Value / nEx . . . . . . . . . . . . . . . 34
5.2 Whole Life Insurance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.2.1 Ax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.2.2 Ax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.2.3 t Ax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
5.2.4 t Ax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
5.3 Term Life Insurance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
5.3.1 nAx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
5.3.2 nAx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.3.3 t nAx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.3.4 t nAx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.4 Endowment Insurance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.4.1 nAEx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.4.2 nAEx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.4.3 t nAEx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.4.4 t AEx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.5 Life Insurance with Capitals evolving in arithmetic progression . . . . . . . . . . . . . . . . . . . 42
5.5.1 IAx and IAx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
5.5.2 t IAx and t IAx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
5.5.3 nIAx and nIAx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
5.5.4 t nIAx and t nIAx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
5.5.5 t nIArx and t nIArx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.5.6 t nIAErx and nIAErx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

6 Multiple Lives Contracts 47


6.1 Survival Probability Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
6.1.1 npxy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
6.1.2 nqxy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
6.1.3 t nqxy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
6.1.4 exy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
6.1.5 Groups with more than two lives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
6.2 Multiple Lives Annuities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
6.2.1 axy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
6.2.2 aaxy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
6.2.3 t axy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
6.2.4 t aaxy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

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.

2.1 Class MortalityTable

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ω .

2.2 Importing Mortality Tables


The package includes a wide number of mortality tables and allows for the inclusion of any other mortality tables
extracted from the Society of Actuaries (SOA), in xml format, or by importing other ones in usual formats,
such as xlsx, csv, txt files.
For instance, in the manual, one of the tables that we will be using is the TV7377 in the xml format supported
by the Society of Actuaries.

2.2.1 Reading from lifeactuary Library

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

4 # reads TV7377 mortality table from SOA table


5 soa = rst . SoaTable ( ’ soa_tables / ’ + ’ TV7377 ’ + ’. xml ’)
6

7 # creates mortality table from qx of SOA table


8 tv7377 = mt . Mo rtalityT able ( data_type = ’q ’ , mt = soa . table_qx , perc =100 , last_q =1)

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

4 # reads manually imported mortality table


5 t ab le _m a nu al _q x = pd . read_excel ( ’ soa_tables / ’ + ’ tables_manual ’ + ’. xlsx ’ , sheet_name = ’ qx ’)
6 t ab le _m a nu al _l x = pd . read_excel ( ’ soa_tables / ’ + ’ tables_manual ’ + ’. xlsx ’ , sheet_name = ’ lx ’)
7

8 # creates mortality table from lx of a xlsx file


9 grf95 = mt . Mortalit yTable ( data_type = ’q ’ , mt = list ( t a bl e_ ma n ua l_ qx [ ’ GRF95 ’ ]) , perc =80)
10 grm95 = mt . Mortalit yTable ( data_type = ’l ’ , mt = list ( t a bl e_ ma n ua l_ lx [ ’ GRM95 ’ ]) , perc =80)

2.3 Demographic Functions


After the mortality table is instantiated (here denoted by mt), the common demographic functions are available
in the package, such as lx (expected number of subjects alive at age x), dx (expected number of deaths with age
x), qx (mortality rate at age x), ex (complete life expectancy at age x), ω (terminal age of the mortality table):

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

3 # Outputs the information necessary to clone the object


4 tv7377
5

6 # consults the lx of TV7377


7 tv7377 . lx
8

9 # Consults the ex of GRF95


10 grf95 . ex
11

12 # extracts all methods from the object grm95


13 grm95 . __dict__

2.4 Survival Probabilities Functions


The package also allows for the direct computation of survival probabilities for an aged x individual. Focusing
on the common actuarial probabilities, some functions are available for the computations of the following
probabilities: n qx , n px , t|n qx for integer and non-integer ages and periods. In fact, in this library, the non-
integer ages and periods are just a particular case when using any method.

10
2.4.1 nqx

Actuarial Notation: n qx

Usage
1 nqx (x , n =1 , method = ’ udd ’)

Description: Returns the probability of (x) dying before age x + n.

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

4 # probability that an aged 50.5 individual dies before age 53.


5 tv7377 . nqx (50.5 , 2.5 , method = ’ udd ’) # 0 . 0 1 0 3 2 1 7 9 7 1 8 7 5 0 9 8 0 7
6 tv7377 . nqx (50.5 , 2.5 , method = ’ cfm ’) # 0 . 0 1 0 3 2 0 0 3 8 1 5 1 2 8 6 9 0 3
7 tv7377 . nqx (50.5 , 2.5 , method = ’ bal ’) # 0 . 0 1 0 3 1 8 2 7 9 1 1 1 9 3 7 6 1 2

2.4.2 npx

Actuarial Notation: n px

Usage
1 npx (x , n =1 , method = ’ udd ’)

Description: Returns the probability of (x) surviving beyond age x + n.

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

4 # probability that an aged 80.5 individual reaches age 85.


5 tv7377 . npx (80.5 , 4.5 , method = ’ udd ’) # 0 . 3 5 1 2 0 3 2 8 7 0 4 6 1 8 1 4
6 tv7377 . npx (80.5 , 4.5 , method = ’ cfm ’) # 0 . 3 5 0 7 7 1 3 7 8 0 9 9 0 3 7 7
7 tv7377 . npx (80.5 , 4.5 , method = ’ bal ’) # 0 . 3 5 0 3 3 9 1 8 1 6 2 6 7 9 5 6 7

11
2.4.3 t nqx

Actuarial Notation: t|n qx

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

2.5 Life Expectancy Function


The library allows for the computation of Complete Life Expectancy for integer and non-integer ages and
periods.

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

2.6 Some Examples


1 # Consider a 65 years old individual . Using TV7377 mortality table and considering Constant
Force of Mortality approximation . :
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

20 dprob = [ tv7377 . nqx ( x = x +i , n =1 , method = ’ cfm ’) for i in n ]


21 ages = x + n
22 plt . stem ( ages , dprob , bottom =0.5)
23 plt . xlabel ( ’x ’)
24 plt . ylabel ( r ’ $q_ { x } $ ’)
25 plt . title ( ’ Mortality Rate ’)
26 plt . savefig ( ’ example26b ’ + ’. pdf ’ , format = ’ pdf ’ , dpi =3600)
27 plt . show ()

Survival Probability of (65) Mortality Rate


1.0
0.7
0.8 0.6

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 1: Actuarial Notation and Syntax Formula for Survival Probabilities

Notation Description Syntax


lx Expected number of living individuals aged x lx[x]
dx Expected number of deaths with age x dx[x]
qx Mortality rate at age x qx[x]
px Survival probability at age x px[x]
ex Life Expectancy at age x ex[x]
ω Limit age of mortality table w

3.2 Survival Probabilities for groups of two individuals

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 4: Actuarial Notation and Syntax Formula for Life Annuities


Notation Description Syntax
ax whole life annuity ax(mt, x, i, g=0, m=1, method)
äx whole life annuity due aax(mt, x, i, g=0, m=1, method)
t| ax t years deferred whole life annuity t ax(mt, x, i, g=0, m=1, defer=t, method)
t| äx t years deferred whole life annuity due t aax(mt, x, i, g=0, m=1, defer=t, method)
(m)
ax whole life annuity payable m times per year ax(mt, x, i, g=0, m=m, method)
(m)
äx whole life annuity due payable m times per year aax(mt, x, i, g=0, m=m, method)
(m)
t| ax t years deferred whole life annuity payable m times per t ax(mt, x, i, g=0, m=m, defer=t, method)
year
(m)
t| äx t years deferred whole life annuity due payable m times t aax(mt, x, i, g=0, m=m, defer=t, method)
per year
ax:n n year temporary life annuity nax(mt, x, n, i, g=0, m=1, method)
äx:n n year temporary life annuity due naax(mt, x, n, i, g=0, m=1, method)
t| ax:n t year deferred n year temporary life annuity t nax(mt, x, n, i, g=0, m=1, defer=t, method)
t| äx:n t year deferred n year temporary life annuity due t naax(mt, x, n, i, g=0, m=1, defer=t, method)
(m)
ax:n n year temporary life annuity payable m times per year nax(mt, x, n, i, g=0, m=m, method)
(m)
äx:n n year temporary life annuity due payable m times per naax(mt, x, n, i, g=0, m=m, method)
year
(m)
t| ax:n t year deferred n year temporary life annuity payable m t nax(mt, x, n, i, g=0, m=m, defer=t, method)
times per year
(m)
t| äx:n t year deferred n year temporary life annuity due payable t naax(mt, x, n, i, g=0, m=m, defer=t, method)
m times per year

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.

Important Remark - Commutation Symbols:


If the user intends to compute life annuities using commutation symbols, as in version 1.2, the correspondent
functions are resumed in section 7.

3.4 Life Insurances


The following table resumes the available function for life insurances. As usual in the actuarial notation, the
capital letters with bar refer to payments due in the “moment of death” and the absense of bar refers to
payments due in the end of the year in which the death occurs.

Table 6: Actuarial Notation and Syntax Formula for Life Insurances - fixed capitals

Notation Description Syntax


n Ex pure endowment nEx(mt, x, i, g=0, n, method)
Ax whole life insurance (end of the year) Ax(mt, x, i, g=0, method)
Āx whole life insurance (moment of death) Ax (mt, x, i, g=0, method)
t| Ax t years deferred whole life insurance (end of the year) t Ax(mt, x, defer=t, i, g=0, method)
t| Āx t years deferred whole life insurance (moment of death) t Ax (mt, x, defer=t, i, g=0, method)
A1x:n term life insurance (end of the year) nAx(mt, x, n, i, g=0, method)
Ā1x:n term life insurance (moment of death) nAx (mt, x, n, i, g=0, method)
1
t| Ax:n t years deferred term life insurance (end of the year) t nAx(mt, x, n, defer=t, i, g=0, method)
1
t| Āx:n t years deferred term life insurance (moment of death) t nAx (mt, x, n, defer=t, i, g=0, method)
Ax:n endowment insurance (end of the year) nAEx(mt, x, n, i, g=0, method)
Āx:n endowment insurance (moment of death) nAEx (mt, x, n, i, g=0, method)
t| Ax:n t-years deferred endowment insurance (end of the year) t nAEx(mt, x, n, defer=t, i, g=0, method)
t| Āx:n t-years deferred endowment insurance (moment of death) t nAEx (mt, x, n, defer=t, i, g=0, method)

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)

Notation Description Syntax


r
t| (IA)x:n t-years deferred term life insurance with capitals evolving t nIArx(mt, x, n, i, defer=t, first=1, inc=r, method)
arithmetically (increasing or decreasing). First capital 1
and increase amount r (end of the year)
r
t| (I Ā)x:n t-years deferred term life insurance with capitals evolving t nIArx (mt, x, n, i, defer=t, first=1, inc=r, method)
arithmetically (increasing or decreasing). First capital 1
and increase amount r (moment of death)

Table 8: Actuarial Notation and Syntax Formula for Life Insurances - variable capitals (First Capital=Increase
Amount)

Notation Description Syntax


(IA)x whole life insurance with arithmetically varying capitals IAx(mt, x, i, inc=1, method)
(end of the year)
(I Ā)x whole life insurance with arithmetically varying capitals IAx (mt, x, i, inc=1, method)
(moment of death)
t| (IA)x t years deferred whole life insurance with arithmetically t IAx(mt, x, defer=t, i, inc=1, method)
varying capitals (end of the year)
t| (I Ā)x t years deferred whole life insurance with arithmetically t IAx (mt, x, defer=t, i, inc=1, method)
varying capitals (moment of death)
(IA)1x:n term life insurance with arithmetically varying capitals nIAx(mt, x, n, i, inc=1, method)
(end of the year)
(I Ā)1x:n term life insurance with arithmetically varying capitals nIAx (mt, x, n, i, inc=1, method)
(end of the year)
1
t| (IA)x:n t-years deferred term life insurance with capitals evolving t nIArx(mt, x, n, defer=t, i, inc=1, method)
arithmetically (end of the year)
1
t| (I Ā)x:n t-years deferred term life insurance with capitals evolving t nIArx (mt, x, n, defer=t, i, inc=1, method)
arithmetically (end of the year)
(IA)x:n endowment life insurance with capitals evolving arith- nIAErx(mt, x, n, i, inc=1, method)
metically (end of the year)
(I Ā)x:n endowment life insurance with capitals evolving arith- nIAErx (mt, x, n, i, inc=1, method)
metically (moment of death)
t| (IA)x:n t-years deferred endowment life insurance with capitals t nIAErx(mt, x, n, defer=t, i, inc=1, method)
evolving arithmetically (end of the year)
t| (I Ā)x:n t-years deferred endowment life insurance with capitals t nIAErx (mt, x, n, defer=t, i, inc=1, method)
evolving arithmetically (moment of death)

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)

Notation Description Syntax


axy whole life annuity axy(mtx, mty, x, y, i, g=0, m=1, status=’joint-life’)
äxy whole life annuity due aaxy(mtx, mty, x, y, i, g=0, m=1, status=’joint-life’)
t| axy t years deferred whole life annu- t axy(mtx, mty, x, y, i, g=0, m=1, defer=t, status=’joint-life’)
ity
t| äxy t years deferred whole life annu- t aaxy(mtx, mty, x, y, i, g=0, m=1, defer=t, status=’joint-life’)
ity due
axy:n n years temporary life annuity naxy(mtx, mty, x, y, n, i, g=0, m=1, status=’joint-life’)
äxy:n n years temporary life annuity naaxy(mtx, mty, x, y, n, i, g=0, m=1, status=’joint-life’)
due
t| axy:n t years deferred temporary life t axy(mtx, mty, x, y, n, i, g=0, m=1, defer=t, status=’joint-life’)
annuity
t| äxy:n t years deferred temporary life t aaxy(mtx, mty, x, y, n, i, g=0, m=1, defer=t, status=’joint-life’)
annuity due

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)

Notation Description Syntax


(m)
axy whole life annuity payable m axy(mtx, mty, x, y, i, g=0, m, status=’joint-life’)
times per year
(m)
äxy whole life annuity due payable m aaxy(mtx, mty, x, y, i, g=0, m, status=’joint-life’)
times per year
(m)
t| axy t years deferred whole life annu- t axy(mtx, mty, x, y, i, g=0, m, defer=t, status=’joint-life’)
ity payable m times per year
(m)
t| äxy t years deferred whole life annu- t aaxy(mtx, mty, x, y, i, g=0, m, defer=t, status=’joint-life’)
ity due payable m times per year
(m)
axy:n n years temporary life annuity naxy(mtx, mty, x, y, n, i, g=0, m, status=’joint-life’)
payable m times per year
(m)
äxy:n n years temporary life annuity naaxy(mtx, mty, x, y, n, i, g=0, m, status=’joint-life’)
due payable m times per year
(m)
t| axy:n t years deferred temporary life t axy(mtx, mty, x, y, n, i, g=0, m, defer=t, status=’joint-life’)
annuity payable m times per year
(m)
t| äxy:n t years deferred temporary life t aaxy(mtx, mty, x, y, n, i, g=0, m, defer=t, status=’joint-life’)
annuity due payable m times per
year

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.

Notation Description Syntax


(m)
(Ga(m) )xy whole life annuity payable m times axy(mtx, mty, x, y, i, g, m, status=’joint-life’)
per year. Payments change in each
payment period.
(m)
(Gä(m) )xy whole life annuity due payable m aaxy(mtx, mty, x, y, i, g, m, status=’joint-life’)
times per year. Payments change
in each payment period.
(m) (m)
t| (Ga )xy t years deferred whole life annuity t axy(mtx, mty, x, y, i, g, m, defer=t, status=’joint-life’)
payable m times per year. Pay-
ments change in each payment pe-
riod.
(m) (m)
t| (Gä )xy t years deferred whole life annuity t aaxy(mtx, mty, x, y, i, g, m, defer=t, status=’joint-life’)
due payable m times per year. Pay-
ments change in each payment pe-
riod.
(m)
(Ga(m) )xy:n n years temporary life annuity naxy(mtx, mty, x, y, n, i, g, m, status=’joint-life’)
payable m times per year. Pay-
ments change in each payment pe-
riod.
(m)
(Gä(m) )xy:n n years temporary life annuity due naaxy(mtx, mty, x, y, n, i, g, m, status=’joint-life’)
payable m times per year. Pay-
ments change in each payment pe-
riod.
(m) (m)
t| (Ga )xy:n t years deferred temporary life an- t axy(mtx, mty, x, y, n, i, g, m, defer=t, status=’joint-life’)
nuity payable m times per year.
Payments change in each payment
period.
(m) (m)
t| (Gä )xy:n t years deferred temporary life an- t aaxy(mtx, mty, x, y, n, i, g, m, defer=t, status=’joint-life’)
nuity due payable m times per year.
Payments change in each payment
period.

Remark on non-integer ages, terms and deferment periods:


All functions of section 3.5 are prepared for computing annuities for non-integer ages, terms and deferment
periods. The usual approximations Uniform Distribution of Death, Constant Force of Mortality and Balducci
Aproximation are available. The user should include the choice of the method in the function signature. For
details, see Chapter 6.

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.

3.6 Life Insurance for groups of two lives


3.6.1 Indemnities paid in the end of periods

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)

Notation Description Syntax


n Exy pure endowment nExy(mtx, mty, x, y, i, n, status=’joint-life’)
Axy whole life insurance Axy(mtx, mty, x, y, i, g=0, m=1, status=’joint-life’)
t| Axy t years deferred whole life insurance t Axy(mtx, mty, x, y, i, g=0, m=1, defer=t, status=’joint-life’)
Axy:n n years term life insurance nAxy(mtx, mty, x, y, n, i, g=0, m=1, status=’joint-life’)
t| Axy:n t years deferred term life insurance t Axy(mtx, mty, x, y, n, i, g=0, m=1, defer=t, status=’joint-life’)

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)

Notation Description Syntax


(GA)xy whole life insurance Axy(mtx, mty, x, y, i, g, m=1, status=’joint-life’)
t| (GA)xy t years deferred whole life insurance t Axy(mtx, mty, x, y, i, g, m=1, defer=t, status=’joint-life’)
(GA)xy:n n years term life insurance nAxy(mtx, mty, x, y, n, i, g, m=1, status=’joint-life’)
t| (GA)xy:n t years deferred term life insurance t Axy(mtx, mty, x, y, n, i, g, m=1, defer=t, status=’joint-life’)

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)

Notation Description Syntax


(IA)xy whole life insurance t nIArxy(mtx, mty, x, y, n=ω-x, defer=0, first payment=1, inc=1,
status=’joint-life’)
t| (IA)xy t years deferred whole t nIArxy(mtx, mty, x, y, n=ω-(x+t), defer=t, first payment=1, inc=1,
life insurance status=’joint-life’)
(IA)xy:n n years term life insur- t nIArxy(mtx, mty, x, y, n, defer=0, first payment=1, inc=1, status=’joint-
ance life’)
t| (IA)xy:n t years deferred term life t nIArxy(mtx, mty, x, y, n, defer=t, first payment=1, inc=1, status=’joint-
insurance life’)

3.6.2 Indemnities paid in the “moment of death”

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

Notation Description Syntax


an n-year immediate financial annuity an(terms=n)
än n-year due financial annuity aan(terms=n)
a∞ perpetual immediate financial annuity a(terms=None)
ä∞ perpetual due financial annuity aa(terms=None)
(m)
r (Ia)n n-year immediate financial annuity with first payment Ian(terms=n, payment=1, increase=r)
1 and evolving arithmetically (increasing [r > 0] or de-
creasing [r < 0]). Payment increases in each period of
the interest rate.
(m)
r (Iä)n n-year due financial annuity with first payment 1 and Iaan(terms=n, payment=1, increase=r)
evolving arithmetically (increasing [r > 0] or decreasing
[r < 0]). Payment increases in each period of the interest
rate.
(m) (m)
r (I a)n n-year immediate financial annuity with first payment Iman(terms=n, payment=1, increase=r)
1 and evolving arithmetically (increasing [r > 0] or de-
creasing [r < 0]). Payments increase in each payment
period.
(m) (m)
r (I ä)n n-year due financial annuity with first payment 1 and Imaan(terms=n, payment=1, increase=r)
evolving arithmetically (increasing [r > 0] or decreasing
[r < 0]). Payments increase in each payment period.
(m)
g (Ga)n n-year immediate financial annuity with first payment 1 Gan(terms=n, payment=1, grow=g)
and evolving geometrically with rate g. Payments change
in each period of the interest rate.
(m)
g (Gä)n n-year due financial annuity with first payment 1 and Gaan(terms=n, payment=1, grow=g)
evolving geometrically with rate g. Payments change in
each period of the interest rate.
(m) (m)
g (G a)n n-year immediate financial annuity with first payment 1 Gman(terms=n, payment=1, grow=g)
and evolving geometrically with rate g. Payments change
in each payment period.
(m) (m)
g (G ä)n n-year due financial annuity with first payment 1 and Gmaan(terms=n, payment=1, grow=g)
evolving geometrically with rate g. Payments change in
each payment period.

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

5 # reads soa table TV7377


6 soa = rst . SoaTable ( ’ soa_tables / ’ + ’ TV7377 ’ + ’. xml ’)
7

8 # creates a mortality table


9 tv7377 = mt . Mo rtalityT able ( data_type = ’q ’ , mt = soa . table_qx , perc =100 , last_q =1)

4.1 Whole Life Annuities

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 la . ax ( mt = tv7377 , x =50.5 , i =2 , g =0 , m =1 , method = ’ udd ’) # 2 1 . 3 1 1 9 6 5 0 4 2 4 2 3 2 6


5 la . ax ( mt = tv7377 , x =50.5 , i =2 , g =0 , m =1 , method = ’ cfm ’) # 2 1 . 3 0 5 2 8 8 8 1 3 1 2 9 3 9
6 la . ax ( mt = tv7377 , x =50.5 , i =2 , g =0 , m =1 , method = ’ bal ’) # 2 1 . 2 9 8 6 7 4 1 0 8 3 0 8 1 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

4 la . aax ( mt = tv7377 , x =50.5 , i =2 , g =0 , m =1 , method = ’ udd ’) # 22.31196504242326


5 la . aax ( mt = tv7377 , x =50.5 , i =2 , g =0 , m =1 , method = ’ cfm ’) # 22.30528881312939
6 la . aax ( mt = tv7377 , x =50.5 , i =2 , g =0 , m =1 , method = ’ bal ’) # 22.298674108308134

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.

Observation: t ax(mt, x, i, g, m, defer=0, method) = ax(mt, x, i, g, m, method)

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 la . t_ax ( mt = tv7377 , x =50.5 , i =2 , g =0 , m =1 , defer =5 , method = ’ udd ’) # 1 6 . 6 5 9 0 8 5 8 5 9 9 1 4 19


5 la . t_ax ( mt = tv7377 , x =50.5 , i =3 , g =0 , m =1 , defer =5 , method = ’ udd ’) # 14.021600722805644
6 la . t_ax ( mt = tv7377 , x =50.5 , i =2 , g =1 , m =1 , defer =5 , method = ’ udd ’) # 18.855665526541156

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

4 la . t_aax ( mt = tv7377 , x =50.5 , i =2 , g =0 , m =1 , defer =5 , method = ’ udd ’) # 1 7 . 5 4 4 1 0 7 5 5 2 8 9 5 8 1 3


5 la . t_aax ( mt = tv7377 , x =50.5 , i =3 , g =0 , m =1 , defer =5 , method = ’ udd ’) # 1 4 . 8 6 4 4 8 6 3 5 5 5 4 6 6 3 2
6 la . t_aax ( mt = tv7377 , x =50.5 , i =2 , g =1 , m =1 , defer =5 , method = ’ udd ’) # 1 9 . 9 2 9 2 4 3 8 7 4 7 8 8 1 9 5

4.2 Temporary Life Annuities


4.2.1 nax

(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.

Observation: t nax(mt, x, n, i, g, m, defer=0, method) = nax(mt, x, n, i, g, m, method)

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.

Observation: t naax(mt, x, n, i, g, m, defer=0, method) = naax(mt, x, n, i, g, m, method)

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 Life Annuities with variable terms


In this section, are presented functions that compute the actuarial present value of life annuities whose payments
are not constant overtime.
As special regularities, life annuities with terms evolving in arithmetic or geometric progression (increasing or
decreasing) are well known and easily computed and this library presents easy to use solutions and functions.
As a more general case, see section 4.3.6, the library also allows for the computation of the actuarial present value
for a given set of cash-flows, interest rates and survival probabilities, which can vary without any regularity.
The set of parameters should be provided in vector formats.

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.

Observation: nIax(mt, x, n, i, m, first amount=1, increase amount=0, method) = nax(mt, x, n, i, m,


first amount=1, increase amount=0, method)

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.

Observation: nIaax(mt, x, n, i, m, first amount=1, increase amount=0, method) = naax(mt, x, n, i, m,


first amount=1, increase amount=0, method)

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.

Observation: t nIax(mt, x, n, i, m, defer, first amount=1, increase amount=0, method) = t nax(mt, x, n, i,


m, defer, method)

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.

Observation: t nIaax(mt, x, n, i, m, defer, first amount=1, increase amount=0, method) = t naax(mt, x, n,


i, m, defer, method)

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

4.3.5 Geometric Life Annuities

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.

4.3.6 Present Value Function

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

6 # reads soa table TV7377


7 soa = rst . SoaTable ( ’ soa_tables / ’ + ’ TV7377 ’ + ’. xml ’)
8

9 # creates a mortality table


10 tv7377 = mt . Mo rtalityT able ( data_type = ’q ’ , mt = soa . table_qx , perc =100 , last_q =1)

5.1 Pure Endowment / Deferred Capital / Expected Present Value / nEx

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

Actuarial Notation: Āx

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.

Observation: t Ax(mt, x, defer=0, i, g, method) = Ax(mt, x, i, g, method)

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

Actuarial Notation: t| Āx

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.

Observation: t Ax (mt, x, defer=0, i, g, method) = Ax (x, x, i, g, method)

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 Term Life Insurance

5.3.1 nAx

Actuarial Notation: A1x:n

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

Actuarial Notation: Ā1x:n

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.

Observation: t nAx(mt, x, n, defer=0, i, g, method) = nAx(mt, x, n, i, g, method)

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.

Observation: t nAx (mt, x, n, defer=0, i, g, method) = nAx (mt, x, n, i, g, method)

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 Endowment Insurance

5.4.1 nAEx

Actuarial Notation: Ax:n

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

Actuarial Notation: Āx:n

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

4 lins . nAEx_ ( mt = tv7377 , x =50.25 , n =10.75 , i =2 , g =12 , method = ’ udd ’) # 0 . 8 5 5 2 8 4 6 7 7 2 1 3 5 8 2 6


5 lins . nAEx_ ( mt = tv7377 , x =50.25 , n =10.75 , i =2 , g =12 , method = ’ cfm ’) # 0 . 8 5 5 2 9 0 9 1 6 3 2 0 4 7 2 5
6 lins . nAEx_ ( mt = tv7377 , x =50.25 , n =10.75 , i =2 , g =12 , method = ’ bal ’) # 0 . 8 5 5 2 9 7 1 4 7 3 7 7 7 9 9 3

40
5.4.3 t nAEx

Actuarial Notation: t| Ax:n

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

Actuarial Notation: t| Āx:n

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

5.5 Life Insurance with Capitals evolving in arithmetic progression

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.

5.5.1 IAx and IAx

Actuarial Notation: (IA)x and (I Ā)x

Usage
1 IAx ( mt , x , i = None , inc =1 , method = ’ udd ’) # end of the year
2

3 IAx_ ( mt , x , i = None , inc =1 , 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 + 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

4 lins . IAx ( mt = tv7377 , x =50 , i =2 , inc =10) # 158.0743156200335


5 lins . IAx ( mt = tv7377 , x =50 , i =2 , inc =0) # 0 ( first capital = increment = 0)

42
5.5.2 t IAx and t IAx

Actuarial Notation: t| (IA)x and t| (I Ā)x

Usage
1 t_IAx ( mt , x , defer =0 , i = None , inc =1 , method = ’ udd ’) # end of the year
2

3 t_IAx_ ( mt , x , defer =0 , i = None , inc =1 , method = ’ udd ’) # moment of death

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

5.5.3 nIAx and nIAx

Actuarial Notation: (IA)x:n and (I Ā)x:n

Usage
1 nIAx ( mt , x , n , i = None , inc =1 , method = ’ udd ’) # end of the year
2

3 nIAx_ ( mt , x , n , i = None , inc =1 , method = ’ udd ’) # moment of death

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

4 lins . nIAx ( mt = tv7377 , x =50 , n =10 , i =2 , inc =10) # 2.7518555201525583

5.5.4 t nIAx and t nIAx

Actuarial Notation: t| (IA)x:n and t| (I Ā)x:n

Usage
1 t_nIAx ( mt , x , n , defer =0 , i = None , inc =1 , method = ’ udd ’) # end of the year
2

3 t_nIAx_ ( mt , x , n , defer =0 , i = None , inc =1 , method = ’ udd ’) # moment of death

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

3 t_nIArx_ ( mt , x , n , defer =0 , i = None , first_amount =1 , inc =1 , method = ’ udd ’) # moment of death

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

12 lins . t_nIArx_ ( mt = tv7377 , x =50 , n =10 , defer =0 , i =2 , first_amount =1 , inc =1)


13 # 0.27792378415439706
14 lins . t_nIArx_ ( mt = tv7377 , x =50 , n =10 , defer =0 , i =2 , first_amount =1000 , inc =50)
15 # 58.765530395538704
16 lins . t_nIArx_ ( mt = tv7377 , x =50 , n =10 , defer =10 , i =2 , first_amount =1000 , inc =50)
17 # 102.10863259378893
18 lins . t_nIArx_ ( mt = tv7377 , x =50 , n =10 , defer =0 , i =2 , first_amount =1000 , inc = -50)
19 # 35.696240526185186
20 lins . t_nIArx_ ( mt = tv7377 , x =50 , n =10 , defer =10 , i =2 , first_amount =1000 , inc = -50)
21 # 60.865289979325354

45
Observations:

• t nIArx(mt, x, n, i, defer=0, first=1, amount=1, inc=1, method) = nIAx(mt, x, n, i, method)

• t nIArx (mt, x, n, i, defer=0, first=1, amount=1, inc=1, method) = nIAx (mt, x, n, i, method)

5.5.6 t nIAErx and nIAErx

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

3 t_nIAErx_ ( mt , x , n , defer =0 , i = None , first_amount =1 , inc =1 , method = ’ udd ’) # moment of death

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

8 lins . t_nIAErx_ ( mt = tv7377 , x =50 , n =10 , defer =5 , i =2 , first_amount =1 , inc =1)


9 # 7.072355164462292
10 lins . t_nIAErx_ ( mt = tv7377 , x =50 , n =10 , defer =5 , i =2 , first_amount =1000 , inc =50)
11 # 1048.8296786409842
12 lins . t_nIAErx_ ( mt = tv7377 , x =50 , n =10 , defer =5 , i =2 , first_amount =1000 , inc = -50)
13 # 414.7743643440044

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.

6.1 Survival Probability Functions


The package includes functions that allow for the computation of the standard probabilities n pxy , n pxy , n qxy ,
n qxy , t|n qxy , t|n qxy for both integer and non-integer ages, as well as life expectancy of the groups, represented
by exy and exy .
These new functions create a flexible framework for computing standard probabilities and actuarial expected
present values of common contracts, allowing for dependence between lives. Moreover, mortality tables may be
different for individuals (x) and (y).

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

5 soa_TV7377 = rst . SoaTable ( ’ ../ soa_tables / TV7377 . xml ’)


6 soa_GRF95 = rst . SoaTable ( ’ ../ soa_tables / GRF95 . xml ’)
7 grf95 = mt . Mortalit yTable ( mt = soa_GRF95 . table_qx )
8 tv7377 = mt . Mo rtalityT able ( mt = soa_TV7377 . table_qx )

6.1.1 npxy

Actuarial Notation: n pxy and n pxy

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

Actuarial Notation: n qxy and n qxy

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

Actuarial Notation: t|n qxy and t|n qxy

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

Some more Examples


1 # # Considering two individuals of ages x =35 and y =39:
2 # probability of at least one of the individuals to die in the folowing 6 years
3 l2h . nqxy ( mtx = grf95 , mty = tv7377 , x =35 , y =39 , n =6 , status = ’ joint - life ’) # 0 .0 16 75 3 16 55 99 8
4

5 # probability that both individuals are dead in the next 10 years


6 l2h . nqxy ( mtx = grf95 , mty = tv7377 , x =35 , y =39 , n =10 , status = ’ last - survivor ’) # 0.000 23605857 5
7

8 # probability of both individuals being alive 3 years from now


9 l2h . npxy ( mtx = grf95 , mty = tv7377 , x =35 , y =39 , n =3 , status = ’ joint - life ’) # 0 . 9 9 2 5 7 4 8 1 6 8 5 6 0 5 7 6
10

11 # probability that , at least one of them is alive 20 years from now


12 l2h . npxy ( mtx = grf95 , mty = tv7377 , x =35 , y =39 , n =20 , status = ’ last - survivor ’) # 0 . 9 9 8 0 6 5 72 9 6 2 6 6 3 3

6.1.4 exy

Actuarial Notation: exy and 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

6.1.5 Groups with more than two lives

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

n pxy + n pxz + n pyz − 2 n pxyz =


= n pxy + n pxz + n pyz − 2 n px · n py · n pz

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

5 px = grf95 . npx (x , 10)


6 py = tv7377 . npx (y , 10)
7 pz = tv7377 . npx (z , 10)
8 pxy = l2h . npxy ( mtx = grf95 , mty = tv7377 , x =x , y =y , n =10 , status = ’ joint - life ’)
9 pxz = l2h . npxy ( mtx = grf95 , mty = tv7377 , x =x , y =z , n =10 , status = ’ joint - life ’)
10 pyz = l2h . npxy ( mtx = tv7377 , mty = tv7377 , x =y , y =z , n =10 , status = ’ joint - life ’)
11

12 p ro b_ su r v_ gr ou p = pxy + pxz + pyz - 2 * px * py * pz


13 print ( f ’ probability : { p ro b_ s ur v_ gr o up } ’)
14 # 0.9979281371806732

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:

n pxy + n pxz + n pyz − 3 n pxyz =


= n pxy + n pxz + n pyz − 3 n px · n py · n pz

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

11 p r o b _ s u r v _ g r o u p2 = pxy + pxz + pyz - 3 * px * py * pz


12 print ( f ’ probability : { p r o b _ s u r v _ g r o u p 2 } ’)
13 # 0.0834682538323328

6.2 Multiple Lives Annuities


In this section, we present the functions that allow for the computation of most common annuities for groups of
two lives: Joint life annuities, Last Survivor annuities and Reversionary annuities. All functions are generically
developed for whole life, temporary terms, deferment periods, fractional payments, geometric growth and non-
integer ages.
All annuities are developed for both joint life (annuity paid while both (x) ad (y) are still alive) and last
survivor (annuity paid while atr least one of (x) and (y) are still alive).

6.2.1 axy

(m) (m) (m) (m)


Actuarial Notation: axy , axy , axy , axy , (Ga(m) )xy and (Ga(m) )xy

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

7 # Whole life unitary , immediate annuity , paid semi - annually


8 l2h . axy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , i =2 , g =0 , m =2 , status = ’ joint - life ’)
9 # 2 .4 3 80 42 30 2 96 43
10 l2h . axy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , i =2 , g =0 , m =2 , status = ’ last - survivor ’)
11 # 7 .0 7 91 92 34 2 61 66
12

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

(m) (m) (m) (m)


Actuarial Notation: äxy , äxy , äxy , äxy , (Gä(m) )xy and (Gä(m) )xy

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

7 # Whole life unitary , immediate annuity , paid semi - annually


8 l2h . aaxy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , i =2 , g =0 , m =2 , status = ’ joint - life ’)
9 # 2 .9 3 80 42 30 2 96 43
10 l2h . aaxy ( mtx = tv7377 , mty = grf95 , x =90 , y =95 , i =2 , g =0 , m =2 , status = ’ last - survivor ’)
11 # 7 .5 7 91 92 34 2 61 66
12

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

(m) (m) (m) (m) (m)


Actuarial Notation: t| axy , t| axy , t| axy , t| axy , t| (Ga )xy and t| (Ga(m) )xy

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

(m) (m) (m) (m) (m)


Actuarial Notation: t| äxy , t| äxy , t| äxy , t| äxy , t| (Gä )xy and t| (Gä(m) )xy

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

(m) (m) (m) (m)


Actuarial Notation: axy:n , axy:n , axy:n , axy:n , (Ga(m) )xy:n and (Ga(m) )xy:n

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

(m) (m) (m) (m)


Actuarial Notation: äxy:n , äxy:n , äxy:n , äxy:n , (Gä(m) )xy:n and (Gä(m) )xy:n

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

(m) (m) (m) (m) (m)


Actuarial Notation: t| axy:n , t| axy:n , t| axy:n , t| axy:n , t| (Ga )xy:n and t| (Ga(m) )xy:n

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

(m) (m) (m) (m) (m)


Actuarial Notation: t| äxy:n , t| äxy:n , t| äxy:n , t| äxy:n , t| (Gä )xy:n and t| (Gä(m) )xy:n

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

6.3 Multiple Lives Insurance


In this section we present the classical Expected Values of Life Insurance benefits, for products whose benefits
depend on the death and/or survival of two individuals aged (x) and (y). As in the previous section, we consider
the two common approaches: joint-life (x, y) and last survivor (x, y).
Functions are developed for payments at the end of the period of the death or at “the moment of death” (in
average, in the middle of the period). Using the fractional commutation tables, the life insurance contracts can
be evaluated with the intended fractional time.
(m)
As commonly in the actuarial notation, we use Axy for benefits paid in the end of the year, Axy for payments
in the end of the m-th period of the year and Āxy for benefits paid in the “moment of death” (in average, in
the middle of the year).
Once again, all functions are available for non-integer ages, and the user may choose between three approximation
methods: Uniform Distribution of Death, Constant Force of Mortality and Balducci Approximation.
In each subsection, when applicable, we present both functions when considering payments in the end of the
year of in the “moment of death” (approximated by the middle of the year).

58
6.3.1 Pure Endowment/ Deferred Capital/ Expected Present Value / nExy

Actuarial Notation: n Exy and n Exy

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

Some Other Examples


1 # Actuarial Expected Present Value of 50.000 m . u . paid to a group with two lives ( x ) =40 and
( y ) =50 , after 15 years
2

3 # Joint Life Group


4 50000* l2h . nExy ( mtx = grf95 , mty = tv7377 , x =40 , y =50 , i =2 , n =15 , status = ’ joint - life ’)
5 # 32809.08 m . u .
6

7 # Last Survivor Group


8 50000* l2h . nExy ( mtx = grf95 , mty = tv7377 , x =40 , y =50 , i =2 , n =15 , status = ’ last - survivor ’)
9 # 37068.79 m . u .

59
6.3.2 Axy and Axy

(m) (m) (m) (m)


Actuarial Notation: Axy , Axy , (GA)xy , (GA)xy and Āxy , Āxy , (GĀ)xy , (GĀ)xy

(m) (m) (m) (m)


Axy , Axy , (GA)xy , (GA)xy and Āxy , Āxy , (GĀ)xy , (GĀ)xy

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

(m) (m) (m) (m)


Actuarial Notation: t Axy , t Axy , t (GA)xy , t (GA)xy and t Āxy , t Āxy , t (GĀ)xy , t (GĀ)xy

(m) (m) (m) (m)


t Axy , t Axy , t (GA)xy , t (GA)xy and t Āxy , t Āxy , t (GĀ)xy , t (GĀ)xy

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

1(m) 1(m) 1(m) 1(m)


Actuarial Notation: A1xy:n , Axy:n , (GA)1xy:n , (GA)xy:n and Ā1xy:n , Āxy:n , (GĀ)1xy:n , (GĀ)xy:n

1 1(m) 1(m) 1(m) 1(m)


Axy:n , Axy:n , (GA)1xy:n , (GA)xy:n and Ā1xy:n , Āxy:n , (GĀ)1xy:n , (GĀ)xy:n

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

1 1(m) 1 1(m) 1(m) 1(m)


Actuarial Notation: t| Axy:n , t| Axy:n , t| (GA)xy:n , t| (GA)xy:n and t| Ā1xy:n , t| Āxy:n , t| (GĀ)1xy:n , t| (GĀ)xy:n

1 1(m) 1 1(m) 1(m) 1(m)


t| Axy:n , t| Axy:n , t| (GA)xy:n , t| (GA)xy:n and t| Ā1xy:n , t| Āxy:n , t| (GĀ)xy:n
1
, t| (GĀ)xy:n

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

(m) (m) (m) (m)


Actuarial Notation: Axy:n , Axy:n , (GA)xy:n , (GA)xy:n and Āxy:n , Āxy:n , (GĀ)xy:n , (GĀ)xy:n

(m) (m) (m) (m)


Axy:n , Axy:n , (GA)xy:n , (GA)xy:n and Āxy:n , Āxy:n , (GĀ)xy:n , (GĀ)xy:n

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

(m) (m) (m) (m)


Actuarial Notation: t| Axy:n , t| Axy:n , t| (GA)xy:n , t| (GA)xy:n and t| Āxy:n , t| Āxy:n , t| (GĀ)xy:n , t| (GĀ)xy:n

(m) (m) (m) (m)


t| Axy:n , t| Axy:n , t| (GA)xy:n , t| (GA)xy:n and t| Āxy:n , t| Āxy:n , t| (GĀ)xy:n , t| (GĀ)xy:n

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.

7.1 Class CommutationTable

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

4 # reads soa table TV7377


5 soa = rst . SoaTable ( ’ soa_tables / ’ + ’ TV7377 ’ + ’. xml ’)
6

7 # reads Excel file with mortality tables


8 t ab le _m a nu al _q x = pd . read_excel ( ’ soa_tables / ’ + ’ tables_manual ’ + ’. xlsx ’ , sheet_name = ’ qx ’)
9 t ab le _m a nu al _l x = pd . read_excel ( ’ soa_tables / ’ + ’ tables_manual ’ + ’. xlsx ’ , sheet_name = ’ lx ’)

68
10

11 # creates an Actuarial Table from qx of SOA table


12 tv7377_ct = ct . C o m m u t a t i o n F u n c t i o n s ( i =2 , g =0 , data_type = ’q ’ , mt = soa . table_qx , perc =100 ,
app_cont = False )
13

14 # creates an Actuarial Table from qx of GRF95 available in the Excel file


15 grf95_ct = ct . C o m m u t a t i o n F u n c t i o n s ( i =1.5 , g =0 , data_type = ’q ’ , mt = list ( ta bl e _m an ua l _q x [ ’ GRF95 ’
]) , perc =100 , app_cont = False )
16

17 # creates an Actuarial Table from lx of GRM95 available in the Excel file


18 grm95_ct = ct . C o m m u t a t i o n F u n c t i o n s ( i =1.5 , g =0 , data_type = ’l ’ , mt = list ( ta bl e _m an ua l _l x [ ’ GRM95 ’
]) , perc =100 , app_cont = False )

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.

7.2 Class CommutationTableFrac

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.

7.2.1 Function age to index()

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

7.3.2 Dx and Dx frac


Actuarial Notation Dx
Usage ct.Dx[x]
Args x: age as an integer
Example tv7377 ct.Dx[50]
Result 34944.42647196618

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

7.3.3 Nx and Nx frac


Actuarial Notation Nx
Usage ct.Nx[x]
Args x: age as an integer
Example tv7377 ct.Nx[50]
Result 788151.7176774722

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

7.3.4 Sx and Sx frac


Actuarial Notation Sx
Usage ct.Sx[x]
Args x: age as an integer
Example tv7377 ct.Sx[50]
Result 12024274.4751688

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.

7.3.5 Cx and Cx frac


Actuarial Notation Cx or C x
Usage ct.Cx[x]
Args x: age as an integer number
Example tv7377 ct.Cx[50]
Result 128.94202849786421

7.3.6 Mx and Mx frac


Actuarial Notation Mx or M x
Usage ct.Mx[x]
Args x: age as an integer number
Example tv7377 ct.Mx[50]
Result 19490.471223388264

7.3.7 Rx and Rx frac


Actuarial Notation Rx or Rx
Usage ct.Rx[x]
Args x: age as an integer number
Example tv7377 ct.Rx[50]
Result 552381.6299290637

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

7.4 Life Annuities using Commutation Tables


Considering a Commutation Table ct, the following life annuities are defined as methods and the syntax for
each type is described in Tables 16 (constant term life annuities) and 17 (increasing/decreasing life annuities).

Table 16: Actuarial Notation and Syntax Formula for Life Annuities in Commutation Tables

Notation Description Syntax


ax whole life annuity ax(x,1)
äx whole life annuity due aax(x,1)
t| ax t years deferred whole life annuity t ax(x,1,t)
t| äx t years deferred whole life annuity due t aax(x,1,t)
(m)
ax whole life annuity payable m times per year ax(x,m)
(m)
äx whole life annuity due payable m times per year aax(x,m)
(m)
t| ax t years deferred whole life annuity payable m times per year t ax(x,m,t)
(m)
t| äx t years deferred whole life annuity due payable m times per year t aax(x,m,t)
ax:n n year temporary life annuity nax(x,n,1)
äx:n n year temporary life annuity due naax(x,n,1)
t| ax:n t year deferred n year temporary life annuity t nax(x,n,1,t)
t| äx:n t year deferred n year temporary life annuity due t naax(x,n,1,t)
(m)
ax:n n year temporary life annuity payable m times per year nax(x,n,m)
(m)
äx:n n year temporary life annuity due payable m times per year naax(x,n,m)
(m)
t| ax:n t year deferred n year temporary life annuity payable m times per year t nax(x,n,m,t)
(m)
t| äx:n t year deferred n year temporary life annuity due payable m times per year t naax(x,n,m,t)

74
Table 17: Actuarial Notation and Syntax for Increasing/Decreasing Life Annuities in Commutation Tables

Notation Description Syntax


(m)r
t| (Ia)x:n t-years deferred n-year temporary increasing life annuity, payable m t nIax(x,n,m,t,C,r)
times per year. First payment C and increasing/decreasing amount r
(m)r
t| (Iä)x:n t-years deferred n-year temporary increasing life annuity, payable m t nIaax(x,n,m,t,C,r)
times per year. First payment C and increasing/decreasing amount r

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.

Constant Term Whole Life Annuities


1 # Immediate Life Annuities
2 tv7377_ct . ax ( x =50 , m =1) # 2 1 . 5 5 4 4 3 2 7 7 3 7 0 0 2 3 5
3 tv7377_ct . ax ( x =50 , m =4) # 2 1 . 9 2 9 4 3 2 7 7 3 7 0 0 2 3 5
4

5 # Due Life Annuities


6 tv7377_ct . aax ( x =50 , m =1) # 22.55443277370024
7 tv7377_ct . aax ( x =50 , m =4) # 22.17943277370024
8

9 # Deferred Life Annuities


10 tv7377_ct . t_ax ( x =50 , m =1 , defer =5) # 1 6 . 8 9 9 1 9 6 5 9 1 7 6 8 2 5 2
11 tv7377_ct . t_ax ( x =50 , m =14 , defer =5) # 1 7 . 2 3 1 3 7 4 2 0 4 0 7 5 4 3 3
12

13 tv7377_ct . t_aax ( x =50 , m =1 , defer =5) # 17.78500355792074


14 tv7377_ct . t_aax ( x =50 , m =4 , defer =5) # 17.45282594561355

Remarks:

- ct.t ax(x, m, defer=0) = ct.ax(x, m)

- ct.t aax(x, m, defer=0) = ct.aax(x, m)

Constant Term Temporary Life Annuities


1 # Immediate Life Annuities
2 tv7377_ct . nax ( x =50 , n =10 , m =1) # 8.756215803256639
3 tv7377_ct . nax ( x =50 , n =10 , m =4) # 8.839775242816884
4

5 # Due Life Annuities


6 tv7377_ct . naax ( x =50 , n =10 , m =1) # 8.979040975417291
7 tv7377_ct . naax ( x =50 , n =10 , m =4) # 8.895481535857046
8

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

13 tv7377_ct . t_naax ( x =50 , n =10 , m =1 , defer =5) # 7.8845054782066715


14 tv7377_ct . t_naax ( x =50 , n =10 , m =4 , defer =5) # 7.804175424552608

Remarks:

- ct.t nax(x, m, defer=0) = ct.nax(x, m)

- ct.t naax(x, m, defer=0) = ct.naax(x, m)

Life Annuities with Variable Terms - Increasing/Decreasing in Arithmetic Progression


1 # Immediate
2 tv7377_ct . t_nIax ( x =50 , n =10 , m =1 , defer =0 , first_amount =1 , i nc re a se _a mo u nt =1) # 46.33017
3 tv7377_ct . t_nIax ( x =50 , n =10 , m =1 , defer =0 , first_amount =1 , i nc re a se _a mo u nt =5) # 196.62599
4 tv7377_ct . t_nIax ( x =50 , n =10 , m =1 , defer =0 , first_amount =100 , in cr ea s e_ am ou n t = -5) # 687.75180
5

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:

- ct.t nIax(x, n, m, defer, 1, increase amount=0) = ct.t nax(x, n, m, defer)

- ct.t nIaax(x, n, m, defer, 1, increase amount=0) = ct.t naax(x, n, m, defer)

Geometric Life Annuities


1 from lifeactuary import c o m m u t a t i o n _ t a b l e as ct
2

3 # reads SOA table


4 soa = rst . SoaTable ( ’/ soa_tables / ’ + ’ TV7377 ’ + ’. xml ’)
5

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

10 # 2 - Payments are certain


11 pv2 = tv7377_ct . present_value ( probs =1 , age = None ,
12 spot_rates =[1.2 , 1.4 , 1.8 , 1.6 , 1.9] , capital =[100 , -25 , 120 , 300 , -50])
13 print ( ’ Present Value : ’ , pv2 )
14 # 4 2 5 . 75 0 7 0 1 2 3 3 0 3 4
15

16 # 3 - Survival Probabilities are updated


17 x = 50
18 survprobs = [1 -1.5* tv7377_ct . qx [ x ] , 1 -1.55* tv7377_ct . qx [ x + 1] , 1 -1.6* tv7377_ct . qx [ x + 2] ,
1 -1.65* tv7377_ct . qx [ x + 3] , 1 -1.7* tv7377_ct . qx [ x + 4]]
19 print ( ’ SurvProbs : ’ , survprobs )
20 # [0.9943544272 , 0.993714114965 , 0.99293628512 , 0.992097190855 , 0. 9912118 0988]
21

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 Life Insurance using Commutation Tables


Tables 18 and 19 resumes the available methods for evaluating life insurance, from a CommutationTable class.
As usual in the actuarial notation, the capital letters with bar refer to payments due in the “moment of death”
and the absense of bar refers to payments due in the end of the year in which the death occurs.
For life insurance 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 18 are applied.

7.5.1 Examples

In this section, examples on the use of methods for pricing life insurance, available in the CommutationTable
class are illustrated.

Payments in the end of periods


1 # Pure Endowment Insurance
2 tv7377_ct . nEx ( x =50 , n =5) # 0 . 8 8 5 8 0 6 9 6 6 1 5 2 4 8 5 4
3 tv7377_ct . nEx ( x =50 , n =10) # 0 . 7 7 7 1 7 4 8 2 7 8 3 9 3 4 7 9
4 tv7377_ct . nEx ( x =80 , n =10) # 0 . 2 2 8 3 0 8 1 3 2 0 2 3 0 2 7 7
5

6 # Whole Life Insurance


7 tv7377_ct . Ax ( x =50) # 0.5577562201235239
8 tv7377_ct . t_Ax ( x =50 , defer =2) # 0.550183040772438
9

77
Table 18: Actuarial Notation and Syntax Formula for Life Insurances - fixed capitals

Notation Description Syntax


n Ex pure endowment nEx(x,n)
Ax whole life insurance (end of the year) Ax(x)
Āx whole life insurance (moment of death) Ax (x)
t| Ax t years deferred whole life insurance (end of the year) t Ax(x,t)
t| Āx t years deferred whole life insurance (moment of death) t Ax (x,t)
A1x:n term life insurance (end of the year) nAx(x,n)
Ā1x:n term life insurance (moment of death) nAx (x,n)
1
t| Ax:n t years deferred term life insurance (end of the year) t nAx(x,n,t)
1
t| Āx:n t years deferred term life insurance (moment of death) t nAx (x,n,t)
Ax:n endowment insurance (end of the year) nAEx(x,n)
Āx:n endowment insurance (moment of death) nAEx (x,n)
t| Ax:n t-years deferred endowment insurance (end of the year) t nAEx(x,n,t)
t| Āx:n t-years deferred endowment insurance (moment of death) t nAEx (x,n,t)

Table 19: Actuarial Notation and Syntax Formula for Life Insurances - variable capitals

Notation Description Syntax


(IA)x whole life insurance with arithmetically increasing capitals (end of the IAx(x)
year)
(I Ā)x whole life insurance with arithmetically increasing capitals (moment of IAx (x)
death)
(IA)x:n term life insurance with arithmetically increasing capitals (end of the nIAx(x,n)
year)
(I Ā)x:n term life insurance with arithmetically increasing capitals (moment of nIAx (x,n)
death)
r
t| (IA)x:n t-years deferred term life insurance with capitals evolving arithmetically nIArx(x,n,t,C,r)
(increasing or decreasing). First Capital C and increase amount r (end
of the year)
r
t| (I Ā)x:n t-years deferred term life insurance with capitals evolving arithmetically nIArx (x,n,t,C,r)
(increasing or decreasing). First Capital C and increase amount r (mo-
ment of death)

10 # Temporary Life Insurance


11 tv7377_ct . nAx ( x =50 , n =10) # 0.046765545191685375
12 tv7377_ct . t_nAx ( x =50 , n =10 , defer =5) # 0 . 0 5 9 6 1 5 3 2 9 7 7 9 3 3 4 8 3 4
13

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

7 # Temporary Life Insurance with variable Capitals ( arithmetic progression )


8 # Increasing Capitals
9 tv7377_ct . nIArx ( x =50 , n =10 , defer =0 , first_amount =1000 , i nc r ea se _a m ou nt =50)
10 # 58.18654553286392
11 tv7377_ct . nIArx ( x =50 , n =10 , defer =10 , first_amount =1000 , in c re as e_ a mo un t =50)
12 # 133.3402470815534
13

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:

- ct.t Ax(x, defer=0) = ct.Ax(x)

- ct.t nAx(x, n, defer=0) = ct.nAx(x, n)

- ct.nIAx(x, n) = ct.nIArx(x, n, defer=0,first amount=1, increase amount=1)

Payments in the middle of the year (“moment of death”)


1 # Whole Life Insurance
2 tv7377_ct . Ax_ ( x =50) # 0.5633061699539695
3 tv7377_ct . t_Ax_ ( x =50 , defer =2) # 0.5556576337284301
4

5 # Temporary Life Insurance


6 tv7377_ct . nAx_ ( x =50 , n =10) # 0.047230885460862126
7 tv7377_ct . t_nAx_ ( x =50 , n =10 , defer =5) # 0.060208531750847685
8

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

14 # Temporary Life Insurance with variable Capitals


15 tv7377_ct . IAx_ ( x =50) # 15.964723312327344
16 tv7377_ct . nIAx_ ( x =50 , n =10) # 0 . 2 7 7 9 2 3 7 8 4 1 5 4 3 9 8 8
17 tv7377_ct . nIAx_ ( x =50 , n =50) # 1 5 . 8 5 8 8 5 1 3 9 8 8 8 9 8 8 2
18

19 tv7377_ct . nIArx_ ( x =50 , n =10 , defer =0 , first_amount =1000 , i n cr ea se _ am ou nt =50)


20 # 58.765530395538875
21 tv7377_ct . nIArx_ ( x =50 , n =10 , defer =10 , first_amount =1000 , in cr e as e_ am o un t =50)
22 # 134.66704838825683
23 tv7377_ct . nIArx_ ( x =50 , n =10 , defer =0 , first_amount =1000 , i n cr ea se _ am ou nt = -50)
24 # 35.69624052618538
25 tv7377_ct . nIArx_ ( x =50 , n =10 , defer =10 , first_amount =1000 , in cr e as e_ am o un t = -50)
26 # 28.306874184857506

79
Remarks:

- ct.t Ax (x, defer=0) = ct.Ax (x)

- ct.t nAx (x, n, defer=0) = ct.nAx (x, n)

- ct.nIAx (x, n) = ct.nIArx (x, n, defer=0,first amount=1, increase amount=1)

7.6 Export Actuarial Table to Excel


Actuarial Tables may be exported to Excel files, using the standard Python functions.
For example, the following instruction produces a xlsx file with actuarial commutation symbols for all integer
and half year ages, for TV7377 mortality table:

1 tv7377_ct_f2 . d f _ c o m m u t a t i o n _ t a b l e _ f r a c () . to_excel ( excel_writer = ’ frac2 ’ + ’. xlsx ’ ,


2 sheet_name = ’ frac2 ’ , index = False , freeze_panes =(1 , 1) )

Figure 1 illustrates an excerpt of the the produced excel file for TV7377 actuarial table for years fractioned in
semesters.

Figure 1: Excerpt of TV7377 semiannually fractional actuarial table

80
8 Financial Annuities
8.1 Class Annuities Certain

class Annuities Certain


This class instantiates the methods for the computation of financial annuities, for a given interest rate and a
chosen frequency of payments m (in each period of the interest rate).

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)

The following methods are available after instantiating the class:

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

8.2 Constant Terms Financial Annuities


8.2.1 an

(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 Variable Terms Financial Annuities


In this section we present functions that allow the computation of the present value of financial annuities with
variable terms, for the particular cases where the terms evolve in arithmetic or geometric progressions.
For both cases, functions are defined in a general way such that the first term may differ from the rate of growth
and the same function allows for increasing and decreasing terms.
For annuities with payments more frequent than the interest rate period, two approaches are considered and
corresponding functions are developed: (1) payments level within each interest period and increase/decrease
from one interest period to the next and (2) payments increase in each payment period.

Annuities with terms evolving Arithmetically

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

(m) (m) ani − nv n


(C,r) (Ia)n = C an +r
i(m)

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

Annuities with terms evolving Geometrically


For computing the present value of geometric financial annuities, let us consider the interest rate ig which
reflects the annual interest rate of the annuity, i, and the growth rate g. For these cases, let us define
1−g 1+g
ig = and vg = .
1+i 1+i

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

Actuarial Notation: g (G(m) ä)n or g (G(m) ä)n

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.

9.1 Survival Probabilities

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.

3. Build a dataframe with ages and estimated probabilities.

4. Export data to an Excel file.

5. Plot the estimated probabilities in a scatterplot.

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
3

4 import numpy as np
5 import pandas as pd
6 import matplotlib . pyplot as plt
7

8 mt = rst . SoaTable ( ’/ soa_tables / TV7377 ’ + ’. xml ’)


9 lt = mtable . M ortalit yTable ( mt = mt . table_qx )
10

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

25 plt . xlabel ( r ’ $n$ ’)


26 plt . ylabel ( r ’$ {} _ { n } p_ {55} $ ’)
27 plt . title ( ’ Probability of Survival ’)
28 plt . grid ( visible = True , which = ’ both ’ , axis = ’ both ’ , color = ’ grey ’ , linestyle = ’ - ’ , linewidth =.1)
29 plt . savefig ( ’ example1s ’ + ’. eps ’ , format = ’ eps ’ , dpi =3600)
30 plt . show ()

88
31

32 plt . scatter (n , dprobs , s =.5 , color = ’ red ’)


33

34 plt . xlabel ( r ’ $n$ ’)


35 plt . ylabel ( r ’$ {} _ { n } q_ {55} $ ’)
36 plt . title ( ’ Probability of Dying ’)
37 plt . grid ( visible = True , which = ’ both ’ , axis = ’ both ’ , color = ’ grey ’ , linestyle = ’ - ’ , linewidth =.1)
38 plt . savefig ( ’ example1d ’ + ’. eps ’ , format = ’ eps ’ , dpi =3600)
39 plt . show ()

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:

(a) The contract is paid at single premium.


(b) The contract is paid at level premiums during 5 years.

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.

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 , c o m m u t a t i o n _ t a b l e as ct
3

4 import numpy as np
5 import os
6 import sys
7 import matplotlib . pyplot as plt
8

9 this_py = os . path . split ( sys . argv [0]) [ -1][: -3]


10

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

24 for idx , lt in enumerate ( lt_lst ) :


25 name = p a r s e _ t a b l e _ n a m e ( mt_lst [ idx ]. name )
26 lt . df_life_table () . to_excel ( excel_writer = name + ’. xlsx ’ , sheet_name = name , index = False ,
freeze_panes =(1 , 1) )
27 ct_lst [ idx ]. d f _ c o m m u t a t i o n _ t a b l e () . to_excel ( excel_writer = name + ’ _comm ’ + ’. xlsx ’ ,
sheet_name = name , index = False , freeze_panes =(1 , 1) )
28

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

129 # Consult the values used each computation ( Nx , Dx )


130 for idx , ct in enumerate ( ct_lst ) :
131 print ( ct . msn )
132 print ()
133

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

Mortality Rate Probability of Survival


1.0 TV7377 1.0
GRF95
GRM95
0.8 0.8

0.6 0.6
qx

px

0.4 0.4

0.2 0.2
TV7377
GRF95
0.0 0.0 GRM95

0 20 40 60 80 100 120 0 20 40 60 80 100 120


x x

Complete Expectation of Life ln(D_x)


TV7377 TV7377
GRF95 10 GRF95
80 GRM95 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

TV7377: 14,979.28 GRF95: 18,019.96 GRM95: 15,531.28


N56
Question 4 b): P ä55:5 = 1000 D55

TV7377: 3,272.3 GRF95: 3,910.88 GRM95: 3,398.66

Question 5: 1000a55:10 = 1000 N56D−N


55
66

TV7377: 3,272.3 GRF95: 3,910.88 GRM95: 3,398.66

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:

1. Determine the net single premium (risk single premium).

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.

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 , c o m m u t a t i o n _ t a b l e as ct
3

4 import numpy as np
5

6 table_names = [ ’ TV7377 ’ , ’ GRF95 ’ , ’ GRM95 ’]


7 interest_rate = 4
8 mt_lst = [ rst . SoaTable ( ’ soa_tables / ’ + name + ’. xml ’) for name in table_names ]
9 lt_lst = [ mtable . Mo rtality Table ( mt = mt . table_qx ) for mt in mt_lst ]
10 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 ]
11

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

32 # show the annuities


33 print ( ’\ nannuities ’)
34 for idx , ct in enumerate ( ct_lst ) :
35 print ( table_names [ idx ] + " : " + f ’{ round ( tad [ idx ] , 5) : ,} ’)
36

37 # ## Question 3
38

39 # # Refund of Net Single Premium

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

44 print ( ’\ nTerm Life Insurance ’)


45 for idx , ct in enumerate ( ct_lst ) :
46 print ( table_names [ idx ] + " : " + f ’{ round ( t e r m L i f e I n s u r a n c e [ idx ] , 5) : ,} ’)
47

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

52 print ( ’ Refund Cost at End of the Year of Death ’)


53 for idx , ct in enumerate ( ct_lst ) :
54 print ( table_names [ idx ] + " : " + f ’{ round ( capital * ( p u r e E n d o w _ r e f u n d [ idx ] - pureEndow [ idx ])
, 5) : ,} ’)
55

56 print ( ’\ nSingle Net Risk Premium Refund at End of the Term ’)


57 p u r e E n d o w _ r e f u n d _ e o t = [ ct . nEx ( x =x , n = term ) / (1 - (1 + interest_rate / 100) ** ( - term ) + ct .
nEx ( x =x , n = term ) )
58 for ct in ct_lst ]
59

60 for idx , ct in enumerate ( ct_lst ) :


61 print ( table_names [ idx ] + " : " + f ’{ round ( capital * p u r e E n d o w _ r e f u n d _ e o t [ idx ] , 5) : ,} ’)
62

63 print ( ’ Refund Cost at End of the the Term ’)


64 for idx , ct in enumerate ( ct_lst ) :
65 print ( table_names [ idx ] + " : " + f ’{ round ( capital * ( p u r e E n d o w _ r e f u n d _ e o t [ idx ] - pureEndow [
idx ]) , 5) : ,} ’)
66

67

68 # # Refund of Net Level Premiums


69

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

77 for idx , ct in enumerate ( ct_lst ) :


78 print ( table_names [ idx ] + " : " + f ’{ round ( capital * p u r e E n d o w _ l e v e l e d _ r e f u n d [ idx ] , 5) : ,} ’)

Solutions:

Question 1:
P P = 1000 10 E55

TV7377: 624.36092 GRF95: 653.67485 GRM95: 615.65987

95
Question 2:
10 E55
P ä55 = 1000
ä55:10

TV7377: 136.39495 GRF95: 141.86738 GRM95: 134.72276

Question 3:

Single Premium with Refund paid at the end of the Year of Death

10 E55
P = 1000
1 − A155:10

TV7377: 664.2747 GRF95: 670.91998 GRM95: 662.20316

Single Premium with Refund paid at the end of the contract

10 E55
P = 1000
1 − v 10 10 q55

TV7377: 658.0555 GRF95: 668.30356 GRM95: 654.89063

Level Premium with Refund paid at the end of the year of death

10 E55
P = 1000
ä55:10 − (IA)55:10

TV7377: 144.14453 GRF95: 145.18891 GRM95: 143.8195

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.

2 # # Net premium reserves path


3

4 l0 = 1000
5 reserves_dict = { ’ table ’: [] , ’x ’: [] , ’ insurer ’: [] , ’ insured ’: [] , ’ reserve ’: []}
6 fund_dict = { ’ lx ’: [] , ’ claim ’: [] , ’ premium ’: [] , ’ fund ’: []}
7

8 # Expected reserves value , that is , considering the survivorship of the group


9 e x p e c t e d _ r e s e r v e _ d i c t = { ’ insurer_exp ’: [] , ’ insured_exp ’: [] , ’ reserve_exp ’: []}
10 ages = range (x , x + term + 1)
11 print ( ’\ n \ n Net Premium reserves \ n \ n ’)
12 for idx_clt , clt in enumerate ( ct_lst ) :
13 premium_unit = pureEndow [ idx_clt ]
14 p re mi um _ ca pi ta l = capital * premium_unit
15 p r e m i u m _ u n i t _ l e v e l e d = premium_unit / tad [ idx_clt ]
16 p re mi um _ le ve le d = p r e m i u m _ u n i t _ l e v e l e d * capital
17 for age in ages :
18 # reserves
19 reserves_dict [ ’ table ’ ]. append ( table_names [ idx_clt ])
20 reserves_dict [ ’x ’ ]. append ( age )
21 i n s u r e r _ l i a b i l i t y = clt . nEx ( x = age , n = term - ( age - x ) ) * \
22 capital
23 reserves_dict [ ’ insurer ’ ]. append ( i n s u r e r _ l i a b i l i t y )
24 tad2 = clt . naax ( x = age , n = term_annuity - ( age - x ) )
25 i n s u r e d _ l i a b i l i t y = p re mi u m_ le v el ed * tad2
26 reserves_dict [ ’ insured ’ ]. append ( i n s u r e d _ l i a b i l i t y )
27 reserve = i n s u r e r _ l i a b i l i t y - i n s u r e d _ l i a b i l i t y
28 reserves_dict [ ’ reserve ’ ]. append ( reserve )
29

30 prob_survival = clt . npx ( x =x , n = age - x )


31 lx = l0 * prob_survival
32 e x p e c t e d _ r e s e r v e _ d i c t [ ’ insurer_exp ’ ]. append ( i n s u r e r _ l i a b i l i t y * lx )
33 e x p e c t e d _ r e s e r v e _ d i c t [ ’ insured_exp ’ ]. append ( i n s u r e d _ l i a b i l i t y * lx )
34 e x p e c t e d _ r e s e r v e _ d i c t [ ’ reserve_exp ’ ]. append ( reserve * prob_survival * lx )
35

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

53 reserves_df = pd . DataFrame ( reserves_dict )


54 e x p e c t e d _ r e s e r v e _ d f = pd . DataFrame ( e x p e c t e d _ r e s e r v e _ d i c t )
55 fund_df = pd . DataFrame ( fund_dict )
56 name = ’ p u r e E n d o w m e n t _ 5 5 _ 1 ’
57 reserves_df . to_excel ( excel_writer = name + ’ _netReserves ’ + ’. xlsx ’ , sheet_name = name , index =
False , freeze_panes =(1 , 1) )
58

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

66 plt . xlabel ( r ’ $x$ ’)


67 plt . ylabel ( ’ Reserves ’)
68 plt . title ( ’ Net Premium Reserves Pure Endowment ’)
69 plt . grid ( visible = True , which = ’ both ’ , axis = ’ both ’ , color = ’ grey ’ , linestyle = ’ - ’ , linewidth =.1)
70 plt . legend ()
71 plt . show ()
72

73 # save the graph


74 plt . savefig ( this_py + ’. eps ’ , format = ’ eps ’ , dpi =3600)

Net Premium Reserves Pure Endowment


1000 TV7377
GRF95
GRM95
800

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%.

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 , m o r t a l i t y _ i n s u r a nc e as
lins
3

4 # reads soa table TV7377


5 soaTV7377 = rst . SoaTable ( ’ ../ soa_tables / TV7377 . xml ’)
6 soaGRF95 = rst . SoaTable ( ’ ../ soa_tables / GRF95 . xml ’)
7 # soa = rst . SoaTable ( ’../ soa_tables / ’ + ’ TV7377 ’ + ’. xml ’)
8

9 # creates a mortality table


10 # tv7377 = mt . M ortalit yTable ( data_type = ’ q ’, mt = soa . table_qx , perc =100 , last_q =1)
11 grf95 = mtable . M ortality Table ( mt = soaGRF95 . table_qx )
12 tv7377 = mtable . Mor talityTa ble ( mt = soaTV7377 . table_qx )
13

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

31 T = ( premium -50 * Ia_66 - 800 * E466 ) /( ad66 + E466 + A66_10 )


32 print ( T )

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:

200 000 = T ä66 + 200 (Ia)66 + (T + 800) 4 E66 + T Ā66:10 ⇔

200 000 − 200 (Ia)66 − 800 4 E66


⇔T = = 6 878.47 m.u.
ä66 + 4 E66 + Ā66:10

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:

1. The risk premium of the contract.

2. The level risk premium.

3. For each year t = 0, . . . , r − x, obtain:

(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.

4. Export the estimated amounts to an Excel file.

5. Save the estimated amounts in a dataframe.

6. Represent the amounts obtained in questions 3a, 3b, 3c and 3d in separated barplots.

7. Represent the amounts obtained in questions 3b, 3c and 3d in a single barplot.

8. Consider x = 60, p = 5 and r = 80 and compare.

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

9 # Reading the Mortality Table


10 mt = rst . SoaTable ( ’ ../../ soa_tables / TV7377 ’ + ’. xml ’)
11 lt = mtable . M ortalit yTable ( mt = mt . table_qx )
12

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

50 # EVOLUTION OF THE FUND


51 path_fund [ ’t ’ ]. append ( idx_ages )
52 path_fund [ ’ lx ’ ]. append ( l0 * npx )
53 path_fund [ ’ in ’ ]. append ( l0 * npx * p a t h _ l i a b i l it i e s [ ’ premium ’ ][ idx_ages ])
54 if idx_ages == 0:

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

71 ( pd . DataFrame ( path_fund ) ) . to_excel ( excel_writer = ’ fund ’ + ’. xlsx ’ , sheet_name = ’ fund ’ ,


72 index = False , freeze_panes =(1 , 1) )
73

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 ()

Expected Insured Population 1e6 Expected Collected Premiums


5
1000

800
4

600 3

400 2

200 1

0 0
0 5 10 15 20 25 0 5 10 15 20 25

1e7 Expected Claims 1e7 Expected Fund

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

The result for the data of Question 8 is given by

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.

Considering the TV7377 with a rate of 2% as the actuarial table:

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.

1 # reads soa table TV7377


2 soaTV7377 = rst . SoaTable ( ’ ../ soa_tables / TV7377 . xml ’)
3 tv7377 = mtable . Mor talityTa ble ( mt = soaTV7377 . table_qx )
4

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

17 p re mi um _ le ve le d = (500 * 12 * a12xy + 1000000 * Axy ) / (2 * aa2xy )


18

19 print ( f ’ a12xy :{ a12xy } ’)


20 print ( f ’ Axy :{ Axy } ’)
21 print ( f ’ aa2xy :{ aa2xy } ’)
22 print ( f ’ Leveled Premium :{ pr em i um _l ev e le d } ’)
23

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

37 plt . xlabel ( ’ ages ’)


38 plt . ylabel ( ’ premium ’)
39 plt . title ( ’ Annual Risk Premium ’)
40 plt . grid ( visible = True , which = ’ both ’ , axis = ’ both ’ , color = ’ grey ’ , linestyle = ’ - ’ , linewidth =.1)
41 plt . legend ()
42 plt . savefig ( this_py + ’ arp ’ + ’. eps ’ , format = ’ eps ’ , dpi =3600)
43 plt . show ()

Annual Risk Premium


Risk Premium
8500 Leveled

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

You might also like