I am performing a time series analysis on a daily time series. I know that there is a weekly period (7 days) and also a montly seasonality. For now, i set the time series object in R using a ts(x=mysequence, frequency = 7)
and modeled the time series using an auto.arima
with xreg
parameter containing a 11 columns matrix of dummies tied to each months (January base level). I was told that a better approach to handle multiple seasonality (within ARIMA context) is to use Fourier terms instead of monthly dummies. So I come out with this code from Rob Hyndman:
library(forecast)
y <- ts(x, frequency=7)
z <- fourier(ts(x, frequency=365.25), K=5)
zf <- fourierf(ts(x, frequency=365.25), K=5, h=100)
fit <- auto.arima(y, xreg=cbind(z,holiday), seasonal=FALSE)
fc <- forecast(fit, xreg=cbind(zf,holidayf), h=100)
My doubt is twofold:
- what is the criteria to choose K for montlhy patterns? How can I perform a - priori selection of K?
- why the code shows seasonal=FALSE. I would put seasonal = TRUE to capture weekly frequency patters.
I am using R and forecast R package to perform the analysis.