powered by
Calculates the autocorrelation of a given sequence, or of the size of the steps (returns).
calc_autocorr(chain, change = TRUE, alpha = 0.05, lag.max = 100, plot = FALSE)
A vector with the standard deviations at each lag
Vector of n length, where n is the number of trials or sampler iterations
Boolean. If true, plot the autocorrelation of the change series. If false, plot the autocorrelation of the given chain.
Measure of Type I error - defaults to .05
Length of the x axis. How far to examine the lags.
Boolean. Whether to additionally plot the result.
Markets display no significant autocorrelations in the returns of a given asset.
set.seed(1) chain1 <- sampler_mh(1, "norm", c(0,1), diag(1)) calc_autocorr(chain1[[1]], plot=TRUE)
Run the code above in your browser using DataLab