I have data for a few stores which sell apples. For each store I have an averaged value of how many kilos of apples users have bought per day for this month. So it looks like this:
Store 1:
-------
January - average of 10 kilos of apples per day
February - average of 18.7 kilos of apples per day
March - average of 24.5 kilos of apples per day
April - ...
Store 2:
--------
January - average of 3.23 kilos of apples per day
February - average of 2.9 kilos of apples per day
March - average of 7.89 kilos of apples per day
...
For each store I want to make a prediction - how many kilos of apples per day will be sold in the next few months (4, 5 months in the future).
The problem is that sometimes the data is like this:
(it is increasing and maybe it's good to use the method of least squares fitting to fit the data values with line and find the function)
but other times the data is like this:
and the least squares won't work :(
What I would like to ask is:
- to make the prediction, is it always true that I should find a line or a curve to fit the data best or that's not always the case, and the prediction will be very wrong if I use this approach
- for the second type of graphics, what algorithms can I use :(
- how to decide which algorithm to use to fit the data best and if I should use a line for fitting, or a parabola or a third degree polynomial and so on
The ideal solution I want to write is to have one algorithm which takes the data and decides which algorithm (from a set) will give the best prediction and then give the data to the chosen algorithm for predictions.
(For example give data like (2, 3, 4, 5, 6, 7) and the first algorithm will say "use the method of least squares" and then I will give the data (2, 3, 4, 5, 6, 7...) to the method of least squares to get the next 4-5 values from it.)
I know it's a big question, but any kind of information will be very useful! Thank you very much in advance!