This course gives a practical introduction to Bayesian modelling with JAGS. It covers the core ideas of Bayesian inference, the structure of BUGS/JAGS model code, and how to fit, diagnose, and interpret Bayesian models from R. The practical focus is on models that are especially relevant for evidence synthesis, including missing-data handling, meta-analysis, IPD meta-analysis, and network meta-analysis.
The course contents are held at a graduate and PhD student level. It is assumed that you have some previous experience with R programming, statistical modelling, and meta-analysis.
📑 What the course covers
- Bayesian inference and basic notation
- BUGS/JAGS syntax and model structure
- A first regression model in JAGS
- Model diagnostics for MCMC output
- Missing data and multilevel multiple imputation
- Aggregate-data and IPD meta-analysis
- Network meta-analysis and more advanced extensions
✔️ How to prepare
Before the course, please prepare the following:
- R: make sure that you have R installed and running on your computer. Version 4.5.0 or higher is recommended.
- RStudio: during the course, RStudio will be used for the practicals. However, other IDEs such as VS Code or Positron can also be used.
- JAGS: please make sure to install JAGS before the course starts. JAGS is not a package for R, but a separate program that can be downloaded here. Make sure to select the correct operating system (Windows, Mac, or Linux), and follow the installation instructions.
- {rjags}: to run JAGS models from R, the
rjagspackage is required. After installing both JAGS andrjags, open and restart R, and runlibrary(rjags). If you receive a message in your console that a link to JAGS was found, you are good to go. - Required R packages: There are several other R packages that are required for the course. You can install them by running the code linked here. This script will install all the packages needed for the course, in case you do not have them yet.
- Working directory: please download the working directory .zip folder here and unzip on your computer. This folder contains all the scripts and data needed for the course.
📈 Models covered
- Multilevel multiple imputation (ML-MICE)
- Bayesian linear regression
- Random-effects meta-analysis for continuous outcomes
- Random-effects meta-analysis for binary outcomes
- IPD-AD meta-analysis for continuous outcomes
- IPD-AD meta-analysis for binary outcomes
- Network meta-analysis for continuous outcomes
- Network meta-analysis for binary outcomes
- Two-stage multivariate IPD network meta-analysis for continuous outcomes
- Two-stage multivariate IPD network meta-analysis for binary outcomes
- Component network meta-analysis for continuous outcomes
- Component network meta-analysis for binary outcomes
📦 Downloads
Course materials
- Course slides (PDF)
- Working directory .zip folder (scripts and data)
- data.xlsx — Main dataset used in Bayesian linear regression (01), random-effects meta-analysis (02, 03), and IPD-AD meta-analysis (04, 05). Excel workbook with one sheet per study.
- Imputation (ML-MICE) — Used in multilevel multiple imputation (00):
- imp.list.rda — Imputed data list for diagnostics and downstream models.
- implist.rda — Imputation list in {mitml} format.
- Component NMA (continuous) — Used in 10-ipd-component-nma.R:
- test-data.xlsx — Aggregate data.
- test-data-ipd.xlsx — IPD and AD sheets.
- Component NMA (binary) — Used in 11-ipd-component-nma-binary.R:
- test-data.xlsx — Aggregate data.
- test-data-ipd.xlsx — IPD and AD sheets.
📚 Recommended reading
- The BUGS Book: a practical reference for Bayesian modelling in BUGS/JAGS.
- Bayesian Data Analysis: a general introduction to Bayesian modelling.
- Individual Participant Data Meta-Analysis: recommended background reading for IPD methods.
- Doing Meta-Analysis with R: especially the chapters on Bayesian meta-analysis and network meta-analysis.