## 9.5 Examples of application

Building upon the example with `AirPassengers`

data from Section 8.5.2, we will construct several multiplicative ARIMA models and see which one is the most appropriate for the data. As a reminder, the best additive ARIMA model was SARIMA(0,2,2)(1,1,1)\(_{12}\), which had AICc of 1028.828. We will do something similar here, using Log-Normal distribution, thus working with logARIMA. To understand what model can be used in this case, we can take the logarithm of data and see what happens with the components of time series:

`plot(log(AirPassengers))`

We still have the trend in the data, and the seasonality now corresponds to the additive rather than the multiplicative (as expected). While we might still need the second differences for the non-seasonal part of the model, taking the first differences for the seasonal should suffice because the logarithmic transform will take care of the expanding seasonal pattern in the data. So we can test several models with different options for ARIMA orders:

```
<- vector("list",3)
adamLogSARIMAAir # logSARIMA(0,1,1)(0,1,1)[12]
1]] <-
adamLogSARIMAAir[[adam(AirPassengers, "NNN", lags=c(1,12),
orders=list(ar=c(0,0), i=c(1,1), ma=c(1,1)),
h=12, holdout=TRUE, distribution="dlnorm")
# logSARIMA(0,2,2)(0,1,1)[12]
2]] <-
adamLogSARIMAAir[[adam(AirPassengers, "NNN", lags=c(1,12),
orders=list(ar=c(0,0), i=c(2,1), ma=c(2,2)),
h=12, holdout=TRUE, distribution="dlnorm")
# logSARIMA(1,1,2)(0,1,1)[12]
3]] <-
adamLogSARIMAAir[[adam(AirPassengers, "NNN", lags=c(1,12),
orders=list(ar=c(1,0), i=c(1,1), ma=c(2,1)),
h=12, holdout=TRUE, distribution="dlnorm")
names(adamLogSARIMAAir) <- c("logSARIMA(0,1,1)(0,1,1)[12]",
"logSARIMA(0,2,2)(0,1,1)[12]",
"logSARIMA(1,1,2)(0,1,1)[12]")
```

The thing that is different between the models is the non-seasonal part. Using the connection with ETS (discussed in Section 8.4), the first model should work on local level data, the second should be optimal for the local trend series, and the third one is placed somewhere in between the two. We can compare the models using AICc:

`sapply(adamLogSARIMAAir, AICc)`

```
## logSARIMA(0,1,1)(0,1,1)[12] logSARIMA(0,2,2)(0,1,1)[12]
## 982.5764 1096.8616
## logSARIMA(1,1,2)(0,1,1)[12]
## 993.0431
```

It looks like the logSARIMA(0,1,1)(0,1,1)\(_{12}\) is more appropriate for the data. In order to make sure that we did not miss anything, we analyse the residuals of this model (Figure 9.1):

```
par(mfcol=c(2,1), mar=c(2,2,2,1))
plot(adamLogSARIMAAir[[1]], which=10:11)
```

We can see that there are no significant coefficients on either ACF or PACF, so there is nothing else to improve in this model (we discuss this in more detail in Section 14.5). We can then produce forecast from the model and see how it performed on the holdout sample (Figure 9.2):

```
forecast(adamLogSARIMAAir[[1]], h=12, interval="prediction") |>
plot(main=paste0(adamLogSARIMAAir[[1]]$model," with Log-Normal distribution"))
```

The ETS model closest to the logSARIMA(0,1,1)(0,1,1)\(_{12}\) would probably be ETS(M,M,M), because the former has both seasonal and non-seasonal differences (see discussion in Subsection 8.4.4):

```
<- adam(AirPassengers, "MMM", h=12, holdout=TRUE)
adamETSAir adamETSAir
```

```
## Time elapsed: 0.11 seconds
## Model estimated using adam() function: ETS(MMM)
## Distribution assumed in the model: Gamma
## Loss function type: likelihood; Loss function value: 468.5176
## Persistence vector g:
## alpha beta gamma
## 0.7684 0.0206 0.0000
##
## Sample size: 132
## Number of estimated parameters: 17
## Number of degrees of freedom: 115
## Information criteria:
## AIC AICc BIC BICc
## 971.0351 976.4036 1020.0428 1033.1492
##
## Forecast errors:
## ME: -5.617; MAE: 15.496; RMSE: 21.938
## sCE: -25.677%; Asymmetry: -23.1%; sMAE: 5.903%; sMSE: 0.698%
## MASE: 0.643; RMSSE: 0.7; rMAE: 0.204; rRMSE: 0.213
```

Comparing information criteria, ETS(M,M,M) should be preferred to logARIMA, but in terms of accuracy on the holdout, logARIMA is more accurate than ETS on this data:

`1]] adamLogSARIMAAir[[`

```
## Time elapsed: 0.19 seconds
## Model estimated using adam() function: SARIMA(0,1,1)[1](0,1,1)[12]
## Distribution assumed in the model: Log-Normal
## Loss function type: likelihood; Loss function value: 472.923
## ARMA parameters of the model:
## MA:
## theta1[1] theta1[12]
## -0.2785 -0.5530
##
## Sample size: 132
## Number of estimated parameters: 16
## Number of degrees of freedom: 116
## Information criteria:
## AIC AICc BIC BICc
## 977.8460 982.5764 1023.9708 1035.5197
##
## Forecast errors:
## ME: -12.968; MAE: 13.971; RMSE: 19.143
## sCE: -59.285%; Asymmetry: -91.7%; sMAE: 5.322%; sMSE: 0.532%
## MASE: 0.58; RMSSE: 0.611; rMAE: 0.184; rRMSE: 0.186
```

If we decide to stick with the information theory approach, we should use ETS(M,M,M). If we are more inclined towards empirical selection, we would need to apply the models in the rolling origin fashion (Section 2.4), collect a distribution of errors and then decide, which one to choose.