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:

  1. 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) ...

Get R for Data Science Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.