Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ac

Calculate the autocorrelation of a single chain, for a specified amount of lags


Description

Calculate the autocorrelation of a single chain, for a specified amount of lags.

Usage

ac(x, nLags)

Arguments

x

Vector with a chain of simulated values.

nLags

Numerical value with the maximum number of lags to take into account.

Value

A matrix with the autocorrelations of every chain.

References

Fernández-i-Marín, Xavier (2016) ggmcmc: Analysis of MCMC Samples and Bayesian Inference. Journal of Statistical Software, 70(9), 1-20. doi:10.18637/jss.v070.i09 Internal function used by ggs_autocorrelation.

Examples

# Calculate the autocorrelation of a simple vector
ac(cumsum(rnorm(10))/10, nLags=4)

ggmcmc

Tools for Analyzing MCMC Simulations from Bayesian Inference

v1.5.1.1
GPL-2
Authors
Xavier Fernández i Marín [aut, cre] (<https://orcid.org/0000-0002-9522-8870>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.