JuliaBUGS.jl is a modern, high-performance implementation of the BUGS probabilistic programming language in Julia. It brings the familiar BUGS modelling syntax into the Julia ecosystem, enabling Bayesian inference with speed, flexibility, and seamless integration with the scientific computing ecosystem in Julia.
-
BUGS syntax — write models using standard BUGS notation.
-
High performance — leverage Julia’s speed and just-in-time (JIT) compilation.
-
Interoperability with Julia ecosystem — works smoothly with MCMC algorithms from Turing.jl and the broader Julia PPL ecosystem.
A simple example model:
using JuliaBUGS, Random, AbstractMCMC
model = JuliaBUGS.@bugs"""
model {
for (i in 1:N) {
y[i] ~ dnorm(mu, tau)
}
mu ~ dnorm(0, 0.001)
tau ~ dgamma(0.1, 0.1)
}
"""
posterior = compile(model, (; N = 10, y = randn(10)))
rng, sampler = Random.MersenneTwister(123), JuliaBUGS.IndependentMH()
chain = AbstractMCMC.sample(rng, posterior, sampler, 1000)
For a complete walkthrough, see the example.
- DoodleBUGS — a browser-based interface for drawing BUGS models.
- RJuliaBUGS — an R interface to JuliaBUGS.