Posted by
chiara.fornarola on
URL: http://quantlib.414.s1.nabble.com/Question-about-qlinterpolate-and-linear-extrapolation-tp4030p4031.html
Hi Luigi,
thanks for your answer this gives to me some more assurance, but it also generates some more questions.
1) is the same algorithm used for x<X{0} where X{0} is the first known point of the series you use to build the line?
2) I'm comparing the results of extrapolation on same input data I can obtain by using: QuantLibXL-0.3.7's qlinterpolate function, linear_interpolate function of Perl library and a VBA user defined function I create following the same algorithm you described, but I can't obtain the same output number. I mean I obtain 3 differents results each differing from each other at the levele of 10^-3. I don't think it's a tragedy but I expected less difference between these results. If you have some experience on testing different library function that should give the "same" results could you please suggest to me in general which factors should be taken into account and that can drive to these "different" results.
Thanks
Chiara
-----Messaggio originale-----
Da: Luigi Ballabio [mailto:
[hidden email]]
Inviato: lunedì 19 settembre 2005 16.02
A: FORNAROLA,CHIARA
Cc:
[hidden email]
Oggetto: Re: [Quantlib-users] Question about qlinterpolate and linear extrapolation
On 09/14/2005 05:49:26 PM, FORNAROLA,CHIARA wrote:
> Hi
>
> I'm using QuantLibXL-0.3.7 and I'd like to know which is the algorithm
> behind extrapolation used in qlinterpolate function.
> Sorry for this simple question, but I'm trying to replicate (into
> excel spreadsheet) the results this function gives and I'm also asking
> if there is a "right" way to perform linear extrapolation.
Chiara,
the extrapolation is performed by---hmm, what is the clearest way to put it?---by extending the last segment, i.e., by using the same formula which is used between x_{N-1} and x_{N} for x > x_{N}. In case of linear interpolation, the last segment is extended; in case of splines, the last cubic, and so on.
Later,
Luigi
----------------------------------------
Better to remain silent and be thought a fool than to speak out and remove all doubt.
-- Abraham Lincoln
-----------------------------------------------------------------------------
Chi riceve il presente messaggio e` tenuto a verificare se lo stesso non gli
sia pervenuto per errore. In tal caso e` pregato di avvisare immediatamente
il mittente e, tenuto conto delle responsabilita` connesse all'indebito
utilizzo e/o divulgazione del messaggio e/o delle informazioni in esso
contenute, voglia cancellare l'originale e distruggere le varie copie o
stampe.
The receiver of this message is required to check if he/she has received it
erroneously. If so, the receiver is requested to immediately inform the
sender and - in consideration of the responsibilities arising from undue use
and/or disclosure of the message and/or the information contained therein -
destroy the original message and any copy or printout thereof.
-----------------------------------------------------------------------------