I have changed my MCMC sampler from Ensemble to Parallel-Tempered (in emcee) in order to get an estimate of the evidence integral.

In practice this requires setting n_temps the number of different temperatures to sample, so at the end of the run I have n_walkers$\times$n_temps chains of samples to examine where before I just had n_walkers.

  1. Using multiple temperatures is presented as a way to help in exploring multimodal distributions, but my distribution is not multimodal. How many temperatures should I use if my aim is only to get an estimate of the evidence integral using thermodynamic integration?

  2. If the answer to (1) is more than 1, then which temperature's chains should I use to infer posterior parameter distributions? Or should I just pool all of them?


As nobody has answered here are my findings, though obviously I'm happy to be corrected on any of this.

This paper (cited in this one) gives perhaps the simplest method of choosing the number of temperatures: increase n_temps until the swap acceptance fraction (available in emcee as sampler.tswap_acceptance_fraction) is uniformly around 20% across the entire range of temperatures. This helps the sampler converge on (hopefully all) the (major) peaks of the posterior distribution.

As to thermodynamic integration of the evidence, in my particular case it doesn't seem to matter much, so long as convergence is ok. In all of the following runs the walkers started from a random perturbation around the known peak, so convergence shouldn't be an issue:

n_temps=1 log evidence: -3811.848370 +- 0.000000
n_temps=2 log evidence: -3813.424253 +- 1.942768
n_temps=3 log evidence: -3814.931930 +- 1.022630 (tswap_acceptance_fraction around 20%)

So with n_temps=1 we don't have an estimate for standard error of the evidence integral, but it's still in the same ballpark. Whether these standard errors are small enough will depend on whether the difference in log evidence for the models I'm comparing is much bigger (I have yet to find out).

Regarding whether to pool multiple temperatures to estimate posterior distribution, or just take one. The emcee docs explain that as temperature increases the posterior tends towards the prior distribution. So that would imply we must sample posterior from the first chain only (with temperature 1).

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.