Hello. Im doing a forecasting task, and have a problem that I really cant find a solution on. I get this message, when wanting to do a gg_season and even when wanting to do STL and ETS modelling / analyzing:
"[1] .data contains implicit gaps in time. You should check your data and convert implicit gaps into explicit missing values using tsibble::fill_gaps() if required."
I cant really see any implicit gaps. I have imported a TS-dataset called "sales". I then made the dataset more tidy by making a pivot. This gives me a "month" column by character (Jan, Feb and so on), "year" column and a "sales" column.
I ran this code to create a new column with a YMD-variable by combining the year and month variables. This will first make the format like this "2007 Jan", "2007 Feb" and so on. I make a new dataset where i only include the sold and new month-variable.
Next im mutating the month-variable, where it formates it into YMD-format (2007-01-01, 2007-02-01) etc. The observations are per month. Im creating a tsibble with month variable as index.
I tried changing ym to yearmonth in the mutate chunk, but it doesn't change 2007 jan to 2007-01-01 when doing that.
UPDATE: Thanks. Now I can run at least gg_season without problems. Changed ym to yearmonth. Will it have any affect on the forecasting after, if the date-variable is in the year/month fx (2007 jan) format?
I do have a different problem now. Im trying to forecast the demand for a product from 2022-08-24 to 2022-08-30 with a timeseries regression model. I found the tslm-function, but it keeps giving me an error when trying to forecast with it. It says that some objects (variables) are missing.
The tsibble has dates from 2022-04-01 to 2022-08-30. I created a training set with the observations from 2022-04-01 to 2022-08-23 and test set with the observations from 2022-08-24 to 2022-08-30 (forecasting for 7 days) - as I have to check the performance after. The train and test set are both tsibbles.
This is my tslm-model:
tslm <- train_data2 |>
model(tslm = TSLM(demand ~ temp_max_past1h + temp_gt25_3_days + weekend + month + stock))
So im forecasting with it for 7 days:
forecast_tslm <- forecast(tslm, h = 7)
I get this error:
Error in mutate():
! Problem while computing tslm = (function (object, ...) ....
Caused by error in value[[3L]]():
! object 'temp_max_past1h' not found
Unable to compute required variables from provided new_data.
Does your model require extra variables to produce forecasts?
Backtrace:
base (local) tryCatchList(expr, classes, parentenv, handlers)
base (local) tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
The object/variable "not found" is in the datasets - have checked many times. Ive tried everything even chatbot which keeps saying I have to check if the variable is spelled correctly etc.
Edit: Obviously its because its a regression model, so it needs the predictor variables values to forecast for the next days.. gotta find another way.