Autocorrelation

As we've covered for some time now, correlation is a measure of how strongly two variables fluctuate together. Autocorrelation is a measure of how strongly a series correlates to lagged versions of itself. A series with strong autocorrelation is said to be serially correlated.

Let's take {8, 6, 7, 5, 3, 0, 9} to be our example series. This series lagged one observation is {NA, 8, 6, 7, 5, 3, 0}:

Lag 0   8   6   7  5  3  0  9Lag 1  NA   8   6  7  5  3  0 Lag 2  NA  NA   8  6  7  5  3 

If we take the correlation coefficient of the lag 0 (observed values) and lag 1, we get -0.06. We can repeat this correlation evaluation for all lags n-1, where n is the length of the original series. This is the series autocorrelation function, or ACF.

You can visualize ...

Get Data Analysis with R - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.