## 13.4 Examples of application

We consider the same example from Section 13.1. We remember that in that example, both demand occurrence and demand sizes increase over time (Figure 13.1), meaning that we can try the model with the trend for both parts. This can be done using the adam() function from the smooth package, defining the type of occurrence to use. We will try several options and select the one that has the lowest AICc:

adamiETSy <- vector("list",4)
occurrence="odds-ratio")
occurrence="inverse-odds-ratio")
occurrence="direct")
occurrence="general")
c("odds-ratio", "inverse-odds-ratio",
"direct", "general"))
adamiETSyAICcs
##         odds-ratio inverse-odds-ratio             direct            general
##           359.5494           360.5086           354.4810           371.6503

Based on this, we can see that the model with direct probability has the lowest AICc. We can show how the model approximates the data and produces forecasts for the holdout: Figure 13.7: The fit of the best model to the intermittent data.

Figure 13.7 shows that the model captured the trend well for both demand occurrence and demand sizes parts. It forecasts that the mean demand will increase for the holdout period. We can also explore the demand occurrence part of this model by typing:

adamiETSy[[i]]\$occurrence
## Occurrence state space model estimated: Direct probability
## Underlying ETS model: oETS[D](MMdN)
## Smoothing parameters:
## level trend
##     0     0
## Vector of initials:
##  level  trend
## 0.0463 1.1343
##
## Error standard deviation: 1.4805
## Sample size: 110
## Number of estimated parameters: 5
## Number of degrees of freedom: 105
## Information criteria:
##      AIC     AICc      BIC     BICc
## 103.5314 104.1083 117.0338 118.3897

In our example, the smoothing parameters are equal to zero for the demand occurrence part, which makes sense because the selected model is the damped multiplicative trend one, which should capture the increasing probability of occurrence well.

Depending on the generated data, there might be issues in the ETS(M,Md,N) model for demand sizes, if the smoothing parameters are large. So, we can try out the logARIMA(1,1,2) to see how it compares with this model. Given that ARIMA is not yet implemented for the occurrence part of the model, we need to construct it separately and then use in adam():

oETSModel <- oes(y, "MMdN", h=10, holdout=TRUE,
occurrence=oETSModel,
orders=c(1,1,2),
distribution="dlnorm")
adamiARIMA
## Time elapsed: 0.06 seconds
## Model estimated using adam() function: iARIMA(1,1,2)[D]
## Occurrence model type: Direct
## Distribution assumed in the model: Mixture of Bernoulli and Log-Normal
## Loss function type: likelihood; Loss function value: 128.0496
## ARMA parameters of the model:
## AR:
## phi1
##  -0.209
## MA:
## theta1 theta2
##   -0.4984    0.0283
##
## Sample size: 110
## Number of estimated parameters: 6
## Number of degrees of freedom: 104
## Information criteria:
##      AIC     AICc      BIC     BICc
## 361.6306 362.4461 377.8335 379.7502
##
## Forecast errors:
## Asymmetry: -70.393%; sMSE: 46.286%; rRMSE: 1.071; sPIS: 3196.961%; sCE: -386.317%

Comparing the iARIMA model with the previous iETS based on AIC would not be fair because as soon as the occurrence model is provided to the adam(), he does not count the parameters estimated in that part towards the overall number of estimated parameters. To make the comparison fair, we need to estimate ADAM iETS similarly:

adamiETSy[[i]] <- adam(y, "MMdN", h=10, holdout=TRUE,
occurrence=oETSModel)
adamiETSy[[i]]
## Time elapsed: 0.04 seconds
## Model estimated using adam() function: iETS(MMdN)[D]
## Occurrence model type: Direct
## Distribution assumed in the model: Mixture of Bernoulli and Gamma
## Loss function type: likelihood; Loss function value: 119.067
## Persistence vector g:
## alpha  beta
##     0     0
## Damping parameter: 0.9985
## Sample size: 110
## Number of estimated parameters: 6
## Number of degrees of freedom: 104
## Information criteria:
##      AIC     AICc      BIC     BICc
## 343.6655 344.4810 359.8684 361.7851
##
## Forecast errors:
## Asymmetry: -88.492%; sMSE: 53.022%; rRMSE: 1.146; sPIS: 3703.305%; sCE: -542.075%

Comparing information criteria, the iETS model is more appropriate for this data. But this might be due to different distributional assumptions and difficulties estimating the ARIMA model. If you want to experiment more with iARIMA, you might try fine-tuning its parameters (see Section 11.4.1) for the data either by increasing the maxeval or changing the initialisation, for example:

adamiARIMA <- adam(y, "NNN", h=10, holdout=TRUE,
occurrence=oETSModel, orders=c(1,1,2),
distribution="dgamma", initial="back")

Finally, we can produce point and interval forecasts from either of the model via the forecast() method. Here is an example:

adamiETSyForecasts <- forecast(adamiETSy[[i]], h=10,
interval="prediction", nsim=10000)
plot(adamiETSyForecasts) Figure 13.8: Point forecasts and prediction interval from the iETS(M,Md,N)$$_D$$ model.

In Figure 13.8, the interval is expanding, reflecting the captured tendency of level for growth. The prediction intervals produced from multiplicative ETS models will typically be simulated if interval="prediction", so to make them smoother, you might need to increase the nsim parameter, for example, to nsim=100000.