Simple package for Bayesian model comparison.
Given samples from a posterior distribution inferred under some default prior, compute the Bayes factor or odds in favour of a new prior model.
pip install popodds
The package consists of the ModelComparison class to compute Bayes factors, and a wrapper function log_odds for simplicity.
The computation only requires a few ingredients:
modela new prior model or samples from it,priorthe original parameter estimation prior or samples from itsamplessamples from a parameter estimation run.
Optional:
model_boundsparameter bounds for the new prior model,prior_boundsparameter bounds for the original prior model,logcompute probability densities in log space,prior_oddsodds between the prior models, which defaults to unity,second_modelmodel to compute odds against instead of prior,second_boundsparameter bounds for the second model,detectablecompare between detectable rather than intrinsic populations.