Marginal likelihood / model comparison in pystan


The marginal likelihood can be obtained using the R implementation of bridge sampling; how can I compute the marginal likelihood (or at least compare models with each other by computing the Bayes ratios) in pystan?

thanks a lot,

I am not aware of an implementation of bridge sampling in Python and wouldn’t be surprised if there wasn’t one. Also, bridge sampling is the best of many not great algorithms to calculate the marginal likelihood so be wary of any other approaches that you find. At least bridge sampling yields error estimates, but we often have to increase the number of iterations and / or choose different priors in order to get it to work decently in R. And then there is the M-closed assumption, which a lot of people around here do not like.

1 Like