gelman.diag(data, confidence = 0.95, transform=FALSE)
data
|
An mcmc.list object with more than one chain,
and with starting values that are overdispersed with respect to the
posterior distribution.
|
confidence
| the coverage probability of confidence interval for the shrink factor |
transform
|
a logical vector indicating whether variables in
data should be transformed to improve the normality of the
distribution. If set to TRUE, a log transform or logit transform, as
appropriate, will be applied. If transform is of length 1
it is replicated to be equal to the number of variables in data .
|
data
,
together with upper and lower confidence limits. Approximate
convergence is diagnosed when the upper limit is close to 1.
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 the skewness of the distribution.
gelman.diag
diagnostic is applied to a single variable from
the chain. It is based a comparison of within-chain and between-chain
variances, and is similar to a classical analysis of variance.
There are two ways to estimate the variance of the stationary distribution. item{the mean of the empirical variance within each chain, W, and} item{the empirical variance from all chains combined, which can be expressed as
sigma.hat^2 = (frac{(n-1) B }{n}) + frac{W}{n}
where B is the empirical between-chain 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 t-distribution with mean
mu.hat = Sample mean of all chains combined
and varianceV.hat = sigma.hat^2 + frac{B}{mn}
where m is the number of chains, and degrees of freedom estimated by the method of momentsd = frac{2*V.hat}{Var(V.hat)}
Use of the t-distribution accounts for the fact that the mean and variance of the posterior distribution are estimated.The convergence diagnostic itself is
R = sqrt{frac{(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 t-distribution are too wide, and have the potential to shrink by this factor if the MCMC run is continued.gelman.plot