Autocorrelation time

The autocorrelation time of a series of samples can be approximated, in the large \(N\) limit, by :

\[\tau_b = \frac{1}{2}\left(\frac{b \tilde{\sigma}_b^2}{\mathrm{Var}X}- 1\right)\]

where \(b\) is bin size, \(\tilde{\sigma}_b^2\) the variance of the binned series, \(\mathrm{Var}X\) is the variance of the random variable \(X\), which is well approximated by the variance of the series \(\sigma^2\), so that the autocorrelation time may be computed as:

\[\bar{\tau} = \sum_{b>b_c} \frac{1}{2}\left(\frac{b \tilde{\sigma}_b^2}{\sigma^2} - 1\right)\]

where \(b_c\) is chosen large enough so that \(\tau_b\) is constant as a function of \(b\).

Synopsis

autocorrelation_time_from_binning(T observable)
  • observable: object with Observable concept

returns the autocorrelation time.

autocorrelation_time(T observable)
  • observable: object with Observable concept

returns the autocorrelation time computed from the autocorrelation function (slow).

Example

#include <triqs/statistics.hpp>
#include <triqs/mc_tools/random_generator.hpp>
using namespace triqs::statistics;
int main() {
  observable<double> A;
  triqs::mc_tools::random_generator RND;
  for (int i = 0; i < 2000; i++) A << RND(1.0);
  std::cout << autocorrelation_time_from_binning(A) << std::endl;
  std::cout << autocorrelation_time(A) << std::endl;
  return 0;
}