Autocorrelation and Partial Autocorrelation in Time Series Data
By: Chau Nguyen
Tags: Time Series Modeling, Time Series Forecasting, Time Series Analysis

In this post, I will explain both the autocorrelation function and partial autocorrelation function. you’ll learn about the differences between these functions and what they can tell you about your data.

What is Autocorrelation?

Autocorrelation is the correlation between two observations at different points in a time series. In other words, the time series data correlate with themselves-hence, the name. We talk about these correlations using the term “Lags”. Analysts record time series data by measuring a characteristic at evenly spaced intervals-such as daily, monthly, or yearly. The number of intervals between the two observations is the lag.

For example, the lag is between the current and previous observation is one. If you go back one more interval, the lag is two or so on.

In mathematical terms, the observations at Y(k) and Y(t-k) are separated by k time units. k is the lag. This lag can be days, quarters, years that depend on the nature of the data .

when k=1, you’re assessing adjacent observations. for each lag, there is a correlation.

The autocorrelation function (ACF) assesses the correlation between observations in a time series for a set of lags. The ACF for time series y is given by: Corr(y(t), y(t-k)), k=1, 2, 3….

Analysts typically use graphs to display this function.

The ACF plot

Autocorrelation Function (ACF)

Use the autocorrelation function (ACF) to identify which lags have significant correlations, understand the patterns and properties of the time series, and then use that information to model the time series data. From the ACF, you can assess the randomness/White Noise and stationarity of a time series. You can also determine whether trends and seasonal patterns are present.

In an ACF plot, each bar represents the size and direction of the correlation. Bars that extend across the blue line are statistically significant.

Randomness/White Noise

For random data, autocorrelation should be near zero for all lags. Analysts also refer to this condition as White Noise. Non-Random data have at least one significant lag. When the data are not random, it’s a good indication that you need to use a time series analysis or incorporate lags into a regression analysis to model the data appropriately.

The autocorrelation Function for Random

Stationarity

Stationarity means that the time series does not have a trend, has a constant variance, a constant autocorrelation pattern, and no seasonal pattern. The autocorrelation function declines to near zero rapidly for a stationary time series. In contrast, the ACF drops slowly for a non-stationary time series.

The sample stationary time series.

Trend

when trends are present in a time series, shorter lags typically have large position correlations because observations closer in time tend to have similar values. The correlations taper off slowly as the lags increase.

Seasonality

when seasonal pattern are present, the autocorrelation are larger for lags at multiples of the seasonal frequency than for other lags.

when a time series has both a trend and seasonality, the ACF plot displays a mixture of both effects. That’s the case in the correlation function plot for the carbon dioxide CO2 dataset from NIST. This dataset contains monthly mean CO2 measurements at the Mauna Loa observatory.

Notice how you can see the wavy correlation for the seasonal pattern and the slowly diminishing lags of a trend.

Partial Autocorrelation Function (PACF)

The partial autocorrelation function is similar to the ACF except that it displays only the correlation between two observations that the shorter lags between those observations do not explain. For example, the partial autocorrelation for lag 3 is only the correlation that lags 1 and 2 do not explain. In other words, the partial correlation for each lag is the unique correlation between those two observations after partialling out the intervening correlations.

As you saw, the autocorrelation function helps assess the properties of a time series. In contrast, the partial autocorrelation function (PACF) is more useful during the specification process for an autoregressive model. Analysts use partial autocorrelation plots to specify regression models with time series data and Auto Regressive Integrated Moving Average(ARIMA) models. I’ll focus on that aspect in posts about those methods.

For this post, I’ll show you a quick example of a PACF plot. Typically, you will use the ACF to determine whether an autoregressive model is appropriate. If it is, you then use the PACF to help you choose the model terms.

This partial autocorrelation plot displays data from the southern oscillations dataset from NIST. The southern oscillations refer to changes in the barometric pressure near Tahiti that predicts El Niño.

On the graph, the partial autocorrelations for lags 1 and 2 are statistically significant. The subsequent lags are nearly significant. Consequently, this PACF suggests fitting either a second or third-order autoregressive model.

By assessing the autocorrelation and partial autocorrelation patterns in your data, you can understand the nature of your time series and model it!