I have the following ARMA(1,0,1) model that I am Forecasting:
nrow(Reg_data)
train<-Reg_data[0:(nrow(Reg_data)-7),c(4,5,9)]
test<-Reg_data[(nrow(Reg_data)-6):nrow(Reg_data),4]
View(train)
View(test)
#step 2 get forecast prediction and errors for auto.arima model
attach(train)
mod1<-arima(y,c(1,0,1), include.mean = TRUE)
mod1_results<-forecast(mod1,h=7)
ARMA_Forecasts<-t(t(mod1_results$mean))
This code seems to work but I can't seem to find (or understand) if this function uses its previous forecasts in the history set, i.e. for forecast h=2 is the h=1 estimate taken into consideration, or if I want this do I need to write a rolling window loop and forecast one set (h=1) several times?
ARIMA uses recursive forecasting, so for each new step, it uses history (i.e. the train set) + the forecasts it generated for previous step.
The idea is the following: Build a model using the historical data, and use that model to predict the value for h=1, then feed that forecast back into the model to generate the forecast for h=2, and then feed that back into the model to generate h=3, etc...until the desired forecast horizon is achieved.