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 9 Lag 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 a time series' autocorrelation function using the ggAcf
function provided by the forecast
package. (Note that this plot is sometimes called a correlogram). Let's take a look at the ACF for the school supplies
series and see what...