calc_autocorr: Autocorrelation Calculator

View source: R/calc_functions.R

calc_autocorrR Documentation

Autocorrelation Calculator

Description

Calculates the autocorrelation of a given sequence, or of the size of the steps (returns).

Usage

calc_autocorr(chain, change = TRUE, alpha = 0.05, lag.max = 100, plot = FALSE)

Arguments

chain

Vector of n length, where n is the number of trials or sampler iterations

change

Boolean. If true, plot the autocorrelation of the change series. If false, plot the autocorrelation of the given chain.

alpha

Measure of Type I error - defaults to .05

lag.max

Length of the x axis. How far to examine the lags.

plot

Boolean. Whether to additionally plot the result.

Details

Markets display no significant autocorrelations in the returns of a given asset.

Value

A vector with the standard deviations at each lag

Examples

set.seed(1)
chain1 <- sampler_mh(1, "norm", c(0,1), diag(1))
calc_autocorr(chain1[[1]], plot=TRUE)

samplr documentation built on April 4, 2025, 12:30 a.m.