Function vector_autocorr_tau (o2scl)

O2scl : Function List

template<class vec_t, class resize_vec_t>
size_t o2scl::vector_autocorr_tau(const vec_t &ac_vec, resize_vec_t &five_tau_over_M)

Use the Goodman method to compute the autocorrelation length.

Representing the lag-k correlation coefficient by \( \hat{C}(k) \), Goodman defines

\[ \hat{\tau}(M) = 1 + 2 \sum_{s=1}^{M} \frac{\hat{C}(k)}{\hat{C}(0)} \]
Then the autocorrelation length is the value of \( \hat{\tau}(M) \) for which
\[ 5 \hat{\tau}(M)/M \leq 1 \]

(See Goodman’s MCMC notes at https://www.math.nyu.edu/~goodman/teaching/MonteCarlo2005/notes/MCMC.pdf )

This function computes the value of \( 5 \hat{\tau}(M)/M \) and stores it in the five_tau_over_M vector and then returns the first value of \( M \) for which the vector is less than or equal to 1.0. If this function returns 0, then \( 5 \hat{\tau}(M)/M \) is greater than 1.0 for all \( M \), and this can be a sign that the autocorrelation length is too long to accurately resolve.

On completion, the vector five_tau_over_m will have one less element than the vector ac_vec .

Note that this method has limited accuracy for limited data set sizes. Also, it almost never reports a zero auto-correlation, even for completely uncorrelated data.