19
$\begingroup$

In Bayesian inference, one needs to determine the posterior distribution of the parameters from the prior distribution and the likelihood of the data. As this computation might not be possible analytically, simulation methods may be required.

In MCMC (Markov Chain Monte Carlo) algorithms, a Markov chain is generated, whose limit distribution is the desired posterior distribution. In practice, it might be difficult to assess whether convergence has been achieved. When you stop a Markov chain at a finite step, you do not have independent realizations, as each generated point depends on the previous ones. The thing is that, as the chain advances, such dependence will be lower and lower, and at infinity you would obtain independent realizations from the posterior.

Thus, let us assume that we have stopped the Markov chain at a finite step, and that the sample obtained has significant autocorrelation yet. We do not have independent draws from the posterior distribution. Thinning consists in picking separated points from the sample, at each $k$-th step. As we are separating the points from the Markov chain, the dependence becomes smaller and we achieve some sort of independent sample. But what I do not understand about this procedure is that, although we have an (approximately) independent sample, we are not still simulating from the posterior distribution; otherwise the whole sample would have present independence.

So in my view, thinning gives more independence, which is certainly necessary to approximate statistics via Monte Carlo simulation and the law of large numbers. But it does not accelerate the encounter with the posterior distribution. At least, I do not know any mathematical evidence about the latter fact. So, actually, we have gained nothing (apart from less storage and memory demand). Any insight on this issue would be appreciated.

$\endgroup$
2
  • 1
    $\begingroup$ I don't follow the reasoning behind this premise: "we are not still simulating from the posterior distribution; otherwise the whole sample would have present independence" -- why do you think dependence in successive iterates precludes sampling the joint posterior? $\endgroup$
    – Glen_b
    Dec 31, 2019 at 4:29
  • 1
    $\begingroup$ @Glen_b-ReinstateMonica Yes, you are right, I was totally confused. Thanks to all your comments and answers, I understand now. My professors and notes considered thinning to obtain i.i.d. samples, that is why I had the feeling that, at some large step, the Markov chain should reach an independence stage. But this is not true: there is dependence. I learned here that, due to the Ergodic Theorem, such dependence is not a problem, as the statistics of the posterior distribution can be estimated using the correlated sample. Low autocorrelation only implies faster convergence. $\endgroup$
    – user269666
    Dec 31, 2019 at 8:59

2 Answers 2

14
$\begingroup$

Thinning has nothing to do with Bayesian inference, but everything to do with computer-based pseudo-random simulation.

The whole point in generating a Markov chain $(\theta_t)$ via MCMC algorithms is to achieve more easily simulations from the posterior distribution, $\pi(\cdot)$. However, the penalty for doing so is creating correlation between the simulations. (With respect to the question, this correlation persists even asymptotically in $t$.) By subsampling or thinning out the Markov chain $(\theta_t)$, this correlation is usually (but not always) reduced as the thinning interval grows.

Thinning has however nothing to do with convergence of the Markov chain to the stationary distribution $\pi(\cdot)$ since it is a post-processing of the simulated Markov chain $(\theta_t)$. Thinning only makes sense once the chain is (approximately) stationary. Removing early values of the Markov chain to eliminate the impact of the starting value is called burning or warmup.

Note furthermore that thinning is rarely helpful when considering approximations of posterior expectations (by the Ergodic Theorem) $$\frac{1}{T}\sum_{t=}^T h(\theta_t) \longrightarrow \int h(\theta(\pi(\theta)\text{d}\theta$$ since using the entire (unthinned) chain most often reduces the variance of the approximation. If specific needs call for an almost iid sample from $\pi(\cdot)$, thinning may appeal, but except for specific situations where renewal can be implemented, there is no guarantee that the sample will be either "i" or "id"... The alternative solution of running several chains independently in parallel produces independent samples but again with rarely a guarantee that the points are exactly distributed from $\pi(\cdot)$.

$\endgroup$
5
  • $\begingroup$ Thank you for your answer. I would like to ask you some questions about your statements. You said: "It only makes sense once the chain is (approximately) stationary". Thinning is applied when there is autocorrelation. But if there exists autocorrelation, then the posterior distribution is not still encountered, otherwise the draws would already be independent. Hence, when thinning is applied, the posterior distribution has not been still reached. From my point of view, thinning does not help. The only option to reach the posterior distribution is to run the Markov chain more time. $\endgroup$
    – user269666
    Dec 30, 2019 at 15:41
  • $\begingroup$ On the other hand, you said "thinning is rarely helpful when considering approximations of posterior expectations as using the entire chain most often reduces the variance of the approximation". Yes, employing the entire chain reduces the variance of the approximation. But such approximation is correct only when the sampling points are independent, otherwise the law of large numbers does not apply. In this sense, thinning seems necessary. $\endgroup$
    – user269666
    Dec 30, 2019 at 15:41
  • 1
    $\begingroup$ I am afraid you are somewhat mistaken on the aspect of correlation within a Markov chain. It does not go away with more simulations, it does not show a lack of convergence, and the Law of Large Numbers still applies, under the name of Ergodic Theorem. $\endgroup$
    – Xi'an
    Dec 30, 2019 at 15:52
  • $\begingroup$ Ok, I understood more from your reference to such Ergodic Theorem (the sample statistics from a Markov chain tend to the corresponding statistics of the stationary distribution). Thank you very much. So, actually, the question would be: if the statistics can be approximated without requiring independence, what is thinning applied for? Is it needed for good approximations of densities, and not just statistics? $\endgroup$
    – user269666
    Dec 30, 2019 at 16:01
  • $\begingroup$ Another question :) Why is then autocorrelation used as a test of convergence? Why is it problematic to have significant autocorrelation? As you said, from the Ergodic Theorem, the statistics are well approximated in any case. $\endgroup$
    – user269666
    Dec 30, 2019 at 16:12
6
$\begingroup$

Thinning does not really work. On the contrary, without thinning you end up with more samples, and so, more precise estimates (Link and Eaton, 2012). Adding to great answer by Xi'an, nowadays thinning is rarely recommend as it doesn't help that much. You could use thinning if you want to reduce disk, or memory, usage by storing less samples, but that seems to be the greatest advantage.

Link, W. A., & Eaton, M. J. (2012). On thinning of chains in MCMC. Methods in ecology and evolution, 3(1), 112-115.

$\endgroup$
4
  • $\begingroup$ Thank you very much, I understand more now. Just a question. The Ergodic Theorem allows for estimating the posterior statistics (there is no need for independence). However, to estimate the posterior density, kernel methods require independence. Is it necessary thinning to obtain density estimates? $\endgroup$
    – user269666
    Dec 30, 2019 at 18:40
  • $\begingroup$ @user269666 thinning does not make samples independent. By removing some samples you reduce the autocorrelation at small lags, but still MCMC produces samples that are not independent. We usually treat those samples as if they were independent and this works well enough, for details check the literature on MCMC & Xi'an's answer. Thinning does not solve this problem, just sweeps it under the rug. $\endgroup$
    – Tim
    Dec 30, 2019 at 20:38
  • $\begingroup$ Ok, so thinning does not produce exactly independent samples, that is true. Then, I am wondering how one can estimate the posterior density function. The kernel methods I know assume i.i.d. samples. Are there density estimation methods for correlated samples? When one applies thinning to a model in WinBUGS, for instance, does the software consider the samples as independent and use a habitual kernel-based method? $\endgroup$
    – user269666
    Dec 30, 2019 at 21:22
  • $\begingroup$ @user269666 the real-life samples are not exactly independent as well. $\endgroup$
    – Tim
    Dec 30, 2019 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.