Reputation: 23
I'm new to forecasting and am trying to use the Prophet package in R. It accepts a csv of the format (ds, y). You are also able to add additional regressors.
My data in particular is weekly shipment data for 7 different locations and numerous different item types. So location 1 may have 15 items shipped to them in a year, but item 1 was only shipped in January and June, whereas other items may have been shipped for all 52 weeks.
I'm thinking to generate a 1 year aggregate forecast that considers location and item variables as additional regressors, but I don't know how to do so. The documentation doesn't give an example. Here's what I've done:
m = prophet(data.frame(ds=data$Week, y=data$Shipments),fit=F)
m1 = add_regressor(m, "Item")
m2 = add_regressor(m1, "Location")
future = make_future_dataframe(m2, periods=52, freq="week")
Which returns the following error message:
no non-missing arguments to max; returning -InfError in seq.default(max(m$history.dates), length.out = periods + 1, by = freq) : 'from' cannot be NA, NaN or infinite"
Any help would be appreciated. Also if there's a way to get Prophet to automatically generate forecasts by Location and Item that would be great to know. Thanks.
Upvotes: 0
Views: 1669
Reputation: 41
I faced the same issue you describe, and it appears that for external regressors used in Prophet, you must "know" (factually or by independent forecasting or other means) the future values of the regressors in order to predict future values on your target variable. See: github discussion about Prophet external regressors and prediction. I tried using NA, 0, mean, mean with random jitter, and independent forecasts for my external regressors. Of course, NA are not accepted, 0 values produce wild predictions, and the other options are at your discretion.
Upvotes: 1