Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tsCV function is not working when xreg is provided #864

Closed
john-grando opened this issue Oct 22, 2020 · 9 comments
Closed

tsCV function is not working when xreg is provided #864

john-grando opened this issue Oct 22, 2020 · 9 comments

Comments

@john-grando
Copy link

john-grando commented Oct 22, 2020

When using the xreg option in the tsCV() function I encountered a few issues and decided to look into them. I prepared a report summarizing the findings and proposed fixes for this function. Thank you so much for providing this great resource. Please let me know if you would like a pull request provided. I wasn't sure how you had this project set up and didn't want to just push something without checking.

Report
Edited tsCV file

@robjhyndman
Copy link
Owner

Thanks for bringing this to my attention. I've implemented a simpler fix in 9c79dc3.
Please test it and let me know if it is now working. I've added an example to help(tsCV) to show how to implement a function with an xreg argument.

As this package is now in "retired" mode, we are not adding new functionality -- just fixing any bugs that arise and keeping it maintained as required.

@tamas-ferenci
Copy link

Dear @robjhyndman , is/will tsCV be included in fable...?

@mitchelloharawild
Copy link
Collaborator

Dear @robjhyndman , is/will tsCV be included in fable...?

Refer to this resource for how cross-validation can be done in {fable}: https://otexts.com/fpp3/tscv.html

Some discussion on potential improved/alternative interfaces for cross-validation is here: tidyverts/fabletools#180

@tamas-ferenci
Copy link

Thank @mitchelloharawild for the extremely prompt reply!

As a sidenote, I think parameter h is not passed to the function in the far2_xreg example of the manual.

@mitchelloharawild
Copy link
Collaborator

As a sidenote, I think parameter h is not passed to the function in the far2_xreg example of the manual.

I'm not sure which example you're referring to, could you provide a link to this?

@tamas-ferenci
Copy link

#' far2_xreg <- function(x, h, xreg, newxreg) {

The function has a parameter h, but it is never used within the function.

@mitchelloharawild
Copy link
Collaborator

mitchelloharawild commented Dec 30, 2020

The forecast.Arima() horizon h is taken to be the number of rows in newxreg, which is produced in tsCV to have h rows. You could pass in h also, but it would be overwritten by nrow(newxreg).

To add to this, the h parameter is required as it needed by tsCV.

@tamas-ferenci
Copy link

I see, thank you very much!

@mitchelloharawild
Copy link
Collaborator

Closing as this is fixed.
The {forecast} package is retired, and this is also possible to be done in {fable}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants