When using a single step forecast for newpreds, foreccomb function keeps on failing with error:
Error in `colnames<-`(`*tmp*`, value = colnames(prediction_matrix)) :
attempt to set 'colnames' on an object with less than two dimensions
I have tried different sample data sets and issue has always occurred. Here is the code to reproduce the issue:
library(fpp2)
library(forecast)
library(ForecastComb)
h=1 # Change value to > 1 for the code to work
ft_e <- ets(austa)
fs_e <- forecast(ft_e, h = h)
ft_a <- auto.arima(austa)
fs_a <- forecast(ft_a, h = h)
train_o <- austa
train_p <- cbind(fs_e$fitted, fs_a$fitted)
test_p <- cbind(fs_e$mean, fs_a$mean)
data <- foreccomb(train_o, train_p, newpreds=test_p)
fit <- comb_SA(data)
As a workaround is it okay to run the forecomb without newpred argument and multiply the weights returned by combination function to the forecast directly. Not sure if it yields the same result.... Something like this:
data <- foreccomb(train_o, train_p)
fit <- comb_SA(data)
sum(fit$Weights * test_p)
Hi,
thank you for using our package and notifying us about the issue. I have pushed an update of the package onto github that fixes the issue at hand.
Best regards
When using a single step forecast for newpreds, foreccomb function keeps on failing with error:
I have tried different sample data sets and issue has always occurred. Here is the code to reproduce the issue:
As a workaround is it okay to run the forecomb without newpred argument and multiply the weights returned by combination function to the forecast directly. Not sure if it yields the same result.... Something like this: