0

I have a question regarding what approach to building a predictive model in R would be best for my data.

Say I have a series of orders per month for the past 5 years. The data have three variables- month, year and sum or orders.

What is the best way to build a model that will predict the number of orders for next month based on the number of orders over the past 6 months and the normal seasonal peaks and troughs for the number of orders? What is the best way to approach this problem using R?

Unfortunately I do not have the data at hand, but am just asking generally how to approach this problem in R.

Thanks in advance.

Jim Doakes
  • 11
  • 2
  • You can use the package `forecast` or the newer `fable`. If you are working with monthly data, you may want to have at least 24 months worth of data, so you can check if there is a monthly seasonality. Check the function `?stl` (you'll need to convert your data to timeseries, check package `zoo`. I also recommend you try to better define your question, lest you get many downvotes or have it closed. – PavoDive May 11 '22 at 01:44
  • 1
    Rob Hyndman, the author of the `forecast` package, has written an outstanding tutorial on the subject [here](https://otexts.com/fpp2/). Start by reading this. – jlhoward May 11 '22 at 03:36
  • @PavoDive thanks for your advice. Apologies as I am new to stackoverflow. With regard to the question not being well defined, are you able to recommend some of the additional information that I should include? Do I need to include the actual data? – Jim Doakes May 11 '22 at 04:34
  • Questions that are better suited for StackOverflow are those with code. Usually what is recommended is: to include sample data, to show what you have attempted, to show how it failed and to show your expected result. More open questions, such as this one, may be better suited for SO's sister site: [CrossValidated](https://stats.stackexchange.com/). – PavoDive May 11 '22 at 17:26
  • @PavoDive ok great. I'll check out that site in that case. – Jim Doakes May 11 '22 at 22:16

0 Answers0