A bit scared to post a question here (math fear syndrome I bet). I was looking for a way to predict (rough estimation) a next value based on series of previous values. These values are a sales totals for several previous years.

I found few websites i.e. The Online Excyclopedia of Integer Sequences but cannot understand formulas that are given there and how to modify them.

I know that the problem is not easy but was wondering if there is some way to do at least rough estimation of next few values.

An example. Lets say I have previous years sales: 200, 280, 370, 450, 530. Now I am looking to predict next few value(s).


  • 1
    $\begingroup$ You could run a linear regression on your points. $\endgroup$ – uniquesolution Sep 10 '15 at 9:43
  • 1
    $\begingroup$ Plot the data and see how they look like. $\endgroup$ – Claude Leibovici Sep 10 '15 at 10:12

Your example data seems to be linear:

Data Plot

You could fit a linear function to the data.

You would get $f(x)=83x+117$.

EDIT: To do that, you need to find the values of $a$ and $b$ such that $f(x)=a x + b$ minimices the square of the distance to your data points. You can find more information and the formula for $a$ and $b$ in https://en.wikipedia.org/wiki/Simple_linear_regression

If you just want to do a quick calculation, you can use wolfram alpha.

If your data seems non linear data, it can be a difficult problem. You can try to fit other simple functions, such as polynomials or exponentials (you can do that with wolfram alpha too). Predicting the behavior of a function based on some data points is studied by statistical learning theory.

If you have more data or you want to try more complex fits, you should use a programming language such as Mathematica, Matlab, Python or R (the last two are free and open source).

  • $\begingroup$ Not really, to be honest. I have to admit I was looking for an example I can run against the array of values that would return - let's say - few next predictions. Not sure where 83x and 117 came from. $\endgroup$ – Mariusz Sep 10 '15 at 12:21
  • $\begingroup$ I understand so far that I'd need to look for which function could represent my data. So, I can imagine when data would look different than something that can be a linear function other function would need to be used. What if I have values like: 200,300,400,300,400. This wouldn't work? If that's the case I would need to first calculate which function to use. That seems like not a trivial task. $\endgroup$ – Mariusz Sep 10 '15 at 12:35
  • $\begingroup$ Seems like a bummer then. I cannot guarantee that sales will always raise in linear fashion. I've got at least general idea now. Thanks again @mlainz $\endgroup$ – Mariusz Sep 10 '15 at 15:08

I found something called Microsoft Time Series Algorithm which is part of Sql Server Analyses Services.


This seems to be the route to take as I am not familiar with higher matt and Sql Server seems to cover exactly what I need.

Thanks for trying to help me.

Chart example from the page:

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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