running MCMC for too long…

Clifton observatory, Clifton, Sept. 24, 2012Here is an excerpt from an email I just received from a young astronomer with whom I have had many email exchanges about the nature and implementation of MCMC algorithms, not making my point apparently:

The acceptance ratio turn to be good if I used (imposed by me) smaller numbers of iterations. What I think I am doing wrong is the convergence criteria. I am not stopping when I should stop.

To which I replied he should come (or Skype) and talk with me as I cannot get into enough details to point out his analysis is wrong… It may be the case that the MCMC algorithm finds a first mode, explores its neighbourhood (hence a good acceptance rate and green signals for convergence), then wanders away, attracted by other modes. It may also be the case the code has mistakes. Anyway, you cannot stop a (basic) MCMC algorithm too late or let it run for too long! (Disclaimer: the picture of an observatory seen from across Brunel’s suspension bridge in Bristol is unrelated to the young astronomer!)

6 Responses to “running MCMC for too long…”

  1. Incidentally, Christian’s statement, that “…you cannot stop a (basic) MCMC algorithm too late or let it run for too long!”

    has at least two interpretations. One is the correct one: there is no such thing as running an MCMC algorithm for too long. The other is the one that fooled me into thinking I was doing something wrong by running my chains longer and longer: You should not run the algorithm for too long.

    I guess that for the majority of the audience of this blog, the wrong interpretation would not even arise as a possibility, but for a newcomer to MCMC like me, it left me burning cycles, especially given that the BADASS book by Gelman et al 2014 recommends just running the algorithm for longer if the chains don’t mix well (the Gelman-Rubin diagnostic). I was fooled into thinking that maybe there are some basic cases where one should not run it for too long…

  2. Dan Simpson Says:

    To follow on from a comment in a different thread, you can spin section 4 of this paper and ideas about floating point error to argue that you definitely shouldn’t run your MCMC chain for too long….

    If you’re outside the regime that Rosenthal etc considered in those 2 papers on this, you may not even have an ergodic chain (let alone a correct one.

    (This is, of course, somewhat of a straw-man)

  3. It might also be worth advertising here the ASAIP forum which includes a help board for astro-statistical questions:

  4. Radford Neal Says:

    You’re right in theory, of course. In practice, plenty of people define Bayesian models with improper priors for which the posterior is also improper. When they run MCMC for not too long, they may get what looks like a reasonable answer. But of course the chain will diverge to infinity (or other ridiculous point) if they run if for a long time….

    I think a simple program bug is probably the more likely explanation for the young astronomer’s problem, however.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.