Aan de slagGa gratis aan de slag

Autocorrelation of seasonal and cyclic time series

When data are either seasonal or cyclic, the ACF will peak around the seasonal lags or at the average cycle length.

You will investigate this phenomenon by plotting the annual sunspot series (which follows the solar cycle of approximately 10-11 years) in sunspot.year and the daily traffic to the Hyndsight blog (which follows a 7-day weekly pattern) in hyndsight. Both objects have been loaded into your workspace.

Deze oefening maakt deel uit van de cursus

Forecasting in R

Cursus bekijken

Oefeninstructies

  • Produce a time plot and ACF plot of sunspot.year.
  • By observing the ACF plot, at which lag value (x) can you find the maximum autocorrelation (y)? Set this equal to maxlag_sunspot.
  • Produce a time plot and ACF plot of hyndsight.
  • By observing the ACF plot, at which lag value (x) can you find the maximum autocorrelation (y)? Set this equal to maxlag_hyndsight.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Plot the annual sunspot numbers
autoplot(___)
ggAcf(___)

# Save the lag corresponding to maximum autocorrelation
maxlag_sunspot <- ___

# Plot the traffic on the Hyndsight blog
___
___

# Save the lag corresponding to maximum autocorrelation
maxlag_hyndsight <- ___
Code bewerken en uitvoeren