Jump to content

Wikipedia:Reference desk/Archives/Mathematics/2014 November 28

From Wikipedia, the free encyclopedia
Mathematics desk
< November 27 << Oct | November | Dec >> November 29 >
Welcome to the Wikipedia Mathematics Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


November 28

[edit]

Analysis

[edit]

My boss said that we need a program that periodically checks a database sequence's current number, compares it with previous values and estimates when the sequence is going to be exceeded. We both know that for one value this is impossible, and for two values it can be linearly extrapolated from their difference. But how should it be done for more than two values? Should I try to average throughout every value measured so far or just concentrate on the latest values? How does one extrapolate from the difference between more than two values anyway? JIP | Talk 16:03, 28 November 2014 (UTC)[reply]

The method depends mainly on the nature of the sequence nature. If you expect the value oscillates somehow around some otherwise constant mean value, then you extrapolate the mean of several recent values. If you expect some linear trend, then you do a linear regression. Generally you need a model of the sequence behavior, next fit the model to data by adjusting its parameters, then read the future values calculated from the model. See Extrapolation. --CiaPan (talk) 16:42, 28 November 2014 (UTC)[reply]
I'm afraid I didn't understand very much from the linear regression article. Is there some sort of beginners' guide to it available? JIP | Talk 17:54, 28 November 2014 (UTC)[reply]
You may find it worthwhile to look at exponential smoothing, which considers a weighted moving average of all past data values, the weights diminishing as the data ages. The aim is to respond to real underlying changes but ignore random ones (impossible to achieve exactly, of course, but due analysis of past data can give better discrimination between the two effects). Various refinements to the basic technique exist, e.g. reviewing/setting the value of the smoothing constant by considering past behaviour, and it can (like all practical forecasting methods) get very complicated, but if it looks a possibility for your needs, in terms of quality and practicability, you can always get deeper into it. →86.171.209.142 (talk) 19:16, 29 November 2014 (UTC)[reply]
Probably the least complicated way to extrapolate from more than two points is to apply simple linear regression to the last N values for some predetermined value of N. If you let the x values represent the time of observation, and y values denote the values observed, then it fits a line through the values and you can use this to estimate y values at future times. More specifically:
Where for N value pairs :
That's easy to do, though it won't necessarily be very accurate if the data isn't fairly linear. Dragons flight (talk) 05:50, 2 December 2014 (UTC)[reply]
What do and mean here? The mean of and respectively? JIP | Talk 07:21, 3 December 2014 (UTC)[reply]
Yes, the respective means. Dragons flight (talk) 17:00, 3 December 2014 (UTC)[reply]
It is also possible to replace the means with any arbitrary point that you want to require that the estimating line pass through, e.g. everywhere. For example, if you are projecting the near future, you might get better results by requiring that the line pass exactly through the most recent value. How well that works is likely to depend on how noisy the data is. If the data has a lot of short-term noise on it, then you are probably better off using the means. Dragons flight (talk) 17:18, 3 December 2014 (UTC)[reply]
Thanks! This looks fairly usable. I'll keep this mind once my boss gives me a go-ahead to actually start implementing the program. JIP | Talk 19:31, 3 December 2014 (UTC)[reply]
You're welcome.  :-) Dragons flight (talk) 19:52, 3 December 2014 (UTC)[reply]
LaTeX minor formatting fix to make a small vertical gap between equations. --CiaPan (talk) 10:04, 3 December 2014 (UTC)[reply]