Extrapolating or projecting

  • Thread starter Thread starter Miky
  • Start date Start date
M

Miky

I have the following table :

Period Amount
Jan 2003 11310658.33
Mar 2003 6294608.33
Apr 2003 1133225.00
Jul 2003 1002625.00
Oct 2003 29000.25

How do i extrapolate or forecast/trend the above for the
next continuous subsequent 12 calendar months starting
from Nov 2003?

Thanks in advance,
-Miky
 
Hi,



Many possible solutions. If [xi] is the date for which you
want extrapolation, the (modified) Lagrangian interpolation (extrapolation)
would be, quite simply:

==================
SELECT SUM(eta)
FROM ( SELECT b.y * EXP(SUM(LOG( ABS(
( [xi] - a.x ) / ( b.x - a.x )
) ) ) ) As
eta
FROM myTable As a INNER JOIN myTable As b
ON a.x <> b.x
)
====================



where myTable has two fields, x and y: x is the field name for the
date_time, and y is the measure you read, at that moment.



The Lagrangian intra/extrapolation, given three points (x1, y1), (x2, y2),
(x3, y3) is

y = y(x)
= 1* ((x-x2)/(x1-x2)) * ((x-x3)/(x1-x3)) * y1
+
((x-x1)/(x2-x1)) * 1* ((x-x3)/(x2-x3)) * y2
+
((x-x3)/(x3-x1)) *((x-x2)/(x1-x2)) * 1 * y3




It passes exactly by the three points (n, in general) as you can easily
see plugging x=x1, or x2, or x3, in the previous formula.


I modified it adding ABS around each terms...

It is also a formula easy to program in SQL, once we remember that:


a*b*...*z = exp( ln(a) + ln(b) + ... + ln(z) )


as long as all the values are strictly > 0. That is why I used ABS.


The Lagrangian interpolation/extrapolation is known to behave poorly for
extrapolation, and is generally used only for interpolation (ie, between
xmin and xmax), because the dominant terms will make the function like

y = x^n

"far" from any supplied points, which is possible when extra-pollation is
used.


The query is interesting in many aspects, one noticeable one is its
inner join based on <>, rather than the more usual = .



Hoping you may help,
Vanderghast, Access MVP
 
Hi,


Cut and paste erratum, the third line of the algebraic equation should have
been:

((x-x1)/(x3-x1)) *((x-x2)/(x3-x2)) * 1 * y3


instead of

((x-x3)/(x3-x1)) *((x-x2)/(x1-x2)) * 1 * y3



evidently...



Note that to get the [xi], you probably want to use something like
DateSerial:

DateSerial( WantedYear, WantedMonth, 1 )


which, indeed, creates a date as the first of the month and year you
supplied.




Vanderghast, Access MVP
 
Hi,


See a similar post dated 2004-Jan-22 for a better SQL formulation.

Vanderghast, Access MVP
 
Back
Top