Markov chain monte carlo accuracy¶
Samples produces by MCMC are autocorrelated, and this reduces their information content relative to independent or perfect samples, we can quantify this as follows:
Suppose we want to estimate the mean of \(f(x)\) for some function \(f\), where \(X \sim p()\). The true mean is:
A Monte Carlo estimate is given by:
\(f_s \triangleq f(x_s)\)
\(x_s \sim p(x)\)
An MCMC estiamte of the variance of this estimate is given by:
The first term is the Monte Carlo estimate of variance if the samples weren’t correlated, and the second term depends on the correlation of the samples. We can measure this as follows.
Define the sample-based autocorrelation at lag t of a set of samples \(f_1, \cdots, f_S\) as follows:
This is called the autocorrelation function.
A simple method to reduce autocorrelation is to use thinning, in which we keep every n’th sample. This one however does not increase the efficiency of the underlying sampler, but it does save space, sicne it avoids storing higly correlated samples.
We can measure the information content of a set of samples by computing the effective sample size (ESS):