[Paper Review] MetaStan: An R package for Bayesian (model-based) meta-analysis using Stan
MetaStan is an R package that enables Bayesian (model-based) meta-analysis using Stan's efficient Hamiltonian Monte Carlo sampling. It supports pairwise meta-analysis, meta-regression, and model-based meta-analysis for continuous, binary, and count outcomes via a generalized linear mixed model framework with flexible prior distributions and convergence diagnostics.
Meta-analysis methods are used to combine evidence from multiple studies. Meta-regression as well as model-based meta-analysis are extensions of standard pairwise meta-analysis in which information about study-level covariates and (arm-level) dosing amount or exposure may be taken into account. A Bayesian approach to inference is very attractive in this context, especially when a meta-analysis is based on few studies only or rare events. In this article, we present the R package MetaStan which implements a wide range of pairwise and model-based meta-analysis models. A generalised linear mixed model (GLMM) framework is used to describe the pairwise meta-analysis, meta-regression and model-based meta-analysis models. Within the GLMM framework, the likelihood and link functions are adapted to reflect the nature of the data. For example, a binomial likelihood with a logit link is used to perform a meta-analysis based on datasets with dichotomous endpoints. Bayesian computations are conducted using Stan via the rstan interface. Stan uses a Hamiltonian Monte Carlo sampler which belongs to the family of Markov chain Monte Carlo methods. Stan implementations are done by using suitable parametrizations to ease computations. The user-friendly R package MetaStan, available on CRAN, supports a wide range of pairwise and model-based meta-analysis models. MetaStan provides fitting functions for pairwise meta-analysis with the option of including covariates and model-based meta-analysis. The supported outcome types are continuous, binary, and count. Forest plots for the pairwise meta-analysis and dose-response plots for the model-based meta-analysis can be obtained from the package. The use of MetaStan is demonstrated through clinical examples.
Motivation & Objective
- To provide a user-friendly R package for Bayesian meta-analysis that supports a wide range of models including pairwise meta-analysis, meta-regression, and model-based meta-analysis.
- To implement efficient Bayesian inference using Stan’s Hamiltonian Monte Carlo sampler, improving computational performance over older MCMC methods.
- To address challenges in sparse data or few-study meta-analyses by incorporating weakly informative priors and non-centered parameterization.
- To enable visualization of results through forest plots (pairwise) and dose-response plots (model-based meta-analysis).
- To offer a flexible, extensible framework for meta-analysis with support for various likelihood and link functions across different outcome types.
Proposed method
- Uses a generalized linear mixed model (GLMM) framework to model pairwise meta-analysis, meta-regression, and model-based meta-analysis.
- Employs Stan’s Hamiltonian Monte Carlo (HMC) sampler via the rstan interface for efficient posterior computation.
- Applies non-centered parameterization by default in sparse settings (e.g., few studies) to improve MCMC mixing and convergence.
- Supports multiple likelihood functions: binomial (logit link) for binary outcomes, normal (identity link) for continuous, and Poisson (log link) for count data.
- Allows specification of weakly informative priors for fixed effects (normal) and heterogeneity (half-normal, Cauchy, uniform) to stabilize inference.
- Provides built-in functions for convergence diagnostics (e.g., R-hat, effective sample size) and visualization (forest_plot, dose-response plots).
Experimental results
Research questions
- RQ1How can Bayesian meta-analysis be efficiently implemented for diverse outcome types (continuous, binary, count) using modern MCMC sampling?
- RQ2What impact does non-centered parameterization have on MCMC convergence in low-sample-size meta-analyses?
- RQ3How do weakly informative priors improve estimation stability in sparse or rare-event settings?
- RQ4Can a unified R package effectively support both standard pairwise meta-analysis and model-based meta-analysis with dose-response modeling?
- RQ5How does the performance of Stan-based HMC compare to Gibbs or Metropolis-Hastings samplers in complex meta-analytic models?
Key findings
- MetaStan successfully implements Bayesian pairwise meta-analysis, meta-regression, and model-based meta-analysis using Stan’s HMC sampler with high computational efficiency.
- The use of non-centered parameterization in the topiramate dataset (6 studies) improved MCMC convergence, with R-hat values close to 1 and effective sample sizes exceeding 3,200.
- Posterior estimates for the log-odds ratio (θ) had a mean of 2.65 with a 95% credible interval of [2.15, 3.14], indicating a strong treatment effect.
- Heterogeneity standard deviation (τ) had a posterior mean of 0.26 and a 95% credible interval of [0.21, 0.66], suggesting moderate between-study variability.
- The package provides reliable convergence diagnostics, including R-hat < 1.05 and effective sample sizes > 3,200, supporting robust inference.
- Forest plots and dose-response visualizations generated by MetaStan effectively summarize results, enhancing interpretability for clinical and methodological applications.
Better researchstarts right now
From reading papers to final review, dramatically reduce your research time.
No credit card · Free plan available
This review was created by AI and reviewed by human editors.