acf.fft: faster autocorrelation based on ffw

View source: R/acf.fft.R

acf.fftR Documentation

faster autocorrelation based on ffw

Description

This function is 4-times faster than stats::acf()

Usage

acf.fft(x, lag.max = NULL)

Arguments

lag.max

maximum lag at which to calculate the acf. Default is 10\log_{10}(N/m) where N is the number of observations and m the number of series. Will be automatically limited to one less than the number of observations in the series.

Value

An array with the same dimensions as x containing the estimated autocorrelation.

References

  1. https://github.com/santiagobarreda/phonTools/blob/main/R/fastacf.R

  2. https://gist.github.com/FHedin/05d4d6d74e67922dfad88038b04f621c

  3. https://gist.github.com/ajkluber/f293eefba2f946f47bfa

  4. http://www.tibonihoo.net/literate_musing/autocorrelations.html#wikispecd

  5. https://lingpipe-blog.com/2012/06/08/autocorrelation-fft-kiss-eigen

Examples

set.seed(1)
x <- rnorm(100)
r_fast <- acf.fft(x)
r <- acf(x, plot=FALSE, lag.max=100)$acf[,,1]

rtrend documentation built on June 22, 2024, 11:39 a.m.