checkIsAutocorrelated: checkIsAutocorrelated - Check whether MCMC chains are...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/checkIsAutocorrelated.r

Description

Run autocorrelation on every parameter in an mcmc.list and make a decision whether they are significantly auto correlated. Ideally, chains are not autocorrelated when converged.

Usage

1
checkIsAutocorrelated(obj, criterion = 0.4, lag = 1, quiet = FALSE)

Arguments

obj

An mcmc.list object from the rjags package. These are output by the coda.samples function.

criterion

scalar specifying the level of acceptable autocorrelation at the assessed lag. If all average lag2 autocorrelations are less than this number, the whole mcmc object is deems 'random' or not autocorrelated.

lag

The lag at which to assess autocorrelation. This should generally be a low number like 1, 2, 5, or 10.

quiet

Whether to print any output on screen.

Details

This routine calculates auto correlation separately at the specified lag for every chain in the mcmc.list, then averages autocorrelations across chains.

Value

A list with the following components

Author(s)

Trent McDonald

See Also

checkIsConverged

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
jags = jags.model(file="someJAGSFile.txt",
   data=someJAGS.data, inits=someJAGS.inits,
   n.chains=3,n.adapt=100)
update(jags, n.iter=1000)
out = coda.samples(jags,
   variable.names=c("someParameter"),
   n.iter=1000,
   thin=2)

auto <- chechIsAutocorrelated(out)

## End(Not run)

tmcd82070/EoAR documentation built on July 13, 2021, 5:52 p.m.