Vinay billa Vinay billa - 4 months ago 24
R Question

Store auto.arima summary in multiple vectors

I performed auto.arima function on multiple ts variables in a list

arima_train <- lapply(train_data, function(x) auto.arima(x$Value))


I can get the summaries of the function for all the variables

> for (i in (1:16)) summary(arima_train[[i]])
Series: x$Value
ARIMA(0,1,0)

sigma^2 estimated as 2.808: log likelihood=-137.4
AIC=276.81 AICc=276.86 BIC=279.07

Training set error measures:
ME RMSE MAE MPE MAPE MASE ACF1
Training set 0.0451375 1.664175 1.228471 0.04069765 2.268046 0.9866678 -0.188887
Series: x$Value
ARIMA(0,0,0) with non-zero mean

Coefficients:
intercept
5251.6806
s.e. 187.3747

sigma^2 estimated as 2563468: log likelihood=-632.91
AIC=1269.81 AICc=1269.99 BIC=1274.37

Training set error measures:
ME RMSE MAE MPE MAPE MASE ACF1
Training set -2.829471e-12 1589.926 1012.06 -6.179073 17.3668 0.8272841 0.06356198
Series: x$Value
ARIMA(1,1,0) with drift

Coefficients:
ar1 drift
0.4006 0.3324
s.e. 0.1086 0.0907

sigma^2 estimated as 0.2205: log likelihood=-46.04
AIC=98.08 AICc=98.44 BIC=104.87

Training set error measures:
ME RMSE MAE MPE MAPE MASE ACF1
Training set 0.0003775476 0.4597061 0.3308142 0.0007945521 0.1444236 0.669588 0.05640966
Series: x$Value
ARIMA(0,1,0) with drift

Coefficients:
drift
54.8873
s.e. 14.8586

sigma^2 estimated as 15900: log likelihood=-443.67
AIC=891.34 AICc=891.51 BIC=895.86

Training set error measures:
ME RMSE MAE MPE MAPE MASE ACF1
Training set 0.07422375 124.3296 99.95529 -0.08126397 1.520543 0.9287823 -0.03885156
Series: x$Value
ARIMA(0,2,1)

Coefficients:
ma1
-0.9171
s.e. 0.0565

sigma^2 estimated as 100261: log likelihood=-502.59
AIC=1009.17 AICc=1009.35 BIC=1013.67

Training set error measures:
ME RMSE MAE MPE MAPE MASE ACF1
Training set 68.51967 309.9734 221.9339 0.04873783 0.1559967 0.9006235 -0.1312991
Series: x$Value
ARIMA(1,2,1)

Coefficients:
ar1 ma1
0.2549 -0.9151
s.e. 0.1297 0.0538

sigma^2 estimated as 0.8075: log likelihood=-91.49
AIC=188.98 AICc=189.34 BIC=195.72

Training set error measures:
ME RMSE MAE MPE MAPE MASE ACF1
Training set -0.1095264 0.8733085 0.6821252 -0.08248981 0.5255063 0.8663844 -0.02072697
Series: x$Value
ARIMA(2,1,2)

Coefficients:
ar1 ar2 ma1 ma2
-0.1269 0.4314 0.7658 0.3584
s.e. 0.1816 0.1818 0.1826 0.1581

sigma^2 estimated as 0.04297: log likelihood=12.48
AIC=-14.95 AICc=-14.03 BIC=-3.64

Training set error measures:
ME RMSE MAE MPE MAPE MASE ACF1
Training set 0.006785029 0.199965 0.1498849 1.903016 13.18623 0.6692976 -0.01844039
Series: x$Value
ARIMA(0,2,2)

Coefficients:
ma1 ma2
-0.2629 -0.5857
s.e. 0.0920 0.0893

sigma^2 estimated as 1.257: log likelihood=-106.99
AIC=219.97 AICc=220.33 BIC=226.72

Training set error measures:
ME RMSE MAE MPE MAPE MASE ACF1
Training set -0.1654204 1.089599 0.8857888 -0.1206975 0.6571573 0.8396662 0.08537194
Series: x$Value
ARIMA(0,0,0) with non-zero mean

