18.1 Conditional expectation

As discussed in Sections 5.3 and 6.3, the conditional h steps ahead expectation is in general available only for the pure additive models. In the cases of pure multiplicative ones, the point forecasts would correspond to conditional expectations only for \(h \leq m\) for seasonal models and \(h=1\) for models with the trend. The one exception is the ETS(M,N,N) model, where the point forecast corresponds to the conditional expectation for any horizon as long as the expectation of the error term \(1+\epsilon_t\) is equal to one. When it comes to the mixed models (Section 7.2), the situation would depend on the specific model, but in general, the same logic as for the pure multiplicative ones applies. In this case, the conditional expectations need to be obtained via other means. This is when the simulations come into play.

18.1.1 Simulating demand trajectories

The general idea of this approach is to use the estimated parameters, last obtained state vector (level, trend, seasonal, ARIMA components etc.) and the estimate of the scale of distribution to generate the possible paths of the data. The simulation itself is done in several steps after obtaining parameters, states and scale:

  1. Generate \(n \times h\) (where \(n\) is the number of time series to produce) random variables for the error term, \(\epsilon_t\) or \(1+\epsilon_t\) – depending on the type of error, assumed distribution in the model (the latter was discussed in Sections 5.5 and 6.5) and estimated parameters of distribution (typically, scale);
  2. Generate actual values from \(n\) models with the provided state vector, transition, measurement and persistence matrices and the generated error terms for the subsequent \(h\) observations. In a general case, this is done using the model (7.1);
  3. Take expectations for each horizon from 1 to \(h\).

A thing to note is that in the case of multiplicative trend or multiplicative seasonality, it makes sense to take trimmed mean instead of the basic arithmetic one. This is because the models with these components might exhibit explosive behaviour, and thus the expectation might become unrealistic. I suggest using 1% trimming, although this does not have any scientific merit and is only based on my personal expertise.

The simulation-based approach is universal, no matter what model is used, and can be applied to any ETS, ARIMA, regression model or combination (including dynamic ETSX, intermittent demand and multiple frequency models). Furthermore, instead of taking expectations on step 3, one can take geometric means, medians or any desired quantile. This is discussed later in Subsection 18.3.2.

The main issue with this approach is that the conditional expectation and any other statistics calculated based on this will differ with every new simulation run. If \(n\) is small, these values will be less stable (vary more with the new runs). But they will reach some asymptotic values with the increase of \(n\), staying random nonetheless. However, this is a good thing because this randomness reflects the uncertain nature of these statistics in the sample: the true values are never known, and the estimates will inevitably change with the sample size change. Another limitation is the computational time and memory usage: the more iterations we want to produce, the more calculations will need to be done, and more memory will be used. Luckily, time complexity in this situation should be linear: \(O(h \times n)\).

18.1.2 Explanatory variables

If the model contains explanatory variables, then the h steps ahead conditional expectations should use them in the calculation. The main challenge in this situation is that the future values might not be known in some cases. This has been discussed in Section 10.2. Practically speaking, if the user provides the holdout sample values of explanatory variables, the forecast.adam() method will use them in forecasting. If they are not provided, the function will produce forecasts for each of the explanatory variables via the adam() function and use the conditional h steps ahead expectations in forecasting.

18.1.3 Demonstration in R

In order to demonstrate how the approach works, we consider an artificial case of ETS(M,M,N) model with \(l_t=1000\), \(b_t=0.95\), \(\alpha=0.1\), \(\beta=0.01\), and Gamma distribution for error term with scale \(s=0.05\). We generate 1000 scenarios from this model for the horizon of \(h=10\) using sim.es() function from smooth package:

After running the code above, we will obtain an object y that will contain several variables, including y$data with all the 1000 possible future trajectories. We can plot them to get an impression of what we are dealing with (see Figure 18.1):

Data generated from 1000 ETS(M,M,N) models.

Figure 18.1: Data generated from 1000 ETS(M,M,N) models.

Based on the plot in Figure 18.1, we can see what the conditional h steps ahead expectation (black line) and what the 95% prediction interval will be for the data based on the ETS(M,M,N) model with the parameters mentioned above.