zhusuan.diagnostics

effective_sample_size(samples, burn_in=100)

Compute the effective sample size of a chain of vector samples, using the algorithm in Stan. Users should flatten their samples as vectors if not so.

Parameters:
  • samples – A 2-D numpy array of shape (M, D), where M is the number of samples, and D is the number of dimensions of each sample.
  • burn_in – The number of discarded samples.
Returns:

A 1-D numpy array. The effective sample size.

effective_sample_size_1d(samples)

Compute the effective sample size of a chain of scalar samples.

Parameters:samples – A 1-D numpy array. The chain of samples.
Returns:A float. The effective sample size.