MCMC Summary

class pints.MCMCSummary(chains, time=None, parameter_names=None)[source]

Calculates and prints key summaries of posterior samples and diagnostic quantities from MCMC chains.

These include the posterior mean, standard deviation, quantiles, rhat, effective sample size and (if running time is supplied) effective samples per second.

Parameters:
  • chains – An array or list of chains returned by an MCMC sampler.
  • time (float) – The time taken for the run, in seconds (optional).
  • parameter_names (sequence) – A list of parameter names (optional).

References

[1]“Inference from iterative simulation using multiple sequences”, A Gelman and D Rubin, 1992, Statistical Science.
[2](1, 2) “Bayesian data analysis”, 3rd edition, CRC Press., A Gelman et al., 2014.
chains()[source]

Returns posterior samples from all chains separately.

ess()[source]

Return the effective sample size for each parameter as defined in [2].

ess_per_second()[source]

Return the effective sample size (as defined in [2]) per second of run time for each parameter.

This is only defined if a run time was passed in at construction time, if no run time is known None is returned.

mean()[source]

Return the posterior means of all parameters.

quantiles()[source]

Return the 2.5%, 25%, 50%, 75% and 97.5% posterior quantiles.

rhat()[source]

Return Gelman and Rubin’s rhat value as defined in [1]. If a single chain is used, the chain is split into two halves and rhat is calculated using these two parts.

std()[source]

Return the posterior standard deviation of all parameters.

summary()[source]

Return a list of the parameter name, posterior mean, posterior std deviation, the 2.5%, 25%, 50%, 75% and 97.5% posterior quantiles, rhat, effective sample size (ess) and ess per second of run time.

time()[source]

Return the run time taken for sampling.