Selecting an ARIMA model
Using the exponential smoothing method requires that residuals are non-correlated. However, in real-life cases, it is quite unlikely that none of the continuous values correlate with each other. Instead, one can use ARIMA in R to build a time series model that takes autocorrelation into consideration. In this recipe, we introduce how to use ARIMA to build a smoothing model.
Getting ready
In this recipe, we use time series data simulated from an ARIMA process.
How to do it…
Please perform the following steps to select the ARIMA model's parameters:
- First, simulate an ARIMA process and generate time series data with the
arima.sim
function:> set.seed(123) > ts.sim <- arima.sim(list(order = c(1,1,0), ar = 0.7), n = 100) > plot(ts.sim)
- We can then take the difference of the time series:
> ts.sim.diff <- diff(ts.sim)
- Plot the differenced time series:
> plot(ts.sim.diff)