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

no error when forecast is given a single number as an object #52

Closed ellisp closed 7 years ago

ellisp commented 7 years ago

Our tests expect an error in this situation but forecast::forecast does return a (uninteresting) forecast. I'm inclined to remove the test.

> expect_error(forecast(object = 1))
Error: forecast(object = 1) did not throw an error.
> forecast(object = 1)
   Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
1               1    NA    NA    NA    NA
2               1    NA    NA    NA    NA
3               1    NA    NA    NA    NA
4               1    NA    NA    NA    NA
5               1    NA    NA    NA    NA
6               1    NA    NA    NA    NA
7               1    NA    NA    NA    NA
8               1    NA    NA    NA    NA
9               1    NA    NA    NA    NA
10              1    NA    NA    NA    NA
dashaub commented 7 years ago

This might be a recent change of behavior in forecast. Some fixes were added to auto.arima and/or ets for short time series. We can drop the test since it works now, and really I don't know why we were testing this anyway. My guess is it was included as a mistake.

This is really a separate issue/bug that I came across while thinking about it, but check this out:

> forecast(hybridModel(ts(1), models = "ae"))
Fitting the auto.arima model
Fitting the ets model
Error in rep(modelResults$weights[includedModels], times = nrow(fits)) : 
  invalid 'times' argument

Enforcing a minimum series length (perhaps 4) in hybridModel() could make sense.