I have to forecast data with two seasonality with ARIMA. I find that I have to use a code like this:
myForecaster <- function (parameters, training_df_set, testing_df_set, fourier_order = 3) {
require(forecast)
y <- msts(training_df_set$bikes_mean, seasonal.periods = c(parameters$seasonal_period_day, parameters$seasonal_period_week))
seas <- fourier(y, K=c(fourier_order,fourier_order))
fit <- auto.arima(y, xreg=cbind(seas, training_df_set$regr), seasonal=FALSE)
prediction_horizon_lenght <- length(testing_df_set$bikes_mean)
seas.f <- fourierf(y, K=c(fourier_order,fourier_order), h=prediction_horizon_lenght)
forecaster <- forecast(fit, xreg=cbind(seas.f, testing_df_set$regr), h=prediction_horizon_lenght)
lista <- list(fit, forecaster, forecaster[['mean']]-testing_df_set$bikes_mean)
names(lista) <- c("fit", "forecaster", "h_error")
return (lista)
}
The questions are:
1) If I have a lot of regressors how can I choose between them the best subset for the ARIMA regressor?
2) Should the predictor series be already stationary when passed to the auto.arima or auto.arima automatically tranform the predictors to stationary to perform the parameter estimation?