Hello there,
I have a question regarding your loop for Multi-step forecasts, re-estimation with Arima and Regressions. I am looking for four different loops:
- Multi-step forecasts, without re-estimation,
- Multi-step forecasts, re-estimation (Regression & Arima)
- Multi-step forecasts, re-estimation (Regression), refit Arima model
- Multi-step forecasts, re-estimation, refit Regression & Arima model
I am currently working with the following:
xreg <- as.matrix(outlier.data[,c("LS53","AO156")])
h <- 1
n <- length(test) - h +1
arima_reg_outlier_mat <- matrix(0, nrow=n, ncol=h)
for(i in 1:n)
{
x <- window(ts, end=c(2018, 52) + (i-1)/52)
refit <- Arima(x, model=arima_reg_outlier, xreg=xreg)
arima_reg_outlier_mat[i,] <- fabletools::forecast(refit, h=h)$mean
}
For refit the Arima Model I use
h <- 1
n <- length(test) - h +1
arima_reg_outlier_mat <- matrix(0, nrow=n, ncol=h)
for(i in 1:n)
{
x <- window(ts, end=c(2018, 52) + (i-1)/52)
refit <- auto.arima(x, xreg=xreg)
arima_reg_outlier_mat[i,] <- fabletools::forecast(refit, h=h)$mean
}
But I receive the following error for that one:
The chosen seasonal unit root test encountered an error when testing for the second difference.
From stl(): series is not periodic or has less than two periods
1 seasonal differences will be used. Consider using a different unit root test.
But I don't know how to write the other two loops.
I would be very thankful if you could help me out with this.
Thank you very much and have a nice weekend.
Kind regards,
Lukas