Department of Biomedical Engineering and Computational Science

MCMC Diagnostics for Matlab

Copyright (C) 1999 Simo Särkkä
Copyright (C) 2000-2004,2014 Aki Vehtari
Maintainer: Aki Vehtari


In 1999 Simo Särkkä implemented several Markov chain Monte Carlo (MCMC) convergence diagnostics in Matlab at Laboratory of Computational Engineering. Later Aki Vehtari added additonal functions, fixed bugs and improved the documentation.


This software is distributed under the GNU General Public Licence (version 2 or later); please refer to the file Licence.txt, included with the software, for details.


  • 2014-02-24: psrf.m and cpsrf.m use now the new method for computing the potential scale reduction as described in Bayesian Data Analysis, Third Edition. Chapman and Hall/CRC. Publisher's webpage for the book.
  • 2004-01-23: Added computation of effective number of samples and changed returned R to square-root definition in psrf.m, cpsrf.m, mpsrf.m, cmpsrf.m. Created new functions ipsrf.m and cipsrf.m implementing interval-based PSRF.
  • 2003-11-04: Added geyer_imse.m for those who do not have Optimization toolbox.




 Convergence diagnostics
   PSRF     - Gelman-Rubin Potential Scale Reduction Factor
   CPSRF    - Cumulative Potential Scale Reduction Factor
   MPSRF    - Multivariate Potential Scale Reduction Factor
   CMPSRF   - Cumulative Multivariate Potential Scale Reduction Factor
   IPSRF    - Interval-based Potential Scale Reduction Factor
   CIPSRF   - Cumulative Interval-based Potential Scale Reduction Factor
   KS       - Kolmogorov-Smirnov goodness-of-fit hypothesis test
   HAIR     - Brooks' hairiness convergence diagnostic
   CUSUM    - Yu-Mykland convergence diagnostic for MCMC
   SCORE    - Calculate score-function convergence diagnostic
   GBINIT   - Initial iterations for Gibbs iteration diagnostic
   GBITER   - Estimate number of additional Gibbs iterations

 Time series analysis
   ACORR      - Estimate autocorrelation function of time series
   ACORRTIME  - Estimate autocorrelation evolution of time series (simple)
   GEYER_ICSE - Compute autocorrelation time tau using Geyer's
                initial convex sequence estimator
                (requires Optimization toolbox)
   GEYER_IMSE - Compute autocorrelation time tau using Geyer's
                initial monotone sequence estimator

 Kernel density estimation etc.:
   KERNEL1  - 1D Kernel density estimation of data
   KERNELS  - Kernel density estimation of independent components of data
   KERNELP  - 1D Kernel density estimation, with automatic kernel width
   NDHIST   - Normalized histogram of N-dimensional data
   HPDI     - Estimates the Bayesian HPD intervals

 Manipulation of MCMC chains
   THIN     - Delete burn-in and thin in MCMC-chains
   JOIN     - Join similar structures of arrays to one structure of arrays

   CUSTATS  - Calculate cumulative statistics of data

See also