Autocorrelation Analysis

Autocorrelation Analysis#

A good heuristic for assessing convergence of samplings is the integrated autocorrelation time. emcee includes tools for computing this and the autocorrelation function itself. More details can be found in Autocorrelation analysis & convergence.

emcee.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.

Parameters:
  • 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:

An estimate of the integrated autocorrelation time of

the time series x.

Return type:

float or array

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.

emcee.autocorr.function_1d(x)#

Estimate the normalized autocorrelation function of a 1-D series

Parameters:

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

Returns:

The autocorrelation function of the time series.

Return type:

array