Solved – Exogeneous regressors in auto.arima and using them in forecast function in R

arimaautoregressiveforecastingr

I'm trying to forecast a seasonal time series based on its historical values, and also two more time series (that are seasonal themselves.)

I'm trying to use an auto.arima, and I'm going to input the other two time series (the exogeneous regressors) as a contatenated list of dummy variables, in auto.arima's xreg parameter.

I am having difficulty how to use the forecast function after this point. I've written up the following code, but I don't understand what I should put in the xreg and newxreg parameters of the forecast function.

tempfit<-auto.arima(dnew, xreg=dExt)
plot(forecast(tempfit, xreg=dnew1,newxreg=dExt1))

Also, my data points for these three series were all values per day that had a seven day seasonality. In order to let auto.arima calculate the (p,q,d) for seasonality, I converted them to time series with a frequency of 7. Now, after forecasting is done, the plot shows one unit for every seven days. How can I covert this back to one unit per day?

Further, do you happen to know how we can input a set of external regressors to an ETS model?

EDIT:

I just saw the following page from Dr. Hyndman:
Time series modeling with dynamic regressors in SAS vs R

Is it safe to assume that I don't need to enter a newxreg parameter for my forecast?

Also, I want to know if it's statistically correct to use the two external regressors in xreg, but then also use a number of dummy variables in xreg that will represent the seasonality of these two variables.

Best Answer

If you fit an arima model with external regressions, you MUST provide newxreg to the predictions function. This goes for arima, auto.arima, and Arima. You cannot provide external regressors to ets.

xreg should contain the exogenous variables for the training set, and newxreg should contain those variables for the prediction set. If the nexreg contains variables you do not know the future values of, you will either need to forecast these variables or exclude them from the model.