[R] About Coda Package

Martyn Plummer plummer at iarc.fr
Tue Sep 27 11:35:29 CEST 2005

Dear Juan Pablo,

It is best to send package-specific queries the package maintainer (me
in this case) which you can find out by typeing "library(help=coda)"

The inconsistency comes from two different ways of estimating the
spectral density at frequency 0: spectrum0() adapted from Heidelberger &
Welch, fits a generalized linear model to the periodogram. This function
is called by the effectiveSize() function.  Unfortunately it crashes
when there is very high autocorrelation.  The alternative function
spectrum0.ar does the same thing by fitting an autoregressive model to
the data, and won't crash even on highly autocorrelated data. The latter
function is called by codamenu().

The two functions are giving different results here, but to be honest,
an effective sample size of 370 isn't sufficient for serious inference
from an MCMC sample either.   I can only reiterate the advice given by
the warning message.


On Tue, 2005-09-27 at 11:11 +0200, Juan Pablo Sanchez Serrano wrote:
> Dear R users:
> I am using the package coda (the last verison in CRAN) to analyse the
> output from a  MCMC Bayesian analysis. And I get unconsitented
> results. I have export the chain using the read.table function and
> after I have transformed this data frame to an mcmc object using the
> mcmc function. I am interested in three variables, when I use the
> function effectiveSize I have these figures:  403.3730    1854.4534
> 369.8643. But when I run the function codamenu to perform same
> convergence test I get this warning mensage:
> Checking effective sample size ...
> *******************************************
> WARNING !!!                              
> Some variables in your chain have an     
> effective sample size of less than 200   
> This is too small, and may cause errors  
> in the diagnostic tests                  
> HINT:                                    
> Look at plots first to identify variables
> with slow mixing.  (Choose menu Output   
> Analysis then Plots)                     
> Re-run your chain with a larger sample   
> size and thinning interval. If possible, 
> reparameterize your model to improve mixing
> *******************************************
> Some thing is wrong. Could someone explain to me what is happening?
> Thanks, 
> Juan Pablo.

This message and its attachments are strictly confidential. ...{{dropped}}

More information about the R-help mailing list