Hi I have hourly data (one obs one hour) with multiple seasonality. I would like to fit an ARIMA model using forecast R package taking into account the multiple seasonality, maybe taking also in account external regressor (on a train and a test set).

I initialize my data as:

entrate.train.msts <- msts(data = train[,"entrate"], seasonal.periods = c(24,24*7))
entrate.test.msts <- msts(data = test[,"entrate"], seasonal.periods = c(24,24*7))

My first question is: is the order of seasonal.periods indifferent? I would naturally say first set daily data, then the weekly dependency.

My second group of questions is about how to select the best ARIMA models using Fourier analysis. Searching around Google and SO I come out with the following code that does a form of grid selection:

bestfit <- list(aicc=Inf)
bestfourier <- numeric(2)

for (i in 1:5) {# daily cycle
  for (j in 1:5) { #weekly cycle
    #specifying the fourier temrs
    myfourier <- c(i,j)
    #specifying the ARIMAX regressors: holidays bin + fourier terms
    xregressors <- cbind(fourier(entrate.train.msts, K=myfourier),xregs.hourly.train)
    #fitting the model
    fit_model <- auto.arima(y = entrate.train.msts, seasonal = FALSE, xreg = xregressors, stepwise = TRUE,lambda = "auto")
#better model has lower aicc
    if (fit_model$aicc < bestfit$aicc) {
      bestfit <- fit_model
      bestfourier <- myfourier
    }
  }
}

My questions are the following:

  1. Are there any guidance on how to select i and j ranges? Are i and j independent?
  2. Is there a rule to avoid overfitting? How does it take into account models' nesting?

auto.ARIMA can't process multiple seasonalities.

Based on the code you share, I think TBATS is a better option for you than auto.arima, although it is based on ETS, not ARIMA models, it uses Fourier terms to fit complex seasonalities the way you seem to be trying to achieve using ARIMA and xregs.

Regarding overfitting, the fact that you are using the AICc instead of the RMSE already addresses that issue, since it includes a regularization term along with the error.


In response to the comment: The BSTS package can handle multiple seasonalities using Fourier terms and additional external regressors. It uses a state space model similar in spirit to ETS, however it uses a completely different training approach (not based on the AIC).

  • Thanks Alex the reason I needed to use the armax approach is that I need to allow for other predictors in addition to the Fourier terms – Giorgio Spedicato Nov 7 at 19:58
  • @GiorgioSpedicato see edit. – Alex Nov 7 at 20:02

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.