# What is the best method for checking convergence in MCMC?

What is your preferred method of checking for convergence when using Markov chain Monte Carlo for Bayesian inference, and why?

• – David LeBauer Mar 23 '12 at 2:17

I use the Gelman-Rubin convergence diagnostic as well. A potential problem with Gelman-Rubin is that it may mis-diagnose convergence if the shrink factor happens to be close to 1 by chance, in which case you can use a Gelman-Rubin-Brooks plot. See the "General Methods for Monitoring Convergence of Iterative Simulations" paper for details. This is supported in the coda package in R (for "Output analysis and diagnostics for Markov Chain Monte Carlo simulations"). coda also includes other functions (such as the Geweke’s convergence diagnostic).

You can also have a look at "boa: An R Package for MCMC Output Convergence Assessment and Posterior Inference".

Rather than using the Gelman-Rubin statistic, which is a nice aid but not perfect (as with all convergence diagnostics), I simply use the same idea and plot the results for a visual graphical assessment. In almost all cases I have considered (which is a very large number), graphing the trace plots of multiple MCMC chains started from widely varied starting positions is sufficient to show or assess whether the same posterior is being converged to or not, in each case. I use this method to:

1. Whether the MCMC chain (ever) converges
2. Assess how long I should set the burn-in period
3. To calculate Gelman's R statistic (see Gelman, Carlin, Stern and Rubin, Bayesian Data Analysis) to measure the efficiency and speed of mixing in the MCMC sampler.

Efficiency and convergence are slightly different issues: e.g. you can have convergence with very low efficiency (i.e. thus requiring long chains to converge). I have used this graphical method to successfully diagnose (and later correct) lack of convergence problems in specific and general situations.

This is a wee late into the debate, but we have a whole chapter in our 2007 book Introducing Monte Carlo Methods with R dealing with this issue. You can also download the CODA package from CRAN to this effect.

I like to do trace plots primarily and sometimes I use the Gelman-Rubin convergence diagnostic.