# Why we need trace plot for MCMC results

I am reading research papers using MCMC methods and I see most of them provide trace plots. Why do we need trace plots in Monte Carlo Markov Chain? What does a trace plot of parameters indicate?

You create the parameter trace plots to make sure that your a priori distribution is well calibrated which is indicated by your parameters having sufficient state changes as the MCMC algorithm runs.

An extreme example is that you set your a priori distribution variance at 0. Then the posterior parameter estimate will never change. Your algorithm would say that you have the best parameter estimate, but it didn't check a sufficient number of parameters to determine if this truly is the best fit. If you set the a priori distribution variance too high, you get a similar problem. This is because the new parameter is less likely to be related to your data - so the log likelihood calculated with your new parameter is not likely to be better than the log likelihood using the old parameter. (An example is if your "true" parameter is 0.5 and your initial estimate is 2, but you are selecting from a normal distribution with a mean of 2 and a variance of 10,000 then you are unlikely to get a parameter that is closer to 1.5 than your initial estimate of 2.)

You need to select an a priori variance that allows your parameter states to change enough that you don't get stuck on local minimums and maximums in the loglikelihood distribution, but yet fine enough that you get reasonable parameter estimates. Most literature suggests you get your parameters to change states 40-60% of the time.

One other reason for the trace plots is burn in. Usually the burn in period is obvious in the plot (for example, if the true parameter is 1.5 and your initial estimate is 4 then you should see the parameter estimates moving quickly from 4 to 1.5 and then "bouncing" around 1.5). Typically, you just exclude the first n iterations where n is large enough that you are certain to have removed the burn in (say 1000), but if the calculations are time consuming or if your parameter estimates are taking much longer to converge than your n allows then you may want to omit more or less observations to account for burn in. You can check your plots to see where the burn in period ends to make sure that burn in is not affecting your results.

Note that I have been talking in context of parameter point estimates. If you are estimating parameter variance then ensuring that you have appropriate state changes is even more important.

• +1 But the other side of it is that we don't totally trust the formal convergence diagnostics and want to eyeball something before we claim it's converged. Whether this is entirely rational is another question... – conjugateprior Oct 21 '14 at 21:23
• Sorry to dig out this old post. But isn't the prior value (generated from the prior distribution) supposed to be irrelevant as long as there is a sufficient number of iterations? – mscnvrsy Sep 22 '16 at 8:59
• @mscnvrsy: you can put non-informative prior like Jeffry's prior or uniform prior if you want to provide less information to your prior. – Benzamin Apr 26 '17 at 15:01
• I completely disagree with the notion that MCMC trace plots are in any way related to calibrating a prior distribution. An MCMC algorithm aims at a given posterior distribution, irrelevant of the choice of the prior, and under proper conditions creates a Markov chain that converges to this stationary distribution. Looking at trace plots is only useful in assessing the convergence or lack thereof of the Markov chain. – Xi'an Jul 13 '17 at 7:34