Skip to content

Create tutorial for select and ultimate mortality in Numpy, Pandas, and vanilla Python #13

@MatthewCaseres

Description

@MatthewCaseres
  • Vanilla Python
    • What are select and ultimate mortality tables and how are they represented in the computer.
      • Use the ultimate table from pymort via MortXML(3265).Tables[1].Values.unstack().values to retrieve some realistic values for the ultimate rates. We are going to use the ultimate rates to create the select rate table artificially. You will create a Python module that exports a Mortality class with attributes ultimate: list[float] and select: list[list[float]]. The ultimate table is imported from Pymort and converted to a list. The select table is created from this by artificially decreasing the duration 0 mortality by some factor, and smoothly transitioning to the ultimate mortality during __init__.
    • How do you access the select and ultimate mortality rates using Python.
    • Use a select and ultimate mortality table to compute the values in the Number surviving and number dying columns from https://en.wikipedia.org/wiki/File:Excerpt_from_CDC_2003_Table_1.pdf. These are list[float]
      • So like for the "Number surviving" just start at 100,000 and use the mortality to decrement. See that number dying = (number surviving)*(probability of dying).
    • Project the expected number of deaths and survivors for a starting population with 16782 males and 16986 females. The file on wikipedia is giving expected numbers as in expected value with a starting population of 100,000. so we are just changing the starting value and doing two populations.
  • Numpy. The same exercise as before but now replacing all lists with numpy ndarrays. In particular, the only distinction between male and female will be in array indexing, there should not be separate arrays for mortality tables or for population. There is a single select table for both male and female, also a single ultimate table shared by both male and female.
  • Pandas. Basically the same ideas as this article - https://www.soa.org/497168/globalassets/assets/library/newsletters/the-modeling-platform/2020/april/mp-2020-iss-04-09-caseres.pdf

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions