Forecasting with an ARIMA model
Based on our fitted ARIMA model, we can predict future values. In this recipe, we will introduce how to forecast future values with the forecast.Arima
function in the forecast
package.
Getting ready
Ensure you have completed the previous recipe by generating an ARIMA model and storing the model in a variable, fit
.
How to do it…
Please perform the following steps to forecast future values with forecast.Arima
:
- First, use
forecast.Arima
to generate the prediction of future values:> fit.predict <- forecast.Arima(fit)
- We can then use the
summary
function to obtain the summary of our prediction:> summary(fit.predict) Forecast method: ARIMA(1,1,0) Model Information: Series: ts.sim ARIMA(1,1,0) Coefficients: ar1 0.7128 ...
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.