1
$\begingroup$

I work on forecasting in R using a SARIMA model with monthly time series data. However, for the last year, I don't have the details by months but I have the annual value.

I want to predict 2023 data by month with my SARIMA model, by adding a constraint on my model: the sum of my 12 predict months equals my observed annual value.

Do anyone knows a function in R allowing to implement such a constraint in my SARIMA? I didn't find so far a satisfactory solution with arima or auto.arima functions.

$\endgroup$
4
  • $\begingroup$ By "the last year", do you mean the last year of the training data, or the last year of the forecast period? If the latter, the simplest approach would be to simply forecast monthly values, then rescale them so the sum is what you want. $\endgroup$ Commented Jul 10 at 15:53
  • $\begingroup$ Hello Stephan. Apologies for not being clearer. I mean the last year of the training data (2023). My forecast period begins in 2024. $\endgroup$ Commented Jul 11 at 8:24
  • $\begingroup$ OK, thanks. So what you actually have is some unclarity in your training data. Is your second paragraph actually what you need, i.e., a sum constraint on your forecasted data? Your comment sounds like you just want to deal with the issues in your training data, but I don't see where such a constraint on the forecast would come from. $\endgroup$ Commented Jul 11 at 8:34
  • $\begingroup$ I work with time series monthly data with a particularity : due to methodological issue in 2023 data are not details by months as it used to be precedent years. So I want to use my SARIMA model to estimate my monthly data in 2023 in order to, in a second time, forecast for 2024. What I already know for 2023 however is the total for the year. $\endgroup$ Commented Jul 11 at 8:40

1 Answer 1

1
$\begingroup$

Here is a very simple approach: fit a model to your data up to 2022. Forecast this out into 2023. Take the forecasts from these models, and rescale them to sum to the total sales of 2023 that you know. You now have a "reasonable" monthly breakdown of total 2023 sales to the months of 2023. Feed these numbers, together with the monthly history up to 2022, into another SARIMA model, and forecast that one out.

Since you are simulating knowledge you don't have - and that about the most recent data - you should be careful about trusting any prediction intervals the second model gives you for 2024.

An alternative would of course be to only use the data up to 2022, and forecast that out for two years. That would discard your known total for 2023. But at least it would only use monthly data you are certain about.

Yet another alternative would be to use both methods, and take monthly averages of the forecasts. Averaging often improves forecasts, though the effect here would depend on how different the 2023 total is from the observed trend up to 2022.

Yet another approach: use a variant of exponential smoothing. Update the seasonal (monthly) component up to 2022, but fit a trend only to aggregate yearly data, but this up to 2023. Then combine the two components, together with a level component. That would require a little manual juggling numbers and a bit more opaque, though.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.