geweke: Geweke Diagnostic for MCMC

View source: R/diagnostics.R

gewekeR Documentation

Geweke Diagnostic for MCMC

Description

Conducts a Geweke convergence diagnostic on MCMC iterations.

Usage

geweke(object, early.prop = 0.1, late.prop = 0.5, precision = 4)

## S3 method for class 'krige'
geweke(object, early.prop = 0.1, late.prop = 0.5, precision = 4)

## S3 method for class 'summary.krige'
geweke(object, early.prop = 0.1, late.prop = 0.5, precision = 4)

## Default S3 method:
geweke(object, early.prop = 0.1, late.prop = 0.5, precision = 4)

Arguments

object

An matrix or krige/summary.krige object for which a Geweke diagnostic is desired

early.prop

Proportion of iterations to use from the start of the chain.

late.prop

Proportion of iterations to use from the end of the chain.

precision

Number of digits of test statistics and p-values to print.

Details

This is a generic function currently works with matrix, krige, and summary.krige objects. It is a simplified version of the Geweke test for use with this package.

Geweke's (1992) test for nonconvergence of a MCMC chain is to conduct a difference-of-means test that compares the mean early in the chain to the mean late in the chain. If the means are significantly different from each other, then this is evidence that the chain has not converged. The difference-of-means test is a simple z-ratio, though the standard error is estimated using the spectral density at zero to account for autocorrelation in the chain.

Value

A matrix in which the first row consists of z-scores for tests of equal means for the first and last parts of the chain. The second row consists of the corresponding p-values. Each column of the matrix represents another parameter. For each column, a significant result is evidence that the chain has not converged for that parameter. Thus, a non-significant result is desired.

References

John Geweke. 1992. "Evaluating the Accuracy of Sampling-Based Approaches to the Calculation of Posterior Moments." In Bayesian Statistics 4, ed. J.M. Bernardo, J.O. Berger, A.P. Dawid, and A.F.M. Smith. Oxford: Clarendon Press.

See Also

geweke.krige, geweke.summary.krige

Examples

## Not run: 
# Load Data
data(ContrivedData)

# Set seed
set.seed(1241060320)

M <- 100

contrived.run <- metropolis.krige(y ~ x.1 + x.2, coords = c("s.1","s.2"), 
  data = ContrivedData, n.iter = M, range.tol = 0.05)

geweke(contrived.run, early.prop=0.5)
geweke(summary(contrived.run), early.prop=0.5)
geweke(contrived.run$mcmc.mat, early.prop=0.5)
# Note that the default proportions in the geweke() is more typical for longer run.

## End(Not run)


krige documentation built on May 1, 2022, 5:06 p.m.

Related to geweke in krige...