# Use only the last sample as the posterior in MCMC

I am new to statistics.

After an MCMC sampler warmed up, the posterior is better estimated as the mean of several samples. (e.g. related question: https://stats.stackexchange.com//questions/56077)

However, in my MCMC sampler, after it reaches the equilibrium (because $\hat{R}=1.0$ in Stan), samples of the parameters still present a fairly large STD. Do the large STD means that the chain hasn't converged yet, even if $\hat{R}=1.0$?

In this case, I do not want to use the mean of the parameter samples, but only use one sample (say the 1000th) of the parameters as the posterior. Is it the right way to do?

P.S. "The $\hat{R}$ statistic measures the ratio of the average variance of samples within each chain to the variance of the pooled samples across chains, if all chains are at equilibrium, these will be the same and $\hat{R}$ will be one" -- Stan Manual

## 1 Answer

Keep in mind that in Bayesian inference, you are looking at the entire range of values in the posterior, rather than point-estimate summaries. After convergence, MCMC samples are samples drawn from that posterior density. Using just the latest sample is the same as picking a random point from the posterior and using that as your sample estimate.

For an intuitive explanation of why this isn't great, imagine that your posterior is a standard normal distribution. The normal distribution has support over the whole real line, so drawing a random sample from the standard normal distribution could be any real number -- though, it will likely be within 2 units of zero. But if you're using MCMC, you likely don't know the distribution of the posterior, so the only information you have is just some value. You have no way to adjudge whether this value is "large" or "small" or "typical."

You would have more information if you had, say, 1000 draws from that posterior. You would know where the high- and low-density regions are. This is why people keep all of their posterior draws.

The fact that some individual parameter estimates have very large variance does not mean that the chains haven't converged -- it just means that there is a large amount of uncertainty about the posterior values of the parameter in the model given the data and the prior. This isn't necessarily bad -- some quantities are not precisely estimated. But perhaps your priors are too diffuse, or your model is not fitting the data well.

The key part from the definition of $\hat{R}$ is that this metric is a ratio of variance: we have evidence that the chain has converged to its stationary distribution because the ratio of variance in independent chains is roughly 1. The ratio can be 1 even if the variance is large in absolute terms.

• Thanks very much, this answer really helps! There is just one point I'm still a bit confused : $\hat{R}=1$ means samples of different chains have similar variances (but the absolute variance value could be large), so why we call such a state 'stationary'? I mean, can the absolute variance shrink if we continue sampling? Commented Aug 1, 2014 at 18:01
• Standard errors (due to MC sampling) will shrink, for the same reason that adding more respondents to a survey will shrink margin of error. But continuing to draw values from the posterior won't change the posterior variance. I think you're hung up on the idea that stationary means that there is a single, "correct" value. Bayesian inference is much more interested in parameters' variability, which is to say the posterior distribution.
– Sycorax
Commented Aug 1, 2014 at 18:56