# fourier terms for double seasonality in R [closed]

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:

1. what is the criteria to choose K for montlhy patterns? How can I perform a - priori selection of K?
2. 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.

## closed as off-topic by Xi'an, kjetil b halvorsen, Peter Flom♦Nov 26 '15 at 12:37

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – Xi'an, kjetil b halvorsen, Peter Flom
If this question can be reworded to fit the rules in the help center, please edit the question.

• Please make your example reproducible. – user81847 Nov 26 '15 at 1:58

## 1 Answer

1. Minimize the AICc

2. The seasonality is handled via the Fourier terms, so does not need to be handled via the ARIMA errors.