Accuracy manual6 5 sort data frame with aicc in

  • No School
  • AA 1
  • Orkay
  • 25
  • 100% (5) 5 out of 5 people found this document helpful

This preview shows page 17 - 22 out of 25 pages.

accuracy (manual6)[ 5 ])) # Sort data frame with AICc in descending order KPI_data <- KPI_data[ order (KPI_data $ AICc),] kable (KPI_data, caption = "ARIMA Models Comparison (Manual)" ) ARIMA Models Comparison (Manual) Model Metho d AICc RMSE MAPE 1 ARIMA(3,0,0)(1,0,2)[12] Manual -2250.052 0.021551 1 0.3871329 5 ARIMA(3,0,1)(0,1,1)[12] Manual -2205.449 0.021462 8 0.3797189 6 ARIMA(3,0,1)(1,1,0)[12] Manual -2125.870 0.023752 5 0.4197639 4 ARIMA(3,1,1)(0,0,1)[12] Manual -1969.123 0.029919 7 0.5688928 3 ARIMA(2,1,1)(0,0,1)[12] Manual -1875.103 0.033106 1 0.6419073 2 ARIMA(1,1,1)(0,0,1)[12] Manual -1862.215 0.033628 1 0.6539419 From the manual models above, the best model is the ARIMA(3,0,0)(1,0,2)[12]. This has the smallest AICc value. checkresiduals (manual1, lag = 150 )
Image of page 17
## ## Ljung-Box test ## ## data: Residuals from ARIMA(3,0,0)(1,0,2)[12] with non-zero mean ## Q* = 210.06, df = 143, p-value = 0.0002221 ## ## Model df: 7. Total lags used: 150 Ljung-Box Test on best fitted manual model Null Hypothesis H0: The data are independently distributed Alternative Hypothesis Ha: The data are not independently distributed; they exhibit serial correlation. From the residuals and test of the model, we observe that there are few significant spikes in ACF. Also, the model fails Ljung-Box test, because the p-value is much less than the 5% confidence of internal. Hence, we reject the Null hypothesis H0 and accept Alternative hypothesis. However, the model can be still used for forecasting, but the intervals of prediction may not be accurate due to the correlated residuals. Automatic ARIMA model We will use automatic ARIMA function on the seasonally differenced time series. auto1 <- auto.arima (lgas) summary (auto1)
Image of page 18
## Series: lgas ## ARIMA(0,1,1)(0,1,1)[12] ## ## Coefficients: ## ma1 sma1 ## -0.3304 -0.8256 ## s.e. 0.0462 0.0473 ## ## sigma^2 estimated as 0.0004815: log likelihood=1105.61 ## AIC=-2205.22 AICc=-2205.17 BIC=-2192.81 ## ## Training set error measures: ## ME RMSE MAE MPE MAPE ## Training set 8.416862e-05 0.02159378 0.01546022 0.006812281 0.3798947 ## MASE ACF1 ## Training set 0.357045 -0.003186571 # Append to metrics dataframe KPI_data <- rbind (KPI_data, data.frame ( Model = "ARIMA(0,1,1)(0,1,1) [12]" , Method = "Auto" , AICc = auto1 $ aicc, RMSE = accuracy (auto1)[ 2 ], MAPE = accuracy (auto1)[ 5 ])) # Sort data frame with AICc in descending order KPI_data <- KPI_data[ order (KPI_data $ AICc),] kable (KPI_data, caption = "ARIMA Models Comparison" ) ARIMA Models Comparison Model Metho d AICc RMSE MAPE 1 ARIMA(3,0,0)(1,0,2)[12] Manual -2250.052 0.021551 1 0.3871329 5 ARIMA(3,0,1)(0,1,1)[12] Manual -2205.449 0.021462 8 0.3797189 1 1 ARIMA(0,1,1)(0,1,1)[12] Auto -2205.170 0.021593 8 0.3798947 6 ARIMA(3,0,1)(1,1,0)[12] Manual -2125.870 0.023752 5 0.4197639 4 ARIMA(3,1,1)(0,0,1)[12] Manual -1969.123 0.029919 7 0.5688928 3 ARIMA(2,1,1)(0,0,1)[12] Manual -1875.103 0.033106 0.6419073
Image of page 19
1 2 ARIMA(1,1,1)(0,0,1)[12] Manual -1862.215 0.033628 1 0.6539419 checkresiduals (auto1, lag = 150 ) ## ## Ljung-Box test ## ## data: Residuals from ARIMA(0,1,1)(0,1,1)[12] ## Q* = 218.69, df = 148, p-value = 0.0001419 ## ## Model df: 2. Total lags used: 150 Observation (Automtic ARIMA method) 1. When automatic ARIMA function is executed with default parameters, it generated an ARIMA model of ARIMA(0,1,1)(0,1,1)[12] 2. Similar to best manual model, the automatic model fails Ljung-Box test (p-value = 0.0001419) Since, both manual and auto models did not pass the Ljung-Box test, we use the automatic model ARIMA(0,1,1)(0,1,1)[12] . Model Validation
Image of page 20
To validate the performance of the model, we split the time series data as ‘Train’ and ‘Test’ dataset.
Image of page 21
Image of page 22

You've reached the end of your free preview.

Want to read all 25 pages?

  • Fall '19
  • Statistics, Statistical hypothesis testing, Autoregressive integrated moving average, AICC

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture