Examples¶
This section contains practical examples demonstrating how to use the lost_years package to calculate expected years lost using different data sources.
Overview¶
The examples showcase the three main functions of the package:
lost_years_ssa: Calculate expected years lost using US Social Security Administration datalost_years_hld: Calculate expected years lost using international Human Life-Table Databaselost_years_who: Calculate expected years lost using WHO life expectancy data
Available Examples¶
- Prepare example input in DataFrame
- Get Life expectancy data columns from SSA dataset
- Get Human Life Table data columns from HLD dataset
- Average Number of Years Lost For People Who Died of Coronavirus in China
- Prepare example input in DataFrame
- Get Human Life Table data columns from HLD dataset
- Assuming all the people who died were at the bottom of the age ranges
- Assuming all the people who died were at the top of the age ranges
- Assuming all the people who died were at the middle of the age ranges
- Assume the Longevity is the Same as People in the US
- Assume Everyone Lives Till 90
- Average Number of Years Lost For People Who Died of Coronavirus in France
- Prepare example input in DataFrame
- Get Human Life Table data columns from HLD dataset
- Assuming all the people who died were at the bottom of the age ranges
- Assuming all the people who died were at the top of the age ranges
- Assuming all the people who died were at the middle of the age ranges
- Assume the Longevity is the Same as People in the US
- Assume Everyone Lives Till 90
- Get Human Life Table data columns from WHO dataset
- Assuming all the people who died were at the bottom of the age ranges
- Get Human Life Table data columns from WHO dataset
- Assuming all the people who died were at the top of the age ranges
- Get Human Life Table data columns from WHO dataset
- Assuming all the people who died were at the middle of the age ranges
- Average Number of Years Lost For People Who Died of Coronavirus in France
- Prepare example input in DataFrame
Basic Usage Example¶
The basic example demonstrates simple usage with sample data across different countries and demographics.
COVID-19 Analysis Examples¶
The coronavirus examples show real-world applications analyzing the impact of COVID-19 on life expectancy across different countries and time periods:
corona_virus.ipynb: General COVID-19 impact analysis
corona_virus_fr.ipynb: Focused analysis on France
corona_virus_fr_daily.ipynb: Daily analysis for France
These examples use real COVID-19 mortality data to demonstrate practical applications of the lost years calculations.
Data Sources¶
The examples use data from:
CDC COVID-19 mortality data
WHO life expectancy statistics
SSA actuarial tables
HLD international life tables
All data files are included in the data/ subdirectory for reproducibility.