Learn R Programming

LaplacesDemon (version 16.1.6)

Gelfand.Diagnostic: Gelfand's Convergence Diagnostic

Description

Gelfand et al. (1990) proposed a convergence diagnostic for Markov chains. The Gelfand.Diagnostic function is an interpretation of Gelfand's ``thick felt-tip pen'' MCMC convergence diagnostic. This diagnostic plots a series of kernel density plots at \(k\) intervals of cumulative samples. Given a vector of \(S\) samples from a marginal posterior distribution, \(\theta\), multiple kernel density lines are plotted together, where each includes samples from a different interval. It is assumed that burnin iterations have been discarded.

Gelfand et al. (1990) assert that convergence is violated when the plotted lines are farther apart than the width of a thick, felt-tip pen. This depends on the size of the plot, and, of course, the pen. The estimated width of a ``thick felt-tip pen'' is included as a black, vertical line. The pen in Gelfand.Diagnostic is included for historical reasons. This diagnostic requires numerous samples.

Usage

Gelfand.Diagnostic(x, k=3, pen=FALSE)

Arguments

x

This required argument is a vector of marginal posterior samples, such as selected from the output of LaplacesDemon.

k

This argument specifies the number \(k\) of kernel density plots given cumulative intervals of samples. This argument defaults to \(k=3\).

pen

Logical. This argument defaults to pen=FALSE. When pen=TRUE, the thick felt-tip pen is included as a black, vertical line.

Value

The Gelfand.Diagnostic returns a plot.

References

Gelfand, A.E., Hills, S., Racine-Poon, A., and Smith, A.F.M. (1990). "Illustration of Bayesian Inference in Normal Data Models Using Gibbs Sampling". Journal of the American Statistical Association, 85, p. 972--985.

See Also

burnin and LaplacesDemon.

Examples

Run this code
# NOT RUN {
library(LaplacesDemon)
x <- rnorm(1000)
Gelfand.Diagnostic(x)
# }

Run the code above in your browser using DataLab