A comprehensive R pipeline implementing Bayesian network meta-analysis for health technology assessment, comparing six treatments across ten published studies in advanced non-small cell lung cancer (NSCLC).
Mirrors the indirect treatment comparison methodology required in NICE Single Technology Appraisals when multiple treatments exist but not all have been directly compared in head-to-head randomised controlled trials.
When a new treatment is assessed by NICE, it often needs to be compared not just to the direct comparator in its pivotal trial, but to all relevant alternatives. Where head-to-head trials do not exist, NMA allows indirect comparison by chaining evidence through common comparators — producing a unified evidence synthesis across the entire treatment landscape.
Six treatments compared across 10 published studies (simulated evidence base modelled on the advanced NSCLC immunotherapy landscape):
| Code | Treatment |
|---|---|
| A — Chemotherapy | Reference arm (platinum doublet) |
| B — Nivolumab mono | PD-1 checkpoint inhibitor monotherapy |
| C — Pembrolizumab mono | PD-1 checkpoint inhibitor monotherapy |
| D — Durvalumab + Chemo | Immunochemotherapy combination |
| E — Osimertinib | EGFR-targeted therapy |
| F — Pembrolizumab + Chemo | Immunochemotherapy combination |
| Method | Description |
|---|---|
| Network plot | Evidence map showing direct comparisons and study counts |
| Fixed effects NMA | Assumes homogeneous true treatment effects |
| Random effects NMA | Allows between-study heterogeneity (tau) |
| DIC model selection | Deviance Information Criterion for model comparison |
| Gelman-Rubin R-hat | MCMC convergence diagnostics |
| Pairwise HRs | All treatments vs reference with 95% CrI |
| League table | Full all-vs-all pairwise HR matrix |
| SUCRA rankings | Surface Under Cumulative Ranking — treatment hierarchy |
| Node-splitting | Direct vs indirect evidence consistency test |
| Heterogeneity (tau) | Between-study SD from random effects model |
| File | Description |
|---|---|
output/network_plot.png |
Evidence network diagram |
output/pairwise_forest_plot.png |
HRs vs chemotherapy, forest plot |
output/sucra_plot.png |
SUCRA ranking bar chart |
output/league_table.csv |
All-vs-all pairwise HR table |
output/pairwise_hrs.csv |
HRs vs reference with CrI |
output/sucra_rankings.csv |
SUCRA values per treatment |
output/model_fit.csv |
DIC comparison FE vs RE |
output/consistency_check.csv |
Node-split p-values |
output/heterogeneity.csv |
Tau estimate and CrI |
Step 1 — Install JAGS (required) 👉 https://sourceforge.net/projects/mcmc-jags/
Step 2 — Install R packages
install.packages(c("gemtc", "rjags", "ggplot2",
"dplyr", "tidyr", "reshape2", "scales"))Step 3 — Run analysis
source("nma_analysis.R")MCMC sampling takes approximately 5-10 minutes.
Model: Bayesian consistency model (Dias et al. 2013 framework) implemented via gemtc with JAGS backend
Likelihood: Normal (log-HR scale)
Priors:
- Treatment effects: N(0, 100²) — vague
- Heterogeneity (RE): Half-normal(0, 0.5²) — weakly informative
MCMC: 4 chains, 50,000 iterations, 5,000 burn-in, thinning = 10
SUCRA: Probability of being ranked best, second-best, etc., summarised as area under the cumulative ranking curve (Salanti 2011)
Consistency: Node-splitting (Dias 2010) — tests whether direct and indirect evidence are in statistical agreement
This pipeline implements all components required in a NICE STA NMA:
- Fixed and random effects models with DIC-based selection
- Full pairwise league table with credible intervals
- SUCRA treatment ranking for decision support
- Consistency assessment as required by NICE DSU TSD 2
- Heterogeneity estimation and reporting
- Dias S, et al. (2013). NICE DSU TSD 2: A generalised linear modelling framework for pairwise and NMA of randomised controlled trials.
- Salanti G, et al. (2011). Graphical methods and numerical summaries for NMA. J Clin Epidemiol, 64(2):163-71.
- Higgins JPT, Whitehead A. (1996). Borrowing strength from external trials in a meta-analysis. Stat Med, 15:2733-49.
gemtc # Bayesian NMA framework
rjags # JAGS interface for MCMC sampling
ggplot2 # Visualisation
dplyr # Data manipulation
scales # Plot utilitiesAtrija Haldar LinkedIn MSc Engineering, Technology and Business Management — University of Leeds