# Autocorrelation

Autocorrelation is the correlation of a signal with a delayed copy of itself. We provide ACF and PACF functions for time series analysis.

## Partial Autocorrelation (PACF)

The partial autocorrelation function (PACF) describes the relationship between the current and lagged values of a times series *while accounting for intermediate lags*. In other words, the PACF at lag k is the autocorrelation between $ X_{t} $ and $ X_{tâˆ’k} $ that is not accounted for by lags 1 through kâˆ’1.

We compute this iteratively using a QR decomposition.

### Returns

- Partial autocorrelation coefficients
- Bounds: 2 standard deviations
- Vector of lags

## Autocorrelation (ACF)

This is serial correlation of a time series with its own incremental lags.

$$ R(\tau) = \int_{\infty}^{\infty}h(t + \tau)h(t)dt $$

Even though it can be calculated naively by iterating incrementally and obtaining a series of regressions, we use a result in applied mathematics known as the Wiener-Kinchin Theorem as a shortcut. This consists of using an inverse Fourier transform of the power spectrum to calculate the autocorrelation function.

$$ R(\tau) = \int_{-\infty}^{\infty}dfH(f)H^{*}e^{-2 \pi i f} = \int_{-\infty}^{\infty}dfP(f)e^{-2 \pi i f} $$

### Returns

- Autocorrelation coefficients
- Bounds: 2 standard deviations
- Vector of lags