gelman.diag {coda}  R Documentation 
The ‘potential scale reduction factor’ is calculated for each variable in
x
, together with upper and lower confidence limits. Approximate
convergence is diagnosed when the upper limit is close to 1. For
multivariate chains, a multivariate value is calculated that bounds
above the potential scale reduction factor for any linear combination
of the (possibly transformed) variables.
The confidence limits are based on the assumption that the stationary distribution of the variable under examination is normal. Hence the ‘transform’ parameter may be used to improve the normal approximation.
gelman.diag(x, confidence = 0.95, transform=FALSE, autoburnin=TRUE, multivariate=TRUE)
x 
An 
confidence 
the coverage probability of the confidence interval for the potential scale reduction factor 
transform 
a logical flag indicating whether variables in

autoburnin 
a logical flag indicating whether only the second half
of the series should be used in the computation. If set to TRUE
(default) and 
multivariate 
a logical flag indicating whether the multivariate potential scale reduction factor should be calculated for multivariate chains 
An object of class gelman.diag
. This is a list with the
following elements:
psrf 
A list containing the point estimates of the potential
scale reduction factor (labelled 
mpsrf 
The point estimate of the multivariate potential scale reduction
factor. This is NULL if there is only one variable in 
The gelman.diag
class has its own print
method.
Gelman and Rubin (1992) propose a general approach to monitoring
convergence of MCMC output in which m > 1 parallel chains are run
with starting values that are overdispersed relative to the posterior
distribution. Convergence is diagnosed when the chains have ‘forgotten’
their initial values, and the output from all chains is
indistinguishable. The gelman.diag
diagnostic is applied to a
single variable from the chain. It is based a comparison of withinchain
and betweenchain variances, and is similar to a classical analysis of
variance.
There are two ways to estimate the variance of the stationary distribution: the mean of the empirical variance within each chain, W, and the empirical variance from all chains combined, which can be expressed as
sigma.hat^2 = (n1)W/n + B/n
where n is the number of iterations and B/n is the empirical betweenchain variance.
If the chains have converged, then both estimates are unbiased. Otherwise the first method will underestimate the variance, since the individual chains have not had time to range all over the stationary distribution, and the second method will overestimate the variance, since the starting points were chosen to be overdispersed.
The convergence diagnostic is based on the assumption that the target distribution is normal. A Bayesian credible interval can be constructed using a tdistribution with mean
mu.hat = Sample mean of all chains combined
and variance
V.hat=sigma.hat2 + B/(mn)
and degrees of freedom estimated by the method of moments
d = 2*V.hat^2/Var(V.hat)
Use of the tdistribution accounts for the fact that the mean and variance of the posterior distribution are estimated.
The convergence diagnostic itself is
R=sqrt((d+3) V.hat /((d+1)W)
Values substantially above 1 indicate lack of convergence. If the chains have not converged, Bayesian credible intervals based on the tdistribution are too wide, and have the potential to shrink by this factor if the MCMC run is continued.
The multivariate a version of Gelman and Rubin's diagnostic was proposed by Brooks and Gelman (1998). Unlike the univariate proportional scale reduction factor, the multivariate version does not include an adjustment for the estimated number of degrees of freedom.
Gelman, A and Rubin, DB (1992) Inference from iterative simulation using multiple sequences, Statistical Science, 7, 457511.
Brooks, SP. and Gelman, A. (1998) General methods for monitoring convergence of iterative simulations. Journal of Computational and Graphical Statistics, 7, 434455.
gelman.plot
.