Forecasting in R
Rob J. Hyndman
Professor of Statistics at Monash University
Autoregressive (AR) models:
Moving average (MA) models:
Autoregressive moving average (ARMA) models:
ARIMA(p, d, q) models:
autoplot(usnetelec) +
xlab("Year") +
ylab("billion kwh") +
ggtitle("US net electricity generation")
fit <- auto.arima(usnetelec)
summary(fit)
Series: usnetelec
ARIMA(2,1,2) with drift
Coefficients:
ar1 ar2 ma1 ma2 drift
-1.303 -0.433 1.528 0.834 66.159
s.e. 0.212 0.208 0.142 0.119 7.559
sigma^2 estimated as 2262: log likelihood=-283.3
AIC=578.7 AICc=580.5 BIC=590.6
Training set error measures:
ME RMSE MAE MPE MAPE MASE ACF1
Training set 0.0464 44.89 32.33 -0.6177 2.101 0.4581 0.02249
fit %>% forecast() %>% autoplot()
Hyndman-Khandakar algorithm:
Forecasting in R