ComeçarComece de graça

Autocorrelation of non-seasonal time series

Another way to look at time series data is to plot each observation against another observation that occurred some time previously by using gglagplot(). For example, you could plot \(y_t\) against \(y_{t-1}\). This is called a lag plot because you are plotting the time series against lags of itself.

The correlations associated with the lag plots form what is called the autocorrelation function (ACF). The ggAcf() function produces ACF plots.

In this exercise, you will work with the pre-loaded oil data (available in the package fpp2), which contains the annual oil production in Saudi Arabia from 1965-2013 (measured in millions of tons).

Este exercício faz parte do curso

Forecasting in R

Ver curso

Instruções do exercício

  • Use the autoplot() function to plot the oil data.
  • For the oil data, plot the relationship between \(y_t\) and \(y_{t-k}\), \(k=1,\dots,9\) using one of the two functions introduced above. Look at how the relationships change as the lag increases.
  • Likewise, plot the correlations associated with each of the lag plots using the other appropriate new function.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Create an autoplot of the oil data
___

# Create a lag plot of the oil data
___

# Create an ACF plot of the oil data
___
Editar e executar o código