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

Predicting on data with gaps in date variable #41

Open
vidarvr opened this issue Apr 12, 2023 · 1 comment
Open

Predicting on data with gaps in date variable #41

vidarvr opened this issue Apr 12, 2023 · 1 comment

Comments

@vidarvr
Copy link

vidarvr commented Apr 12, 2023

I'm trying to predict on a test data where there are no values for weekends and holidays.

It seems to me that this is not allowed. At least when I try to predict such data I get this error:

predict(object = fitted, new_data = test_data_tbl, past_data = total_train_tbl)
Error in `verify_new_data()`:
! `new_data` includes obs that we can't generate predictions.
✖ Found `87` observations.

Here there is a gap in the test data, i.e. no observations for weekends.

For retail data where stores are closed during weekends, should I create value for the weekend and simply impute as zero since there is zero sales during weekends?

Similar for financial data where there is no trading on weekends, what should I do in such scenario? Creating artificial value for a stock price during weekends (weekend prices = closing on friday?).

@dfalbel
Copy link
Member

dfalbel commented Apr 12, 2023

Currently, I'd either fake the dates, so you have continuous date or impute as zero and add that weeked flag. We rely on tsbibble for generating the future data and this is currently not implemented for it: tidyverts/tsibble#18

We should probably refactor tsibble out, and using something like https://clock.r-lib.org which supports better ways to specify calendars.

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

2 participants