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

xreg for cvts #65

Closed ganesh-krishnan closed 7 years ago

ganesh-krishnan commented 7 years ago

AFAIK, we are not able to fit models with external regressors using cvts. If we did pass the xreg argument directly, it wouldn't work (since the xreg would need to be partitioned as well). I propose the following changes to the API:

  1. prepareData() to prepare the time series and external regressors. The function would look something like prepareData(tsInput, xreg) and will be of class hybridData
  2. cvts() will take data of class prepareData for fitting
  3. hybridMode()l will take data of class prepareData for fitting

EDIT: Also forgot to mention that my thought is that the code for breaking up the input series into folds should be a separate function. That function would generate the test/train splits based on the desired cross validation procedure (for now, rolling or not)

@dashaub What are your thoughts?

dashaub commented 7 years ago

@ganesh-krishnan Yes, that is definitely a limitation of cvts() and flaws the reported errors when cv.errors are used in hybridModel(). Your proposal sounds like a good way of handling it. It would be nice if cvts() and hybridModel() still handle regular ts or numeric class input series without the user having to call prepareData() first. We could do this by overloading those methods so that they create the hybridData class object first when called with ts or numeric class input and then call cvts() or hybridModel() as you propose.

What is the difference between the hybridData and prepareData classes? I'm understanding the usage as you propose as something like hybridModel(prepareData(rnorm(100))) or cvts(prepareData(rnorm(100))).

dashaub commented 7 years ago

See also #30

ganesh-krishnan commented 7 years ago

prepareData class was a typo. prepareData() produces an object of class hybridData

dashaub commented 7 years ago

Makes sense. I assumed they were they same.

ganesh-krishnan commented 7 years ago

Address by #69