## 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.244. We will do something similar here, using Log-Normal distribution, thus working with Log-ARIMA. 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:

`log(AirPassengers) |> plot()`

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]
## 979.2215 1181.2866
## logSARIMA(1,1,2)(0,1,1)[12]
## 1027.5676
```

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 the 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 a 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.12 seconds
## Model estimated using adam() function: ETS(MMM)
## Distribution assumed in the model: Gamma
## Loss function type: likelihood; Loss function value: 467.5831
## Persistence vector g:
## alpha beta gamma
## 0.7707 0.0075 0.0005
##
## Sample size: 132
## Number of estimated parameters: 17
## Number of degrees of freedom: 115
## Information criteria:
## AIC AICc BIC BICc
## 969.1663 974.5347 1018.1739 1031.2804
##
## Forecast errors:
## ME: -3.676; MAE: 15.766; RMSE: 21.721
## sCE: -16.804%; Asymmetry: -7.8%; sMAE: 6.006%; sMSE: 0.685%
## MASE: 0.655; RMSSE: 0.693; rMAE: 0.207; rRMSE: 0.211
```

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

`1]] adamLogSARIMAAir[[`

```
## Time elapsed: 0.16 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: 471.2455
## ARMA parameters of the model:
## MA:
## theta1[1] theta1[12]
## -0.2915 -0.5586
##
## Sample size: 132
## Number of estimated parameters: 16
## Number of degrees of freedom: 116
## Information criteria:
## AIC AICc BIC BICc
## 974.4910 979.2215 1020.6159 1032.1647
##
## Forecast errors:
## ME: -12.741; MAE: 13.762; RMSE: 18.986
## sCE: -58.248%; Asymmetry: -91.5%; sMAE: 5.243%; sMSE: 0.523%
## MASE: 0.571; RMSSE: 0.606; rMAE: 0.181; rRMSE: 0.184
```

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.