aepstein/longevity-simulator
0
Longevity Simulator
A Python toolkit for modeling mortality rates and simulating the effects of longevity interventions.
Overview
This project provides tools to explore "what-if" scenarios for human longevity by modeling:
- Disease interventions: What if we cured cancer? Or cardiovascular disease?
- Aging interventions: What if we could stop or slow biological aging?
- Survival analysis: Calculate survival curves and median lifespans under different scenarios
Uses real-world data from:
- CDC/NCHS United States Life Tables (2010-2019)
- CDC Multiple Cause of Death (MMCD) database (2022)
Features
- Load and analyze mortality data from CDC life tables
- Model aging interventions:
- Stop aging at a specific age
- Slow the rate of biological aging
- Model disease cures by removing specific causes of death
- Calculate survival curves and median lifespans
- Categorize causes of death using ICD-10 codes
Installation
pip install -r requirements.txtQuick Start
from src import load_mortality_rates, stop_aging, calculate_survival_curve, calculate_median_lifespan
# Load preprocessed US mortality data
mortality_rates = load_mortality_rates('data/mortality_rates_total.csv')
# Model stopping aging at 25
adjusted_rates = stop_aging(mortality_rates, final_age=25, pad_to_age=200)
# Calculate survival curve
survival = calculate_survival_curve(adjusted_rates)
# Get median lifespan
median = calculate_median_lifespan(survival)
print(f"Median lifespan if aging stopped at 25: {median} years")Project Structure
longevity-simulator/
├── src/ # Python modules
│ ├── mortality.py # Load mortality data
│ ├── interventions.py # Aging interventions
│ ├── causes.py # Cause of death analysis
│ └── survival.py # Survival curve calculations
├── data/ # Processed data (committed to git)
│ ├── mortality_rates_total.csv # ~1 KB
│ ├── mortality_rates_male.csv
│ ├── mortality_rates_female.csv
│ ├── cause_fractions_total.csv # ~23 KB
│ ├── cause_fractions_male.csv
│ └── cause_fractions_female.csv
├── raw_data/ # Raw data files (not in git, ~300 MB)
│ ├── MMCD_2022.parquet
│ └── life_table_*.txt
├── preprocessing/ # Scripts to process raw data
│ ├── process_mmcd.py
│ ├── process_life_table.py
│ └── README.md
├── notebooks/ # Jupyter notebooks
│ └── demo.ipynb
├── results/ # Output plots and figures
├── requirements.txt # Python dependencies
└── README.md # This fileData Sources
- Life Tables: CDC/NCHS United States Life Tables
- Mortality Data: CDC Multiple Cause of Death Database
Data Preprocessing
The project uses preprocessed data stored in data/ (small CSV files, ~25 KB total). This allows the repository to be easily shared on GitHub without large files.
To regenerate the processed data from raw sources:
- Place raw data files in
raw_data/ - Run preprocessing scripts:
cd preprocessing
python process_life_table.py
python process_mmcd.pySee preprocessing/README.md for details.
Use Cases
- Research: Model the impact of medical breakthroughs on population lifespan
- Education: Visualize how aging and disease affect mortality
- Policy: Estimate the demographic impact of public health interventions
- Curiosity: Explore "what-if" scenarios for human longevity
Future Development
- Interactive dashboard using Plotly Dash
- Additional intervention models (combination therapies, age-specific treatments)
- Comparative analysis across countries and time periods
- Economic impact modeling
License
MIT License - see LICENSE file for details
Author
Alexander Epstein, Cao Lab, Rockefeller University
