help mcmcconverge-------------------------------------------------------------------------------

Syntax

mcmcconvergevarlist[if] [in],iter(varname)chain(varname)saving(filename)[replace]

optionsDescription -------------------------------------------------------------------------iter(varname)variable identifying iterations of each Markov chainchain(varname)variable identifying independent Markov chainssaving(filename)location to save file of resultsreplaceoverwrite existing results file

Description

mcmcconvergeis a command for assessing the convergence of Markov chains in Markov Chain Monte Carlo (MCMC) estimation. It calculates the convergence statistics described in section 11.6 of Gelman et al. (2003).The command assumes that you begin with a dataset in memory containing sequences of draws from two or more Markov chains. The variable specified in the

chain()option should identify chains, and the variable specified in theiter()option should identify iterations within each chain. Each variable invarlistshould contain draws of a different scalar estimand. The data should be arranged as a panel in long form, wherechainidentifies panels anditeridentifies observations within panels. This panel is required to be balanced after any restrictions specified in theif/inoption are applied.The command saves results in the file specified by

saving(filename). Each observation in the results file corresponds to a different scalar estimand. Each variable in the results file contains a different convergence statistic.The convergence statistics are:

BThe between-sequence variance.WThe within-sequence variance.varplusThe marginal posterior variance of the estimand.RhatThe potential scale reduction from further simulations; convergence is achieved whenRhatis near 1.neffThe effective number of independent draws.neffminmin(neffmin,mn), wheremis the number of chains andnis the number of iterations per chain.

AuthorSam Schulhofer-Wohl, Federal Reserve Bank of Minneapolis, sschulh1.work@gmail.com. The views expressed herein are those of the author and not necessarily those of the Federal Reserve Bank of Minneapolis or the Federal Reserve System.

ReferenceGelman, Andrew, John B. Carlin, Hal S. Stern and Donald B. Rubin, 2003.

Bayesian Data Analysis,2nd ed. New York: Chapman & Hall.