Search code examples
rtime-seriesensemble-learning

How to do ensembles with time series using AICc?


Start by making a very simple ensemble time series model, using data from the book Forecasting Principles and Practice, 3rd edition:

library(fpp3)

Time_Series <- fpp3::aus_airpassengers

fit <- Time_Series %>% 
  model(
    Ets1 = ETS(Passengers ~ season() + trend()),
    Ets2 = ETS(Passengers ~ trend())
    ) %>% 
    mutate(combination = (Ets1 + Ets2)/2)

Now measure the results using AICc:

Results <- 
  fabletools::glance(fit) %>%
  dplyr::select(.model, AICc) %>%
  dplyr::arrange(AICc)

This returns the error:

no applicable method for 'glance' applied to an object of class "model_combination"

While RMSE does work, the text states, "Consequently, we recommend that one of the AICc, AIC, or CV statistics be used, each of which has forecasting as their objective..., In most of the examples in this book, we use the AICc value to select the forecasting model." (source: https://otexts.com/fpp3/selecting-predictors.html)

So how can the results of the time series ensemble be measured using AICc?


Solution

  • An ensemble is not a model, and so there is no likelihood. Without a likelihood, you can't compute the AICc (or other penalized likelihood measures).

    In theory, you could define a "model" as $y_t = \hat{y}{t|t-1} + \varepsilon_t$, where $\hat{y}{t|t-1}$ is the one-step forecast obtained from the combination. Then the Gaussian "likelihood" could be obtained assuming the errors are normally distributed. However, it is not obvious how to define the model degrees of freedom, needed to compute the AICc penalty. It is not simply the sum of the two component model degrees of freedom, because the errors from the component models are almost certainly highly correlated. Perhaps the average of the two would work, but to my knowledge, no-one has developed the theory for that.