Autocorrelation¶

autocorrelation(x, axis=0)[source]

Computes the autocorrelation of samples at dimension axis.

Parameters: x (numpy.ndarray) – the input array. axis (int) – the dimension to calculate autocorrelation. autocorrelation of x. numpy.ndarray

Autocovariance¶

autocovariance(x, axis=0)[source]

Computes the autocovariance of samples at dimension axis.

Parameters: x (numpy.ndarray) – the input array. axis (int) – the dimension to calculate autocovariance. autocovariance of x. numpy.ndarray

Effective Sample Size¶

effective_sample_size(x)[source]

Computes effective sample size of input x, where the first dimension of x is chain dimension and the second dimension of x is draw dimension.

References:

1. Introduction to Markov Chain Monte Carlo, Charles J. Geyer
2. Stan Reference Manual version 2.18, Stan Development Team
Parameters: x (numpy.ndarray) – the input array. effective sample size of x. numpy.ndarray

Gelman Rubin¶

gelman_rubin(x)[source]

Computes R-hat over chains of samples x, where the first dimension of x is chain dimension and the second dimension of x is draw dimension. It is required that input.shape >= 2 and input.shape >= 2.

Parameters: x (numpy.ndarray) – the input array. R-hat of x. numpy.ndarray

Split Gelman Rubin¶

split_gelman_rubin(x)[source]

Computes split R-hat over chains of samples x, where the first dimension of x is chain dimension and the second dimension of x is draw dimension. It is required that input.shape >= 4.

Parameters: x (numpy.ndarray) – the input array. split R-hat of x. numpy.ndarray

HPDI¶

hpdi(x, prob=0.89, axis=0)[source]

Computes “highest posterior density interval” (HPDI) which is the narrowest interval with probability mass prob.

Parameters: x (numpy.ndarray) – the input array. prob (float) – the probability mass of samples within the interval. axis (int) – the dimension to calculate hpdi. quantiles of input at (1 - probs) / 2 and (1 + probs) / 2. numpy.ndarray

Summary¶

summary(samples, prob=0.89)[source]

Prints a summary table displaying diagnostics of samples from the posterior. The diagnostics displayed are mean, standard deviation, the 89% Credibility Interval, effective_sample_size() split_gelman_rubin().

Parameters: samples – a collection of input samples. prob (float) – the probability mass of samples within the HPDI interval.