BGPLOT procedure
Produces plots for output and diagnostics from MCMC simulations (D.A. Murray).
Options
Parameter
Description
BGPLOT produces plots for output and diagnostics from Markov Chain Monte Carlo (MCMC) simulations. The procedure can be used after running a Bayesian MCMC analysis using BGXGENSTAT. Alternatively, data from CODA files produced by WinBUGS that are imported using BGIMPORT can be displayed using BGPLOT.
The data are supplied using the SIMULATIONS parameter as list of pointers, where each pointer contains the simulations and associated information for a Markov chain. The data for BGPLOT can be taken directly from the BGXGENSTAT or BGIMPORT procedures. The SIMULATIONS parameter corresponds to the SIMULATIONS parameters of BGXGENSTAT and BGIMPORT.
BGPLOT produces four types of plot which can be selected using the PLOT option. The ARRANGEMENT option controls whether the plots are each drawn on separate pages or four to a page in a two-by-two arrangement.
The trace setting of PLOT produces a trace plot for each monitored node, where every chain for the monitored nodes is superimposed on the same plot.
The density setting produces a kernel density smooth for each monitored node. The bandwidth for the density plot can be supplied using the BANDWIDTH option.
The autocorrelation setting generates an autocorrelation plot for each monitored node, where every chain for the monitored nodes is superimposed on the same plot. You can specify the maximum lag for which the autocorrelation is calculated using the MAXLAG option (default 50).
The gelmanrubin setting produces the Gelman-Rubin "Potential Scale Reduction Factor" (PSRF) diagnostic. The PSRF compares the between and within variances of multiple chains. BGPLOT produces a plot of the PSRF, and a second plot of the between and within variances. Convergence is assumed to occur when the PSRF is close to one, and the between and within variances stabilise around the same value. You can display the convergence diagnostic by setting option PRINT=summary. The method used for the diagnostic can be controlled using the GRMETHOD option. The gr setting uses the original Gelman-Rubin PSRF diagnostic, while the bgr setting uses the Gelman-Rubin-Brooks version, which interprets the diagnostic as a ratio of interval lengths rather than a variance ratio. The BINWIDTH option specifies the number of values in each bin of the Gelman-Rubin plot (default 50). Usually the first half of the observations is discarded in the Gelman-Rubin plot, but you can set option USEALLSAMPLES=yes to use them all.
Options: PRINT, PLOT, ARRANGEMENT, START, END, MAXLAG, BANDWIDTH, GRMETHOD, BINWIDTH, USEALLSAMPLES.
Parameter: SIMULATIONS.
Method
The autocorrelations are calculated using the CORRELATE directive and the densities are evaluated using the KERNELDENSITY procedure. Gelman & Rubin's diagnostic (1992) monitors convergence of MCMC output from parallel chains which each have different starting points that are overdispersed with respect to the target distribution. The details for the calculation of the potential scalar reduction factor (R) is described in Gelman & Rubin (1992). The Gelman-Rubin-Brooks diagnostic is an alternative method to the R statistic devised by Gelman & Rubin where R is calculated by the ratio of the central 80% width of the pooled intervals by the average central 80% width of the within intervals, see Brooks & Gelman (1998).
Action with
RESTRICT
Any data restrictions will be ignored.
References
Brooks, S.P. & Gelman, A. (1998). General Methods for Monitoring Convergence of Iterative Simulations. Journal of Computational and Graphical Statistics, 7, 434-455.
Gelman, A. & Rubin, D. (1992). Inference from Iterative Simulation Using Multiple Sequences. Statistical Science, 7, 457-511.