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. Thanks Chiara ----------------------------------------------------------------------------- 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. ----------------------------------------------------------------------------- |
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 |
In reply to this post by chiara.fornarola
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. ----------------------------------------------------------------------------- |
Chiara,
apologies for the delay. On 09/21/2005 08:06:25 PM, FORNAROLA,CHIARA wrote: > 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? Yes. > 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. Unless my algebra got rusty, the formula should be y = y_{N} + (x - x_{N})*(y_{N}-y_{N-1})/(x_{N}-x_{N-1}). Which of the three functions is closer? Luigi ---------------------------------------- This gubblick contains many nonsklarkish English flutzpahs, but the overall pluggandisp can be glorked from context. -- David Moser |
In reply to this post by chiara.fornarola
Thx Luigi! it seems qlinterpolate eand my linear interpolate function in VB are closer. The Perl's linear_interpolate is more distant but I believe it has something to do with rounding off. Chiara -----Messaggio originale----- Da: Luigi Ballabio [mailto:[hidden email]] Inviato: 30 September 2005 12:15 A: FORNAROLA,CHIARA Cc: [hidden email] Oggetto: Re: R: [Quantlib-users] Question about qlinterpolate and linear extrapolation Chiara, apologies for the delay. On 09/21/2005 08:06:25 PM, FORNAROLA,CHIARA wrote: > 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? Yes. > 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. Unless my algebra got rusty, the formula should be y = y_{N} + (x - x_{N})*(y_{N}-y_{N-1})/(x_{N}-x_{N-1}). Which of the three functions is closer? Luigi ---------------------------------------- This gubblick contains many nonsklarkish English flutzpahs, but the overall pluggandisp can be glorked from context. -- David Moser ----------------------------------------------------------------------------- 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. ----------------------------------------------------------------------------- |
Free forum by Nabble | Edit this page |