Time Series Autocorrelation function (ACF)

This online calculator computes autocorrelation function for given time series and plots correlogram

Autocorrelation, also known as serial correlation, is the correlation of a signal with a delayed copy of itself as a function of delay. Informally, it is the similarity between observations as a function of the time lag between them. Autocorrelation analysis is a mathematical tool for finding repeating patterns, such as the presence of a periodic signal obscured by noise or identifying the missing fundamental frequency in a signal implied by its harmonic frequencies. It is often used in signal processing for analyzing functions or series of values, such as time-domain signals.

In statistics, the autocorrelation of a random process is the Pearson correlation between the process's values at different times, as a function of the two times or of the time lag. 1

The sample Pearson correlation coefficient between x and y is:
r=\frac{\sum_{i=1}^{N}(x_i - \bar x)(y_i- \bar y)}{\sqrt{\sum_{i=1}^{N}(x_i - \bar x)^2}\sqrt{\sum_{i=1}^{N}(y_i - \bar y)^2}}

For autocorrelation, this coefficient is computed between the time series and the same time series lagged by specified number of periods. For example, for 1-period time lag, the correlation coefficient is computed between first N-1 values, i.e. x_1, ..., x_{N-1} and next N-1 values (values shifted by one), i.e. x_2, ..., x_N.
r_1=\frac{\sum_{i=1}^{N-1}(x_i - \bar{x}_{(1)})(x_{i+1}- \bar{x}_{(2)})}{\sqrt{\sum_{i=1}^{N-1}(x_i - \bar{x}_{(2)})^2}\sqrt{\sum_{i=1}^{N-1}(x_{i+1} - \bar{x}_{(2)})^2}},
where \bar{x}_{(1)} is the mean of the first N-1 values, and \bar{x}_{(2)} is the mean of the last N-1 values.

If we ignore difference between \bar{x}_{(1)} and \bar{x}_{(2)}, we can simplify the formula above to
r_1=\frac{\sum_{i=1}^{N-1}(x_i - \bar{x})(x_{i+1}- \bar{x})}{\sum_{i=1}^{N}(x_i - \bar{x})^2}

This can be generalized for values separated by k periods as:
r_k=\frac{\sum_{i=1}^{N-k}(x_i - \bar{x})(x_{i+k}- \bar{x})}{\sum_{i=1}^{N}(x_i - \bar{x})^2}

The value of r_k is called the autocorrelation coefficient at lag k. The plot of the sample autocorrelations r_k versus k (the time lags) is called the correlogram or autocorrelation plot.

The correlogram is a commonly used tool for checking randomness in a data set. Computing autocorrelations ascertain this randomness for data values at varying time lags. If random, such autocorrelations should be near zero for any and all time-lag separations. If non-random, then one or more of the autocorrelations will be significantly non-zero.

Also, correlograms are used in the model identification stage for Box–Jenkins autoregressive moving average time series models. Autocorrelations should be near-zero for randomness; if the analyst does not check for randomness, then the validity of many of the statistical conclusions becomes suspect. The correlogram is an excellent way of checking for such randomness.2

The default data for the calculator below is obtained by noising sine function using Noisy function generator, and you can clearly see a non-random pattern.

PLANETCALC, Time Series Autocorrelation function

Time Series Autocorrelation function

Time Series

TimeValue
Items per page:

Digits after the decimal point: 2
Time Series
The file is very large. Browser slowdown may occur during loading and creation.
Correlogram
The file is very large. Browser slowdown may occur during loading and creation.

URL copied to clipboard
PLANETCALC, Time Series Autocorrelation function (ACF)

Comments