Skip to content

NAFLD/NASH: recalibrate to placebo-corrected trial values + add validation harness#8

Open
mingushin3 wants to merge 3 commits into
mainfrom
improve/nafld-calibrate-to-trials
Open

NAFLD/NASH: recalibrate to placebo-corrected trial values + add validation harness#8
mingushin3 wants to merge 3 commits into
mainfrom
improve/nafld-calibrate-to-trials

Conversation

@mingushin3

Copy link
Copy Markdown

Summary

Recalibrates the NAFLD/NASH QSP model so each drug's effect size matches the placebo-corrected
endpoint of its pivotal trial, fixes a latent empagliflozin PK bug, corrects citation provenance,
and adds a reproducible validation harness.

Validated effect sizes (model vs published, placebo-corrected)

Drug Before After Trial
Resmetirom 100 mg — liver fat −40.1% −34.0% MAESTRO-NAFLD-1 wk52 −33.9%
Empagliflozin 10 mg — liver fat −1.2% (near-inert) −24.6% E-LIFT between-group −24.7%
Semaglutide 2.4 mg — body weight −11.3% −11.3% (unchanged) ESSENCE −10.5% / STEP −14.9%

All numbers are reproducible: Rscript nafld-nash/validation/validate.R (exit 0 = all checks pass —
placebo flat, no divergence, effect sizes within tolerance of the trials).

Changes

  • Resmetirom recalibration: DNL inhibition 0.40→0.30, efflux gain 0.60→0.48.
  • Empagliflozin: new WEMP_LF direct hepatic-fat efflux term (calibrated to E-LIFT
    placebo-corrected −24.7%) + EC50_EMP 0.15→0.015 (10 mg was effectively inert before).
  • Calibration anchored to placebo-corrected (between-group) effects throughout — surfaced by an
    adversarial multi-lens review (the raw within-arm E-LIFT −30% over-credits the control-arm decline).
  • Citation/provenance fixes in the model header; limitations documented in the design brief.
  • New validation/ harness (validate.R + evidence figures).

Before → after recalibration

recalibration

Notes

Limitations / next

Steady-state model matches the wk52 plateau (not the within-study time-course); NAS sub-scores are
proxies → use deltas; OCA safety (pruritus, LDL) and the NASH-resolution endpoint are not modeled;
a continuous-output → responder-rate (% NASH resolution) bridge is future work.

🤖 Generated with Claude Code

mingushin3 and others added 3 commits June 17, 2026 16:10
…ontrast

mrgsolve model (nafld_mrgsolve_model.R):
- Remove compartments from CAPTURE block (mrgsolve >=1.0 rejects them;
  compartment amounts are returned automatically)

Shiny app (nafld_shiny_app.R):
- Remove compartments from CAPTURE block
- TABLE: use TIME instead of lowercase time (collided with C library time())
- Remove apostrophes from an in-model comment that prematurely closed the
  single-quoted R model string (caused "unexpected symbol")
- Hoist valueBox_shiny() above the ui object (UI called it at build time)
- Replace deprecated page_navbar bg= with navbar_options(bg=, theme=)
- High-contrast navbar: deep-maroon bar, light tab labels, white-pill
  active tab, white brand title (via bs_add_rules)

Verified: both models parse, compile, and simulate; Shiny UI builds with
no errors or warnings.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…el for stability

req() error (Scenario Comparison / Endpoint Summary tabs):
- mrgsolve exports a req() S3 generic that masks shiny::req() (loaded earlier),
  so req(input$compare_arms) hit mrgsolve's generic -> "no applicable method
  for req applied to character". Qualified all four server calls as shiny::req().

Model divergence (placebo grew ~10x/week to ~1e+85):
- Root cause: disease pools were not initialized at their own steady state
  (absolute production terms) and the steatosis->Kupffer->TNFa->IR->DNL->fat
  positive-feedback loop was unbounded.
- Re-calibrated BOTH nafld_mrgsolve_model.R and nafld_shiny_app.R to
  steady-state-consistent indirect-response (turnover) form (kin = KOUT*baseline)
  with fold-change-normalized, saturable drivers and loop gain << 1
  (Dayneka 1993; Jusko & Ko 1994; Woo 2009; Angeli-Ferrell-Sontag 2004; Maldonado 2022).
- LIVER_FAT influx split into DNL + adipose-NEFA(weight); Kupffer drive saturable;
  ALT injury is now a sum (not product) of normalized drivers; collagen made the
  slowest pool. INS_RES/BODY_WT/ADIPONECTIN already correct (set-point form).
- Remapped the Fibrosis-tab sliders/param() to the new sensitivity names
  (GTGF_HSC, GHSC_COL, GLIP_KUP, GKUP_TGF) and adjusted ranges.
- Added nafld_model_design_brief.md documenting the literature basis.

Verified (R, mrgsolve 2.0.1): placebo flat to machine precision for all 11
states over 72 wk; perturbation recovers to baseline; no divergence in any arm;
drug directions clinically correct (resmetirom -40% liver fat ~ MAESTRO,
semaglutide lowers fat/HOMA-IR/weight & raises adiponectin, OCA lowers fibrosis,
triple best); fibrosis-tab live-param path works.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…validation harness

- Resmetirom: DNL inhibition 0.40->0.30, efflux gain 0.60->0.48
  => 100 mg liver fat -40% -> -34.0% (MAESTRO-NAFLD-1 wk52 placebo-corrected -33.9%)
- Empagliflozin: add direct hepatic-fat efflux term (WEMP_LF=0.47, calibrated to E-LIFT
  placebo-corrected -24.7%) + fix latent near-inert PK scaling (EC50_EMP 0.15->0.015)
  => liver fat -1% -> -24.6%
- Calibrate to placebo-corrected (between-group) trial effects throughout (the QSP placebo
  arm is flat, so raw within-arm trial changes would over-credit the drug)
- Fix citation provenance in model header (ESSENCE/Newsome, OCA, EMPACTA->E-LIFT, Rieger);
  document recalibration + adversarial-review limitations in the design brief
- Add validation/validate.R reproducibility harness (placebo flat + effect sizes; all pass)
  and validation figures

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant