Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/checkIsAutocorrelated.r
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.
1 | checkIsAutocorrelated(obj, criterion = 0.4, lag = 1, quiet = FALSE)
|
obj |
An mcmc.list object from the |
criterion |
scalar specifying the level of acceptable autocorrelation at
the assessed |
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. |
This routine calculates auto correlation separately at the specified lag for every chain in the mcmc.list, then averages autocorrelations across chains.
A list with the following components
autoCorrelated: If the average autocorrelations at the specified
lag are all less than
criterion
, the chain is declared un-autocorrelated and is set FALSE.
Otherwise, this component of the returns is TRUE.
autoCorrs: the computed autocorrelations at the specified lag.
This value is the average across chains in obj
.
Trent McDonald
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.