Wednesday, October 5, 2011

If chains are converged, is autocorrelation okay?


From time to time I've been asked whether autocorrelation in MCMC chains is okay if the chains are converged, as indicated by the BGR statistic being close to 1.0. The answer is: No. Autocorrelation in the chains implies that the MCMC sample is clumpy. A clumpy sample is not representative of a smooth distribution.

Here is an example of a case in which the BGR statistic is nicely behaved near 1.0, but there is still notable autocorrelation. It arises from doing multiple linear regression (see Fig. 17.4, p. 458 of the book) on two predictors that are highly correlated. The regression coefficients are denoted b[1] and b[2]. Here are chains that have no thinning:
Notice that the BGR is at 1.0 throughout, but the ACF has notable autocorrelation.

There is a separate question of how much autocorrelation can be tolerated. This depends on the particular parameterization and the summary measure of the MCMC sample that is being considered. But all of that worrying can be avoided if it is easy to thin the chain and get rid of autocorrelation, as it is in the example above.

If mere thinning doesn't do the trick (because the MCMC sampling takes a long time), then sometimes transforming the data can help (see the book, e.g., p. 459). Otherwise, reparameterizing is the usual way to go. You can actually change the model, or sometimes you can transform the parameters after they've been sampled and the transformed versions aren't autocorrelated (e.g., this blog post regarding Bayesian ANOVA).

5 comments:

  1. Dear John

    Autocorrelation is in general inevitable when M-H algorithm is used because the acceptance ratio is usually moderate at best. It is also inevitable when using Gibbs on poorly behaved posteriors. Reparametrization can sometimes help in such situations, but it is rare for reparametrization to help significantly. When all else fails people often resort to thinning. I have no idea why they do it.

    Isn't that the case that thinning does not solve the autocorrelation problem but merely hides it under the rug? Do you know of any paper exploring rigorously the sample-size-after-thinning vs autocorrelation tradeof?

    ReplyDelete
  2. I think that thinning does solve the autocorrelation problem (after all, the autocorrelation is reduced). But it might not solve the problem very efficiently. I haven't searched for articles that explore thinning-efficiency tradeoffs, but they must exist. I suspect that the trade-off is very model-specific, and so it would be challenging to make very general conclusions. Probably just the sort of challenge that someone has tackled...

    ReplyDelete
  3. Dear John

    After googling it for a while I came across this paper by William A. Link and Mitchell J. Eaton:

    http://onlinelibrary.wiley.com/doi/10.1111/j.2041-210X.2011.00131.x/abstract

    Among other things authors state that:

    "Thinning is often unnecessary and always inefficient, reducing the precision with which features of the Markov chain are summarised. The inefficiency of thinning MCMC output has been known since the early 1990’s, long before MCMC appeared in ecological publications."

    So it appears that the issue was allready solved a long time ago.

    borys.paulewicz@gmail.com

    ReplyDelete
  4. Thanks very much for the lead to the article. I've requested it from my library and I look forward to reading it!

    ReplyDelete