ellisp / forecastHybrid

Convenient functions for ensemble forecasts in R combining approaches from the {forecast} package
GNU General Public License v3.0
79 stars 23 forks source link

Error on extractForecasts() from a Hybrid Model with cross validation #99

Closed mark0100 closed 1 year ago

mark0100 commented 1 year ago

I get an error when i try to extract the forecasts from a hybrid model with cross validation:

cvMod <- hybridModel(woolyrnq, models = "ns", weights = "cv.errors", rolling=T, windowSize = 100, cvHorizon = 5, horizonAverage = T, num.cores = 4) Fitting the nnetar model Fitting the stlm model Cross validating the nnetar model Cross validating the stlm model

extractForecasts(cvMod, horizon=5) Error in if (horizon > cv$params$maxHorizon) stop("Cannot extract forecasts with a horizon greater than the model maxHorizon") : argument is of length zero

traceback() 1: extractForecasts(cvMod, horizon = 5)

How do i get the forecasts that were used during cross validation from this hybrid model?

dashaub commented 1 year ago

extractForecasts() is for objects of class cvts created by cvts(). If you're wanting the individual forecasts from each cv step, use cvts() to create them, not hybridModel(); hybridModel(weights = "cv.errors") merely uses cv for selection of the weights to use for the forecasting.