rafzamb / sknifedatar

sknifedatar is a package that serves primarily as an extension to the modeltime 📦 ecosystem. In addition to some functionalities of spatial data and visualization.
https://rafzamb.github.io/sknifedatar/
Other
37 stars 11 forks source link

1-year ahead forecast using additional predictor(s) #21

Open dmresearch15 opened 2 years ago

dmresearch15 commented 2 years ago

This has reference to the example given in https://karbartolome-blog.netlify.app/posts/workflowsets-timeseries/

Objective is to forecast using additional predictors including date-related predictors. As for example given in above link:

Lagged values: 1 to 6 months lag

recipe_date_extrafeatures_lag <- recipe_date_extrafeatures %>% step_lag(value, lag = 1:6) %>% step_ts_impute(all_numeric(), period=365)

The code above has predictors related to Date as well as lags predictors (say X).

FUTURE FORECAST -----

If one needs to forecast 1-year ahead (say, .h = '1 year') after refitting using full data set (training + testing), then one needs also future 1-year X values as well as predictors related to Date. If this the case, it is needed to collect/prepare future 1-year X values as well. Any idea about the concept has been used in the code.

The code given to refit using full data set (training + testing):

wfrefits <- modeltime_wfs_refit(.wfs_results = wffits_best, .serie = data)

Future forecast

wfrefits_forecast <- modeltime_wfs_forecast(.wfs_results = wfrefits, .serie = data, .h = '1 year', .split_prop = split_prop)

Interested to know, how the lags predictors (say X) have been incorporated for 1-year ahead forecast.