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:
- Are there any guidance on how to select i and j ranges? Are i and j independent?
- Is there a rule to avoid overfitting? How does it take into account models' nesting?