liveBook · Manning

Mortality table

As explained in Build a Robo-Advisor with Python (From Scratch)

A mortality table is a statistical table giving the probability of death or survival for members of a population at different ages.

A mortality table gives the probability that a member of a population dies within a year at each age. In retirement modeling, it converts a fixed planning horizon into a lifespan-dependent horizon and makes longevity risk measurable. section 5.10

A practical implementation uses the publicly available RP-2014 table. Its pension-plan data may understate mortality because annuity purchasers can have longer life expectancies than workers choosing lump sums; Social Security tables may differ. section 5.10

Embedding mortality in a retirement simulation

For each simulated year, look up mortality_prob for the retiree's age and draw a uniform random number p. If p is below a 2% mortality probability, end that path at the year's end. Otherwise continue spending and wealth updates until death or bankruptcy. A 10,000-path example reports a 0.3686 probability of running out of money.

Replacing a fixed 30-year loop with a while loop allows each simulated retiree to die or exhaust wealth at a different age, producing a distribution of bankruptcy ages rather than one fixed endpoint. section 5.10

How Build a Robo-Advisor with Python (From Scratch) covers it

How deep it goes
Defines annual age-specific probabilities and implements sampled death events, while deferring mortality-table construction and statistical estimation.
Examples
Uses the RP-2014 Excel file, pandas DataFrame loading, age-based random death draws, and simulated bankruptcy-age distributions.
What it assumes
Assumes basic Python, pandas, random simulation, and retirement-wealth modeling while teaching age-indexed mortality integration.
What you can do after
Builds mortality-aware retirement simulations that estimate bankruptcy probabilities across variable lifespans.
How it connects
Connects longevity risk, Monte Carlo simulation, retirement planning, annuities, pensions, and Social Security decisions.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Robo-Advisor with Python (From Scratch). The section links point to the parts of the book it draws on.