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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.