Skip to main content
QUICK REVIEW

[Paper Review] JAGS, NIMBLE, Stan: a detailed comparison among Bayesian MCMC software

Mario Beraha, Daniele Falco|arXiv (Cornell University)|Jul 20, 2021
Markov Chains and Monte Carlo MethodsMathematics44 references10 citations
TL;DR

This paper provides a comprehensive, empirical comparison of JAGS, NIMBLE, and Stan—three leading Bayesian MCMC software platforms—evaluating their performance across diverse models, priors, and data-generating mechanisms. The study finds that Stan excels in efficiency and sample quality for non-conjugate models like logistic regression and AFT models, while JAGS is optimal for conjugate linear models and NIMBLE is most efficient for mixture models.

ABSTRACT

The aim of this work is the comparison of the performance of the three popular software platforms JAGS, NIMBLE and Stan. These probabilistic programming languages are able to automatically generate samples from the posterior distribution of interest using MCMC algorithms, starting from the specification of a Bayesian model, i.e. the likelihood and the prior. The final goal is to present a detailed analysis of their strengths and weaknesses to statisticians or applied scientists. In this way, we wish to contribute to make them fully aware of the pros and cons of this software. We carry out a systematic comparison of the three platforms on a wide class of models, prior distributions, and data generating mechanisms. Our extensive simulation studies evaluate the quality of the MCMC chains produced, the efficiency of the software and the goodness of fit of the output. We also consider the efficiency of the parallelization made by the three platforms.

Motivation & Objective

  • To systematically evaluate the performance, convergence, and efficiency of JAGS, NIMBLE, and Stan across a broad range of Bayesian models.
  • To identify the strengths and weaknesses of each software platform in terms of MCMC chain quality, sampling speed, and parallelization efficiency.
  • To guide applied statisticians and methodological researchers in selecting the most appropriate software for specific modeling tasks.
  • To provide a robust, data-driven benchmark based on repeated simulations across multiple model classes and prior distributions.
  • To offer practical recommendations for software selection based on model type, prior structure, and computational efficiency.

Proposed method

  • Conducting extensive simulation studies across five model classes: linear models (with conjugate and lasso priors), logistic regression, accelerated failure time (AFT) models, and finite mixture models.
  • Using identical model specifications and MCMC configurations (e.g., number of iterations, burn-in, thinning) across all three platforms to ensure fair comparison.
  • Evaluating MCMC performance using key diagnostics: effective sample size (ESS), potential scale reduction factor (R-hat), and sampling speed (samples per second).
  • Repeating simulations 20–50 times per model to ensure robustness and assess variability in performance across different data realizations.
  • Measuring computational efficiency via time-normalized effective sample size (ess/Ns) and sampling rate (samples per second).
  • Assessing parallelization efficiency by comparing performance across multi-core environments, where supported by each platform.

Experimental results

Research questions

  • RQ1Which software platform produces the most efficient MCMC chains (highest ESS) for conjugate linear models with normal priors?
  • RQ2How do JAGS, NIMBLE, and Stan compare in terms of sampling speed and chain autocorrelation for logistic regression models under normal priors?
  • RQ3What is the relative performance of the three platforms in handling complex models such as accelerated failure time (AFT) models with non-hierarchical priors?
  • RQ4How does the choice of prior (e.g., lasso vs. conjugate) affect the relative efficiency and convergence of each software platform?
  • RQ5In what scenarios does NIMBLE outperform JAGS and Stan, particularly in models with latent mixture structures?

Key findings

  • For linear models with conjugate priors, JAGS and Stan produce high-quality MCMC chains with high effective sample sizes (ESS), while NIMBLE generates highly autocorrelated chains.
  • JAGS is the fastest in terms of raw sampling speed (around 900 samples per second) for conjugate linear models, but NIMBLE is significantly slower (around 2500 samples per second) and produces less efficient chains.
  • For logistic regression models under normal priors, Stan achieves 55–90% ESS efficiency, while JAGS and NIMBLE achieve less than 30%, indicating superior mixing and lower autocorrelation in Stan’s chains.
  • Stan is faster than JAGS and NIMBLE for logistic regression (400 vs. 35 and 240 samples per second), making it the most efficient overall for this class of models.
  • For linear models under the lasso prior, JAGS is impractically slow and not recommended; Stan produces less autocorrelated chains than NIMBLE and is faster, making it the preferred choice.
  • For finite mixture models, NIMBLE is the most efficient, generating around 400 samples per second, significantly outpacing JAGS (120) and Stan (120), and producing the best balance of speed and ESS quality.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.