Autocorrelation

We include a function to compute the integrated autocorrelation time of a time series. This is approximately the number of proposals required to get an independent sample.

This is code modified from emcee.autocorr to handle JAX.

hemcee.autocorr.integrated_time(x, c=5, tol=50, quiet=False, has_walkers=True)

Estimate the integrated autocorrelation time of a time series.

This estimate uses the iterative procedure described on page 16 of Sokal’s notes to determine a reasonable window size.

Args:
x (numpy.ndarray): The time series. If 2-dimensional, the array

dimesions are interpreted as (n_step, n_walker) unless has_walkers==False, in which case they are interpreted as (n_step, n_param). If 3-dimensional, the dimensions are interperted as (n_step, n_walker, n_param).

c (Optional[float]): The step size for the window search. (default:

5)

tol (Optional[float]): The minimum number of autocorrelation times

needed to trust the estimate. (default: 50)

quiet (Optional[bool]): This argument controls the behavior when the

chain is too short. If True, give a warning instead of raising an AutocorrError. (default: False)

has_walkers (Optional[bool]): Whether the last axis should be

interpreted as walkers or parameters if x has 2 dimensions. (default: True)

Returns:
float or array: An estimate of the integrated autocorrelation time of

the time series x.

Raises
AutocorrError: If the autocorrelation time can’t be reliably estimated

from the chain and quiet is False. This normally means that the chain is too short.

hemcee.autocorr.function_1d(x: Array) Array

Estimate the normalized autocorrelation function of a 1-D series

Args:

x: The series as a 1-D numpy array.

Returns:

array: The autocorrelation function of the time series.