O'Reilly logo

Data Analysis with R - Second Edition by Tony Fischetti

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required