'Computing extending window out of sample forecasts for 1, 5 and 22 periods (HAR-RV model)
I am trying to compute out-of-sample forecasts using an extending window for 1, 5 and 22 periods.
Currently I have separated my data into a training and testing part, fitted my lm model to the train data and I was able to predict one-step-ahead forecasts using my testing dataset:
test_data <- train_data + 1
EURGBP_final_train <- EURGBP_final[1:train_data,]
EURGBP_final_test <- EURGBP_final[test_data:nrow(EURGBP_final),]
EURGBP_HAR_RV <- lm(EURGBP_final_train$`EUR/GBP RV`~EURGBP_final_train$`EUR/GBP_RV_1`+EURGBP_final_train$`EUR/GBP_RV_5`+EURGBP_final_train$`EUR/GBP_RV_22`)
EURGBP_final_test$pred1 <-predict(EURGBP_HAR_RV, vcov.=vcov, newdata = EURGBP_final_test)
I would appreciate any assistance with how to make this an extending and rolling window forecast, as well as how to specify the number of periods ahead.
Thank you :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
