Skip to content

danielduongg/longevity-levers

Repository files navigation

🧬 longevity-levers — how old are you, really?

CI

A transparent, source-cited estimate of your all-cause mortality hazard from modifiable lifestyle factors, and the rough biological-age gap it implies.

▶️ Live demo

Set eleven levers — cardiorespiratory fitness, activity, smoking, BMI, sleep, grip strength, diet, social connection, alcohol — and see your modeled hazard multiplier, a biological-age delta, and a ranking of which levers move you most.

⚠️ Population associations from observational cohorts — not causation, not a diagnosis, not medical advice. For curiosity, not clinical decisions.

How it works (and where it's honest)

Each factor contributes a published Cox hazard ratio (central estimate + 95% CI in hazard_ratios.json, with the source study). The model sums log-hazards and converts to an age-equivalent via a Gompertz mortality doubling time of ~8 years.

The honest part is the overlap shrinkage. Naively multiplying nine hazard ratios assumes they're independent — they aren't (fit people also tend to be lean, active non-smokers), so the raw product explodes to absurd values (a worst-case profile would read as +47 "biological years"). We therefore apply a 0.60 shrinkage to the summed log-hazard and cap the delta, anchoring the best-vs-worst spread to what joint-behaviour cohort studies actually observe (~10–14 years). This is the same trap — treating correlated predictors as independent — that quietly corrupts risk models in practice.

Profile Modeled hazard Bio-age delta
Reference adult 1.00× 0.0 yrs
All-healthy levers 0.68× −4.4 yrs
All-risk levers 11.7× +20 yrs (capped)

The biggest single levers are cardiorespiratory fitness and smoking — consistent with the epidemiology.

Results

Hazard-ratio forest plot

A forest plot of each lever's highest-risk level with its 95% CI — cardiorespiratory fitness and smoking carry the widest, largest effects. The live demo now reports a biological-age range (propagating these CIs), not just a point estimate.

Tests & CI

pytest checks that the reference profile is neutral, healthy < reference < risky, the CI range brackets the point estimate, and every factor carries a citation. GitHub Actions runs it on every push.

Files

  • hazard_ratios.json — the HR table with CIs and citations (Mandsager 2018, Arem 2015, Jha 2013, Global BMI Collaboration 2016, Cappuccio 2010, Leong 2015/PURE, Holt-Lunstad 2010, GBD Alcohol 2018).
  • model.py — the compute (standard library only).
  • index.html — the in-browser calculator; its math reproduces model.py exactly.
python model.py     # prints reference / healthy / risky profiles + top levers
python build_demo.py

About

How old are you, really? A biological-age / mortality-hazard calculator built on published Cox hazard ratios (with CIs + sources), live in the browser. Associations, not medical advice.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages