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

unclear forecast value for R timeseries #76

Closed liorg2 closed 7 years ago

liorg2 commented 7 years ago

I am using hybridForecast R package , and I'm not sure what I'm doing wrong to get a negative forecast for array of possitive numbers:

example:

library("forecastHybrid") hits=c(1969,2552,3407,3768,1302,2988,3760,2822,3012,2945,2979,3180,4421) model <- hybridModel(y = hits) fc <- forecast(model, h = 1) plot(fc)

upper <- as.numeric(fc[["upper"]][1, 2]) #5107 lower <- as.numeric(fc[["lower"]][1, 2])# -24198 baseline <- as.numeric(fc["mean"][[1]]) # -2143

dashaub commented 7 years ago

Nothing wrong with how you're using hybridModel(). It looks like the nnetar model is doing a very poor job on this particular dataset and generating a negative forecast:

plot(forecast(model$nnetar))

Take a look at the other individual component models. They're generating flatline forecasts too (with the exception of thetam), so this timeseries either doesn't have much signal or you need more data for any of these models to produce an interesting forecast. At a minimum I'd remove the nnetar model from the ensemble. This looks decent given the limited data.

plot(forecast(hybridModel(hits, model = "aeft")))
liorg2 commented 7 years ago

thank you for your answer. I did it and it solved the problem with this data. the thing I'm afraid of, is that for other dataset the arima model will return strange response, and then I will have to change it to "eft" :) can I set another param that will help with that? by the way, I'm a programmer, not a statistician .. thanks again, Lior

dashaub commented 7 years ago

Take with a big grain of salt: I've found that auto.arima/tbats models very rarely give extremely bad forecasts while ets/nnetar can fail badly on some timeseries. So for now building models with only those two could avoid really bad models like happens with this dataset.

As a more permanent fix, we could do some sort of model selection procedure. We've thought about this a while ago but not recently. As a somewhat easier task, we could just test the forecasts produced by each component model and issue a warning if one model is very different from the other. This wouldn't be a statistically rigorous procedure but it could work ok for real world applications.

liorg2 commented 7 years ago

thanks a lot sir

On Fri, May 12, 2017 at 6:57 PM, David Shaub notifications@github.com wrote:

Take with a big grain of salt: I've found that auto.arima/tbats models very rarely give extremely bad forecasts while ets/nnetar can fail badly on some timeseries. So for now building models with only those two could avoid really bad models like happens with this dataset.

As a more permanent fix, we could do some sort of model selection procedure. We've thought about this a while ago but not recently. As a somewhat easier task, we could just test the forecasts produced by each component model and issue a warning if one model is very different from the other. This wouldn't be a statistically rigorous procedure but it could work ok for real world applications.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ellisp/forecastHybrid/issues/76#issuecomment-301116000, or mute the thread https://github.com/notifications/unsubscribe-auth/ABnP_7dOfJD1VQDVgZA6NQ7qpyY0PnWkks5r5IFhgaJpZM4NQjZE .