autocorrelation_plot

autocorrelation_plot(posteriors: dict, max_lags: int = 30) None

Plots the auto-correlation for each Markov chain for each regression variable. The plot shows the auto-correlation trend from lag 0 (when auto-correlation is always 1) up to max_lags. The plot layout has number of rows equal to the number of regression variables and a number of columns equal to the number of chains.

Parameters

posteriorsdict

Posterior samples. Posteriors and relative samples are key-value pairs. Each sample is a numpy.ndarray with a number of rows equal to the number of iterations and a number of columns equal to the number of Markov chains.

max_lagsint, optional

Maximum number of lags to which compute the auto-correlation. The default is 30.

Raises

TypeError
  • If posteriors is not a dict,

  • if a posterior sample is not a numpy.ndarray,

  • if max_lags is not a int.

KeyError

If posteriors does not contain intercept key.

ValueError
  • If a posterior sample is an empty numpy.ndarray,

  • if max_lags is less or equal to 0.

See Also

baypy.diagnostics.functions.autocorrelation_summary() baypy.diagnostics.functions.effective_sample_size()