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.
Diese Übung ist Teil des Kurses
Forecasting in R
Anleitung zur Übung
- 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
.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# 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 <- ___