Public
Star 历史趋势
数据来源: GitHub API · 生成自 Stargazers.cn
README.md
Life Expectancy Gender Gap Analysis
Exploring causes of gender differences in life expectancy across OECD countries.
Overview
This project analyzes the gender gap in life expectancy using data from WHO and IHME. It identifies which mortality factors (cardiovascular disease, alcohol, suicide, etc.) explain the most variation in the life expectancy gap between men and women.
The analysis uses:
- PyMC (Python): Bayesian hierarchical panel model implementation
- brms (R/Stan): Bayesian hierarchical panel model implementation
- Model comparison: Validation that both implementations produce identical results
A Quarto website provides a concise summary of the methodology, results, and findings.
Repository Structure
LifeExpectancy/
├── environment.yml # Conda environment (Python + R + Stan)
├── Makefile # Setup and build commands
├── data/ # WHO and IHME data files
│ ├── who_*.csv # WHO health indicators
│ ├── ihme_*.csv # IHME cause-of-death data
│ └── *.h5 # Processed data (HDF5)
├── notebooks/
│ ├── utils.py # Helper functions (Python)
│ ├── utils.R # Helper functions (R)
│ ├── process.ipynb # Data preparation and processing
│ ├── bayesian_model_py.ipynb # PyMC implementation
│ ├── bayesian_model_r.Rmd # brms implementation
│ └── compare_pymc_brms.ipynb # Model comparison
└── quarto/ # Quarto website source
├── _quarto.yml # Site configuration
├── index.qmd # Landing page
├── tech_report.qmd # Technical report
└── Makefile # Build and deploy commands
Setup
Prerequisites
Install mamba if you don't have it:
conda install -n base -c conda-forge mambaCreate Environment
make envThis creates a conda environment with:
- Python 3.11 + pandas, PyMC, nutpie, arviz, etc.
- R 4.3 + brms, tidyverse, cmdstan
- Jupyter with both Python and R kernels
- Quarto for website generation
Activate and Run
conda activate LifeExpectancy
jupyter labData Pipeline
Run the notebooks in order:
process.ipynb— Load raw data, compute gender gaps, filter to OECD countries, save to HDF5/CSVbayesian_model_py.ipynb— Fit Bayesian hierarchical panel model using PyMCbayesian_model_r.Rmd— Fit Bayesian hierarchical panel model using brmscompare_pymc_brms.ipynb— Compare results between PyMC and brms implementations
Data Sources
- WHO Global Health Observatory: Life expectancy, HALE, mortality indicators
- IHME Global Burden of Disease 2023: Cause-specific mortality by sex
License
MIT License - see LICENSE