PyMC BMA Example?


I am unable to find BMA examples for PyMC; only ‘alternative’ methods. Not sure if this was intentional or I am just looking in the wrong places. I am aware of it’s limitations as noted in the PyMC documentation. Could someone please point me in the right direction?


Have you reviewed the model averaging notebook? If so, what specifically were you looking for that wasn’t there?

I have. The model averaging notebook is what begged the question. It states:

“Bayesian models can be weighted by their marginal likelihood, this is known as Bayesian Model Averaging. While this is theoretically appealing, is problematic in practice: on the one hand the marginal likelihood is highly sensible to the specification of the prior, in a way that parameter estimation is not, and on the other computing the marginal likelihood is usually a challenging task.”

I haven’t found PyMC examples using marginal likelihood weighting (BMA)–unless I missed them. I have found a few examples for the alternative methods, e.g., stacking.

In that case, you can take a look at the Bayes factor notebook. It presents a toy problem, but uses a hierarchical “meta-model” in which candidate models are nested beneath a simple indicator parameter. From my own use of such models (also toy problems and for illustration purposes only), my guess is that it’s likely to also illustrate how difficult the sampling is.

I was just looking at that :slight_smile: Thanks for the help and the quick reply.

1 Like