Skip to contents

Compares the mean of the first tenth of the chain with the mean of the last half; under stationarity the standardized difference is approximately standard normal. The variance of each mean is S0 / n, with S0 the spectral density at zero estimated ONLY in the final window (by the initial monotone sequence of the autocovariances, the estimator of ess()), so an initial transient cannot inflate its own variance and hide. With a matrix (one column per chain) S0 is pooled over the chains and the per-chain z are combined as their sum over sqrt(M), which is again standard normal and gains power when the chains share a starting point, as in gibbs(). With few effective draws in the final window the noise of S0 makes the z heavier-tailed than a normal; mcmc_diagnostics() reads it against a t with a quarter of that effective size as degrees of freedom. The numbers differ from coda::geweke.diag(), which estimates S0 in each window by an autoregression. This function takes the draws as given; the table of mcmc_diagnostics() and the geweke column of gibbs() apply it on the scale in their start_scale column (log or ranks for heavy-tailed draws), so on heavy-tailed draws they differ from it. The previous version of this function used the variance of iid draws and rejected a stationary chain with lag-one autocorrelation 0.9 about 63% of the time at the 5% level (validation/mcmc_diagnostics_calibration.R, section H).

Usage

geweke_z(x)

Arguments

x

numeric vector (one chain) or matrix of draws, one column per chain, at least 20 draws

Value

a single number, the z-score. mcmc_diagnostics() turns it into a decision with the multiplicity across parameters controlled.

References

Geweke, J. (1992). Evaluating the accuracy of sampling-based approaches to the calculation of posterior moments. In Bayesian Statistics 4. Oxford University Press.