TinyGibbs.jl

TinyGibbs is a small Gibbs sampler that makes use of the AbstractMCMC interface. It therefore allows for efficient Gibbs sampling including parallel sampling of multiple chains. Additionally, TinyGibbs can collect samples in two ways: (1) as a dictionary of tensors or (2) as a MCMCChains.Chains type. Therefore, all the funcionality of MCMCChains can be exploited with TinyGibbs.
Software
Author

Enrico Wegner

Published

April 7, 2023

While delving into VAR models, I observed that many Bayesian estimation methods depend heavily on Gibbs sampling. Despite the abundance of Bayesian libraries in Julia, I couldn’t find a Gibbs sampling library that met my preferences. What I was seeking was a library that allows one to design a sampler as described in academic papers. Specifically, I wanted a tool that abstracts away the computational complexities, enabling me to focus on the conditional distributions. Essentially, I desired a sampler that could translate a process like:

  1. Sample \(\alpha\) from \(p(\alpha | y, x, \Sigma)\)
  2. Sample \(\Sigma\) from \(p(\Sigma | y, x, \alpha)\)

into an operational sampler.

TinyGibbs is the solution to this need. TinyGibbs introduces a single macro, @tiny_gibbs, which converts code resembling academic pseudocode into a functioning sampler. Moreover, by leveraging the features offered by AbstractMCMC and MCMCChains, TinyGibbs supports parallel sampling and the diagnosis of MCMC chains.

For more details and to give it a try, visit the GitHub repository. Any feedback is greatly appreciated.