THE MERLIN ECOSYSTEM: AN INTEGRATED OPEN-SOURCE PLATFORM FOR SURVIVAL ANALYSIS, MULTI-STATE MODELING, AND HEALTH ECONOMIC EVALUATION IN R AND STATA
Author(s)
Michael J. Crowther, PhD.
Red Door Analytics, Stockholm, Sweden.
Red Door Analytics, Stockholm, Sweden.
OBJECTIVES: Health technology assessment increasingly demands complex statistical models - joint longitudinal-survival models, competing risks, multi-state frameworks, and Bayesian uncertainty quantification. However, the software landscape remains fragmented, forcing analysts to stitch together tools across estimation, prediction, and cost-effectiveness steps. We present the merlin ecosystem: a family of four integrated open-source commands (merlin, morgana, pendragon, avalon) available in both R and Stata that covers the full HEOR modelling pipeline within a single, coherent framework.
METHODS: merlin is a long-established maximum likelihood engine supporting parametric survival, relative survival, cure, competing risks, multi-state, and joint models across multilevel random-effects structures. morgana extends merlin with a Bayesian Metropolis-Hastings (Stata) or Hamiltonian Monte-Carlo (R) sampler, enabling prior incorporation and posterior uncertainty propagation. pendragon consumes merlin or morgana model fits to produce multi-state predictions, life-years, QALYs, costs, incremental cost-effectiveness ratios, cost-effectiveness planes, and acceptability curves, all with probabilistic sensitivity analysis. avalon simulates arbitrarily complex survival data including time-varying effects, recurrent events, and competing risks - supporting model validation. All commands are available in Stata and R with consistent syntax and cross-validated outputs. Claude Code (Anthropic) assisted in package development; all AI contributions were reviewed and approved by the author.
RESULTS: Using oncology case studies, we demonstrate the end-to-end workflow: fitting a cancer progression model in merlin, propagating Bayesian uncertainty through morgana, generating cost-effectiveness projections via pendragon, and validating structural assumptions through avalon simulation. The integrated pipeline eliminates manual data transfer between modelling steps, reduces errors, and produces fully reproducible outputs from a single analytical script.
CONCLUSIONS: The merlin ecosystem provides HTA analysts and health economists with a validated, dual-platform toolkit spanning the complete modelling workflow - from complex survival estimation to cost-effectiveness decision outputs. All software is open source and freely available at https://github.com/RedDoorAnalytics.
METHODS: merlin is a long-established maximum likelihood engine supporting parametric survival, relative survival, cure, competing risks, multi-state, and joint models across multilevel random-effects structures. morgana extends merlin with a Bayesian Metropolis-Hastings (Stata) or Hamiltonian Monte-Carlo (R) sampler, enabling prior incorporation and posterior uncertainty propagation. pendragon consumes merlin or morgana model fits to produce multi-state predictions, life-years, QALYs, costs, incremental cost-effectiveness ratios, cost-effectiveness planes, and acceptability curves, all with probabilistic sensitivity analysis. avalon simulates arbitrarily complex survival data including time-varying effects, recurrent events, and competing risks - supporting model validation. All commands are available in Stata and R with consistent syntax and cross-validated outputs. Claude Code (Anthropic) assisted in package development; all AI contributions were reviewed and approved by the author.
RESULTS: Using oncology case studies, we demonstrate the end-to-end workflow: fitting a cancer progression model in merlin, propagating Bayesian uncertainty through morgana, generating cost-effectiveness projections via pendragon, and validating structural assumptions through avalon simulation. The integrated pipeline eliminates manual data transfer between modelling steps, reduces errors, and produces fully reproducible outputs from a single analytical script.
CONCLUSIONS: The merlin ecosystem provides HTA analysts and health economists with a validated, dual-platform toolkit spanning the complete modelling workflow - from complex survival estimation to cost-effectiveness decision outputs. All software is open source and freely available at https://github.com/RedDoorAnalytics.
Conference/Value in Health Info
2026-11, ISPOR Europe 2026, Vienna, Austria
Value in Health, Volume 29, Issue 12S
Code
MSR88
Topic
Health Technology Assessment, Methodological & Statistical Research
Topic Subcategory
Artificial Intelligence, Machine Learning, Predictive Analytics
Disease
Oncology