Forecasting using step_window to create moving averages

I have a small data set of 120 monthly observations, and I am attempting to forecast monthly values 12 months into the future.

I want to include a step in a recipe that allows tunes the window of the rolling mean, which I believe requires the step_window() function as well as a window greater than 12. Is this reasonable to include this in a recipe? Is it correct to say that the window must be greater than 12 to assess 12 months into the future? I'm thinking the window should be between 12 and 24 to that the testing dataset always has something to work with.

The way that I saw this work in other forecasts is that the moving average was always added into the raw data using functions like tk_augment_slidify. Because my dataset is so small, I'd like to avoid any process that results in too many NA values.

Here is what the step_window looks like.
MARec_X <-
SplineRec_X %>%
step_window(logCost,
size = tune(),
na_rm = TRUE,
statistic = "mean",
names = "rollingMean",
role = "predictor",
keep_original_cols = TRUE)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.