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

Inconsistent output length with tk_make_future_timeseries #19

Closed
erbas opened this issue Aug 1, 2018 · 1 comment
Closed

Inconsistent output length with tk_make_future_timeseries #19

erbas opened this issue Aug 1, 2018 · 1 comment

Comments

@erbas
Copy link

@erbas erbas commented Aug 1, 2018

So this package is amazing, thank you! But it's most useful feature is a little broken. Suppose I want to make forecast for the next 60 business days. If I understand correctly, I should use this function:

idx.pred <- tk_make_future_timeseries(index(df.train), 60, inspect_weekdays = TRUE)

The problem is that depending on where the weekends fall in my out of sample data, the tk_make_future_timeseries() call returns a different length vector. Rather than returning the next sixty business days, it looks like it's taking the calendar for the next sixty days and dropping the weekends. This is a disaster, because pred.xts <- xts(pred, idx.pred) fails with an error about series needing to be the same length as their dates.

@mdancho84
Copy link
Contributor

@mdancho84 mdancho84 commented Apr 30, 2020

This should be taken care of. I have implemented a new argument length_out that defines:

  1. The number of observations if a numeric value is used (e.g. length_out = 365 always returns 365 observations despite if weekends are removed or business holidays are removed).
  2. The end date if a time-based duration is used (e.g. length_out = "1 year" returns all observations within 1-year from the end date of the incoming index. This means you might only get 252 days if weekends and business holidays are removed).

I will release to CRAN in the next few weeks, but until then, try the upgrade out: devtools::install_github("business-science/timetk").

@mdancho84 mdancho84 closed this Apr 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.