Some tools for Bayesian Posterior Estimation

Below are some tools I’m familiar with as of 2023-04-07. Stan seems the most promising. I plan to come back and update this post in the future once I have finished a project.

Stan – a power tool for Bayesian probability models

Assuming you already want to sample from some posterior distribution… what tools are available? From what I have found, Stan and CmdStan seem to be the new standard for probabilistic programming used by statisticians. It’s very fast (compiled into C++), has a fairly user friendly syntax for specifying your model and priors, and can be integrated into your R, Python, Julia, or Matlab code easily through their wrapper libraries for those languages (or most other popular softwares in econ). In fact, because it compiles into an executable to sample from the posterior distribution, and can take a data file as input, you can integrate it into any programming language. If you’re doing large amounts of monte carlo sampling, it’s probably worth the speed up by including an external program.

Jim Savage gives an excellent introduction to Bayesian regression analysis for economists, including some intuition about why it’s useful. He first introduces the basic concepts and notation of Bayesian probability models, then provides some great examples of estimating these models utilizing the Stan probabilistic programming language. This is a great tutorial for both the clarity of exposition and the introduction to a very powerful tool used by many Bayesian statisticians.

Here’s a list of other tutorials/papers for using Stan, including videos!

If you have trouble installing Stan, I suggest trying to build the Stan tools from source. This sounds like you might need a degree in software development, but is actually much easier and guarantees that you have all the correct compilation tools on your computer.

Julia Libraries

MonteCarloMeasurements.jl — what I have the most experience with. Fairly easy to use and has some good plotting functions.

Turing.jl and DynamicPPL.jl have large development teams and seem to be up to date (based on most recent Git push). I have no experience with these yet, but Turing is referenced in many other probabilistic softwares as a good tool for modeling.

Gen.jl is a library in Julia syntax…. kind of. It has it’s own syntax for writing models that are inputs to it’s MCMC functions. It has many types of MCMC algorithms. Check out the Gen Ecosystem and Gen Tutorials.


Published by acwatt

PhD student at Berkeley Agricultural and Resource Economics. Research interests: energy, low-carbon transitions, climate change, exhaustible resource economics

Leave a comment