# Forecasting: regression model with ARIMA errors

Hello, everyone,

I would like to create a forecast with my regression model using ARIMA Errors. I am therefore seeking for a method to forecast 52 steps ahead.

In a first step I am defining a model from training data:

``````xreg2 <- as.matrix(external_data_train[,c("F3","F6","F12", "F16", "F28", "F31", "F33", "F39", "F42")])
arima_reg_ext <- auto.arima(train,
xreg=xreg2,
d = NA,
D = NA,
stationary = FALSE,
seasonal = TRUE,
ic = c("aicc", "aic", "bic"),
stepwise = TRUE,
trace = TRUE, ## AM ENDE MIT FALSE BERECHNEN!
approximation = FALSE,
method = NULL,
seasonal.test = c("seas", "ocsb", "hegy", "ch"),
allowdrift = TRUE,
allowmean = TRUE,
lambda = "auto",
# Best model: Regression with ARIMA(0,1,0)            errors
``````

Plotting the results gives the following Graphs (blue= training data & red=arima_reg_ext model)

Just as a sidenote: This is already worse than just using ARIMA without regression.

Anyway that model actually fits quiet well. I therefore will use this model to Forecast one year (52 weeks) in advance:

``````# defining the regression data in advance (a lot of dummy variables are used)
xreg3 <- as.matrix(alldata.complete_test[,c("F3","F6","F12", "F16", "F28", "F31", "F33", "F39", "F42")])
fcast<- forecast::forecast(arima_reg_ext, xreg=xreg3, h=52)
``````

``````# Warning:
In forecast.forecast_ARIMA(arima_reg_ext, xreg = xreg3, h = 52) :
Upper prediction intervals are not finite.
``````

And if I plot the values, the forecast is incredibly bad.

``````par(mfrow = c(1,1))
plot(test, col="blue")
lines(fcast\$mean, col="red")
``````