How can i run forecast::HoltWinters?

rainseriesforecasts2 <- forecast.HoltWinters(rainseriesforecasts, h=8)
Error in forecast.HoltWinters(rainseriesforecasts, h = 8) : 
  could not find function "forecast.HoltWinters"

I installed forecast function at my R but could not work!
Could you give me any solutions for this?

Thank you very much!

Insang

Welcome to the community!

forecast.HoltWinters will not be available directly if you just use library(forecast).

You'll have to explicitly call forecast:::forecast.HoltWinters. (note the triple colons :::)

Hope this helps.

1 Like

You should be careful about using ::: to access objects inside packages. These are objects the package author chose not to export. With a language like R, where you're free to inspect and manipulate almost everything, most protections are just "gentlemen's and ladies' agreements." One of them is that package updates shouldn't change exported functions enough to break user code. Conversely, users shouldn't expect unexported functions to work the same or even exist.

There are two ways to do your task with functions exported by forecast. First is the "standard way" of creating a model object and then forecasting with it:

hw_model <- HoltWinters(rainseriesforecasts)
rainseriesforecasts2 <- forecast(hw_model, h=8)

Next is the "shortcut" function hw that creates a model and forecasts from it:

hw(rainseriesforecasts, h = 8)
2 Likes

thank you very much for your kind answer! I tried it and it worked well!
Insang

Thank you so much for your kind answer! It worked very well!
Insang

Thank you veyr much for your great and perfect solution!
Thank you million!
Insang

If your question's been answered, would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.