Markov chain Monte Carlo (MCMC) for Bayesian analysis in julia


Mamba: Markov chain Monte Carlo (MCMC) for Bayesian analysis in julia

julia 1.0: Docs Mamba Build Status
julia 0.6: Docs Mamba Build Status
julia 0.5: Docs Mamba Build Status
julia 0.4: Docs Mamba Build Status
julia 0.3: Docs Mamba Build Status


Mamba is an open platform for the implementation and application of MCMC methods to perform Bayesian analysis in julia. The package provides a framework for (1) specification of hierarchical models through stated relationships between data, parameters, and statistical distributions; (2) block-updating of parameters with samplers provided, defined by the user, or available from other packages; (3) execution of sampling schemes; and (4) posterior inference. It is intended to give users access to all levels of the design and implementation of MCMC simulators to particularly aid in the development of new methods.

Several software options are available for MCMC sampling of Bayesian models. Individuals who are primarily interested in data analysis, unconcerned with the details of MCMC, and have models that can be fit in JAGS, Stan, or OpenBUGS are encouraged to use those programs. Mamba is intended for individuals who wish to have access to lower-level MCMC tools, are knowledgeable of MCMC methodologies, and have experience, or wish to gain experience, with their application. The package also provides stand-alone convergence diagnostics and posterior inference tools, which are essential for the analysis of MCMC output regardless of the software used to generate it.


  • An interactive and extensible interface.
  • Support for a wide range of model and distributional specifications.
  • An environment in which all interactions with the software are made through a single, interpreted programming language.
    • Any julia operator, function, type, or package can be used for model specification.
    • Custom distributions and samplers can be written in julia to extend the package.
  • Directed acyclic graph representations of models.
  • Arbitrary blocking of model parameters and designation of block-specific samplers.
  • Samplers that can be used with the included simulation engine or apart from it, including
    • adaptive Metropolis within Gibbs and multivariate Metropolis,
    • approximate Bayesian computation,
    • binary,
    • Hamiltonian Monte Carlo (simple and No-U-Turn),
    • simplex, and
    • slice samplers.
  • Automatic parallel execution of parallel MCMC chains on multi-processor systems.
  • Restarting of chains.
  • Command-line access to all package functionality, including its simulation API.
  • Convergence diagnostics: Gelman, Rubin, and Brooks; Geweke; Heidelberger and Welch; Raftery and Lewis.
  • Posterior summaries: moments, quantiles, HPD, cross-covariance, autocorrelation, MCSE, ESS.
  • Gadfly plotting: trace, density, running mean, autocorrelation.
  • Importing of sampler output saved in the CODA file format.
  • Run-time performance on par with compiled MCMC software.

Getting Started

The following julia command will install the package:

julia> Pkg.add("Mamba")

See the Package Documentation for details and examples.

First Commit


Last Touched

10 days ago


1027 commits