Creating an ARIMA model
After determining the optimum p, d, and q parameters for an ARIMA model, we can now create an ARIMA model with the Arima
function.
Getting ready
Ensure you have completed the previous recipe by generating a time series object and storing it in a variable, ts.sim
.
How to do it…
Please perform the following steps to build an ARIMA model:
- First, we can create an ARIMA model with time series
ts.sim
, with parameters p=1, d=1, q=0:> library(forecast) > fit <- Arima(ts.sim, order=c(1,1,0)) > fit Series: ts.sim ARIMA(1,1,0) Coefficients: ar1 0.7128 s.e. 0.0685 sigma^2 estimated as 0.7603: log likelihood=-128.04 AIC=260.09 AICc=260.21 BIC=265.3
- Next, use the accuracy function to print the training set errors of the model:
> accuracy(fit) ME RMSE MAE MPE Training set 0.004938457 0.863265 0.6849681 -41.98798 MAPE MASE ACF1 Training set 102.2542 0...