The Mortality Space#
Mortality tables
The Mortality
space reads
mortality tables from a mortality file
and creates a unified mortality table as a pandas Series
indexed with Table ID, Attained Age and Duration.
This space is referenced as mort_data
in the ProductBase
space.
Example
The sample code below demonstrates how to examine the contents of
Mortality
.
>>> import modelx as mx
>>> m = mx.read_model("IntegratedLife")
>>> m.Mortality.mort_file()
WindowsPath('C:/Users/User1/appliedlife/input_tables/mortality_tables.xlsx')
>>> m.Mortality.table_defs()
is_used sex ... has_select description
table_id ...
T3363 True M ... True 2017 Unloaded CSO Composite Male ALB
T3364 True F ... True 2017 Unloaded CSO Composite Female ALB
T3275 True M ... True 2015 VBT Unismoke Male ALB
T3276 True F ... True 2015 VBT Unismoke Female ALB
T884 True F ... False Annuity 2000 Basic Female
T885 True M ... False Annuity 2000 Basic Male
>>> m.Mortality.select_table('T3276')
0 1 2 3 ... 21 22 23 24
0 0.00022 0.00012 0.00008 0.00007 ... 0.00029 0.00032 0.00035 0.00036
1 0.00012 0.00008 0.00007 0.00007 ... 0.00032 0.00035 0.00036 0.00036
2 0.00008 0.00007 0.00007 0.00007 ... 0.00035 0.00036 0.00036 0.00035
3 0.00007 0.00007 0.00007 0.00007 ... 0.00036 0.00036 0.00035 0.00035
4 0.00007 0.00007 0.00007 0.00007 ... 0.00036 0.00035 0.00035 0.00036
.. ... ... ... ... ... ... ... ... ...
91 0.02529 0.06300 0.13175 0.16683 ... 0.50000 0.50000 0.50000 0.50000
92 0.03682 0.09384 0.16683 0.18406 ... 0.50000 0.50000 0.50000 0.50000
93 0.05460 0.12337 0.18406 0.20412 ... 0.50000 0.50000 0.50000 0.50000
94 0.08008 0.16292 0.20412 0.22599 ... 0.50000 0.50000 0.50000 0.50000
95 0.11495 0.20412 0.22599 0.24952 ... 0.50000 0.50000 0.50000 0.50000
[96 rows x 25 columns]
>>> m.Mortality.merged_table('T3276')
att_age duration
0 0 0.00022
1 1 0.00012
2 2 0.00008
3 3 0.00007
4 4 0.00007
116 25 0.50000
117 25 0.50000
118 25 0.50000
119 25 0.50000
120 25 0.50000
Length: 2521, dtype: float64
>>> m.Mortality.unified_table()
table_id att_age duration
T3363 0 0 0.00019
1 1 0.00012
2 2 0.00011
3 3 0.00009
4 4 0.00009
T885 116 0 1.00000
117 0 1.00000
118 0 1.00000
119 0 1.00000
120 0 1.00000
Length: 10326, dtype: float64
Formulas#
Table definitions |
|
|
Reads a select mortality table with the given table ID |
Reads the ultimate mortality tables |
|
Selection period length |
|
|
Merged mortality table for a given table ID |
Unified mortality table |
|
Mortality table file |
|
Mortality table last age |