3

Ok, so we know from the forecast package documentation that hw() is basically a wrapper function for forecast(ets(...)). However, I would like to know exactly which ETS formulation is equivalent to fitting + forecasting an "additive" Holt-Winters (as in hw(x, seasonal="additive") and a "multiplicative" Holt-Winters (as in hw(x, seasonal="multiplicative").

(i) I guess that an "additive" Holt-Winters formulation can be achieved using the ets function with model="AAA" (results are approximately the same, usually small differences in decimal points or first units). Is that correct?

(ii) What about the ETS equivalent for the multiplicative Holt-Winters - hw(x, seasonal="multiplicative")?

Thanks in advance!

Mushrambo
  • 133
  • 3
  • 8

1 Answers1

1

R is open source. Just look at the code. It is not difficult. Here is the first part of the hw() function.

> hw
function(y, h = 2 * frequency(x), seasonal = c("additive", "multiplicative"), damped = FALSE,
               level = c(80, 95), fan = FALSE, initial=c("optimal", "simple"), exponential=FALSE,
               alpha=NULL, beta=NULL, gamma=NULL, phi=NULL, lambda=NULL, biasadj=FALSE, x=y, ...) {
  initial <- match.arg(initial)
  seasonal <- match.arg(seasonal)
  m <- frequency(x)
  if (m <= 1L) {
    stop("The time series should have frequency greater than 1.")
  }
  if (length(y) < m + 3) {
    stop(paste("I need at least", m + 3, "observations to estimate seasonality."))
  }
  if (initial == "optimal" || damped) {
    if (seasonal == "additive" && exponential) {
      stop("Forbidden model combination")
    } else if (seasonal == "additive" && !exponential) {
      fcast <- forecast(ets(x, "AAA", alpha = alpha, beta = beta, gamma = gamma, phi = phi, damped = damped, opt.crit = "mse", lambda = lambda, biasadj = biasadj), h, level = level, fan = fan, ...)
    } else if (seasonal != "additive" && exponential) {
      fcast <- forecast(ets(x, "MMM", alpha = alpha, beta = beta, gamma = gamma, phi = phi, damped = damped, opt.crit = "mse", lambda = lambda, biasadj = biasadj), h, level = level, fan = fan, ...)
    } else { # if(seasonal!="additive" & !exponential)
      fcast <- forecast(ets(x, "MAM", alpha = alpha, beta = beta, gamma = gamma, phi = phi, damped = damped, opt.crit = "mse", lambda = lambda, biasadj = biasadj), h, level = level, fan = fan, ...)
    }
  }

You don't have to read far to see that if seasonal='multiplicative' and exponential=FALSE (the default), then the model is MAM.

Rob Hyndman
  • 30,301
  • 7
  • 73
  • 85
  • Thanks, professor. I've got it. To replicate the multiplicative hw() with the ETS, the parameters should be set like: `forecast(ets(x, "MAM", alpha = NULL, beta = NULL, gamma = NULL, phi = NULL, damped = FALSE, opt.crit = "mse", lambda = NULL, biasadj = FALSE), h = steps)$mean`. The problem was the damped argument, which is set to `NULL` in default `ets()`, while set to `FALSE` in default `hw()` – Mushrambo Jun 20 '18 at 17:27