Non-seasonal differencing for stationarity
Differencing is a way of making a time series stationary; this means that you remove any systematic patterns such as trend and seasonality from the data. A white noise series is considered a special case of a stationary time series.
With non-seasonal data, you use lag-1 differences to model changes between observations rather than the observations directly. You have done this before by using the diff()
function.
In this exercise, you will use the pre-loaded wmurders
data, which contains the annual female murder rate in the US from 1950-2004.
Cet exercice fait partie du cours
Forecasting in R
Instructions
- Plot the
wmurders
data and observe how it has changed over time. - Now, plot the annual changes in the murder rate using the function mentioned above and observe that these are much more stable.
- Finally, plot the ACF of the changes in murder rate using a function that you learned in the first chapter.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Plot the US female murder rate
___
# Plot the differenced murder rate
___
# Plot the ACF of the differenced murder rate
___