Skip to main content

Tools for Bayesian inference using Ensemble MCMC

Project description

Collection of tools for Bayesian inference using DIME MCMC

This provides the Differential-Independence Mixture Ensemble (DIME) proposal together with a nice set of statistical tools for Bayesian analysis. DIME MCMC (previously ADEMC) is developed in Ensemble MCMC Sampling for DSGE Models. (Gregor Boehl, 2022, CRC 224 discussion paper series).

The sampler has a series of advantages over conventional samplers:

  1. At core, DIME MCMC is a (very fast) global multi-start optimizer that converges to the posterior distribution. This makes any posterior mode density maximization prior to MCMC sampling superfluous.

  2. The DIME sampler is pretty robust for odd shaped, bimodal distributions.

  3. DIME MCMC is parallelizable: many chains can run in parallel, and the necessary number of draws decreases almost one-to-one with the number of chains.

  4. DIME proposals are generated from an endogenous and adaptive proposal distribution, thereby reducing the number of necessary meta-parameters and providing close-to-optimal proposal distributions.

Installation

Installing the repository version from PyPi is as simple as:

pip install emcwrap

There exists a complementary stand-alone implementation in Julia language.

Usage

The proposal can be used directly as a drop-in replacement for emcee:

import emcee
from emcwrap import DIMEMove

move = DIMEMove(aimh_prob=.1, df_proposal_dist=10)

...
# define your density function, number of chains etc...
...

sampler = emcee.EnsembleSampler(nchain, ndim, log_prob, moves=move)
...
# off you go sampling

The rest of the usage is hence analoge to Emcee, see e.g. this tutorial. The parameters specific to the ADEMove are documented here.

The provided tools for Bayesian analysis are ready-to-use, but largely undocumented. Find the module documentation here: https://emcwrap.readthedocs.io/en/latest/modules.html

References

@techreport{boehl2022mcmc,
title         = {Ensemble MCMC Sampling for DSGE Models},
author        = {Boehl, Gregor},
year          = 2022,
institution   = {CRC224 discussion paper series}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

emcwrap-0.1.5.tar.gz (19.5 kB view hashes)

Uploaded Source

Built Distribution

emcwrap-0.1.5-py3-none-any.whl (17.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page