Coefficients:
intercept
0.25

sigma^2 estimated as 0: log likelihood=Inf
AIC=-Inf AICc=-Inf BIC=-Inf

Training set error measures:
ME RMSE MAE MPE MAPE MASE ACF1
Training set 0 0 0 0 0 NaN NaN
Series: x$Value
ARIMA(0,1,1)

Coefficients:
ma1
-0.3715
s.e. 0.1246

sigma^2 estimated as 877.4: log likelihood=-340.9
AIC=685.8 AICc=685.97 BIC=690.32

Training set error measures:
ME RMSE MAE MPE MAPE MASE ACF1
Training set 1.621179 29.20693 21.85996 -0.05931622 5.767894 0.9993928 0.03373764
Series: x$Value
ARIMA(1,2,1)

Coefficients:
ar1 ma1
0.2877 -0.9395
s.e. 0.1332 0.0528

sigma^2 estimated as 0.07365: log likelihood=-7.22
AIC=20.43 AICc=20.82 BIC=27

Training set error measures:
ME RMSE MAE MPE MAPE MASE ACF1
Training set -0.02910269 0.2632887 0.193597 -0.02640935 0.181013 0.754128 -0.06465092
Series: x$Value
ARIMA(0,0,0) with non-zero mean

Coefficients:
intercept
0.3792
s.e. 0.0827

sigma^2 estimated as 0.4989: log likelihood=-76.62
AIC=157.25 AICc=157.42 BIC=161.8

Training set error measures:
ME RMSE MAE MPE MAPE MASE ACF1
Training set -3.251722e-14 0.7013751 0.512037 -Inf Inf 0.7256413 -0.09038341
Series: x$Value
ARIMA(0,1,0) with drift

Coefficients:
drift
-88.7606
s.e. 28.2956

sigma^2 estimated as 57661: log likelihood=-489.4
AIC=982.8 AICc=982.98 BIC=987.33

Training set error measures:
ME RMSE MAE MPE MAPE MASE ACF1
Training set 0.2040244 236.7675 186.6802 -0.07011135 1.570809 0.9429632 -0.08296941
Series: x$Value
ARIMA(0,1,1) with drift

Coefficients:
ma1 drift
-0.8659 0.0907
s.e. 0.1172 0.0137

sigma^2 estimated as 0.4673: log likelihood=-73.42
AIC=152.83 AICc=153.19 BIC=159.62

Training set error measures:
ME RMSE MAE MPE MAPE MASE ACF1
Training set -0.04660173 0.6692201 0.4396176 -0.6847646 3.393219 0.9150644 0.1119422
Series: x$Value
ARIMA(2,1,2) with drift

Coefficients:
ar1 ar2 ma1 ma2 drift
1.3171 -0.8973 -1.2696 0.7378 0.1369
s.e. 0.0973 0.0889 0.1584 0.1495 0.0916

sigma^2 estimated as 0.9726: log likelihood=-97.5
AIC=207.01 AICc=208.32 BIC=220.58

Training set error measures:
ME RMSE MAE MPE MAPE MASE ACF1
Training set -0.007610831 0.9441978 0.627121 23.63108 55.34784 0.9207112 -0.00091189
Series: x$Value
ARIMA(1,0,0) with non-zero mean

Coefficients:
ar1 intercept
0.3912 0.1423
s.e. 0.1076 0.0368

sigma^2 estimated as 0.03781: log likelihood=16.67
AIC=-27.34 AICc=-26.99 BIC=-20.51

Training set error measures:
ME RMSE MAE MPE MAPE MASE ACF1
Training set 0.000930651 0.1917348 0.1362479 -Inf Inf 0.8794182 0.05445404


I want to create multiple vectors which should be able to save the following information for all the 16 variables


  1. Order

  2. AICc value

  3. Log Likelyhood (Fit) etc.



Thank You.

Answer

You can get the AIC and Log Likelihood using arima_train$coef and arima_train$aic. For coefficients, use coef(arima_train). You could get the order by summing the coefficients

Comments