Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I'm running a Metropolis sampler (C++) and want to use the previous samples to estimate the convergence rate.

One easy to implement diagnostic I found is the Geweke diagnostic, which computes the difference between the two sample means divided by itsestimated standard error. The standard error is estimated from the spectral density at zero.


where $A$, $B$ are two windows within the Markov chain. I did some research on what are $\hat{S_{\theta}^A}(0)$ and $\hat{S_{\theta}^B}(0)$ but get into a mess of literature on energy spectral density and power spectral density. (http://en.wikipedia.org/wiki/Spectral_density) but I'm not an expert on these topics; I just need a quick answer: are these quantities the same as sample variance? If not, what's the formula for computing them?

Another doubt on this Geweke diagnostic is how to pick $\theta$? The above literature said that it is some functional $\theta(X)$ and should imply an existence of a spectral density $\hat{S_{\theta}^A}(0)$, but for convenience I guess the simplest way is to use the identity function (use samples themselves). Is this correct?

The R coda package has a description but neither does it specify how to compute the $S$ values.

share|improve this question
you could look in the guts of the coda function geweke.diag to see what it does ... –  Ben Bolker Aug 21 '12 at 16:54

1 Answer 1

Check the wikipedia page. You'll see $S_{xx}(\omega)$, which is the spectral density. In your case, you should use $S_{xx}(0)$.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.