Re: LogLinear interpolation
Posted by Ferdinando M. Ametrano-2 on Jun 27, 2002; 5:30am
URL: http://quantlib.414.s1.nabble.com/LogLinear-interpolation-tp10120p10121.html
Hi all
Andre Louw wrote:
>Correct me if i'm wrong, but I see you are using linear interpolation on
>cont. compounded rates to get to the resulting discount factor
As Luigi pointed out I implemented a linear interpolation on the logarithm
of the discounts. The logarithm of a discount is not the continuos
compounded rate r, but -r*t.
Anyway for sake of clarity let's talk before about interpolation in
general, with no reference to discount and rates. So the LogLinear
interpolation I implemented is a linear interpolation on {Xi}, {LOG(Yi(Xi))}
>I implemented loglinear interpolation to get to the result i.o.w:
>
> dfx = (df1^(tx/t1*(t2-tx)/(t2-t1)))*(df2^(tx/t2*(tx-t1)/(t2-t1)))
>
>Not quite the same thing.
Not quite the same thing indeed. I might be wrong but your formula is quite
similar to "geometric interpolation" dfx =
(df1^((t2-tx)/(t2-t1)))*(df2^((tx-t1)/(t2-t1))).
The problem with your original formula is that is undefined at t1==0.0 and
t2==0.0
We could add to the CVS your original code as XXXinterpolation.hpp, but I
would require to handle the t==0.0 case. When I decided to rewrite
LogLinear interpolation I didn't got it was geometric interpolation, I just
noticed that as interpolation it had problem at t=0.0
>>We could the implement a mechanism in DiscountCurve to distinguish which
>>to use?
>
>Sure:
>
>template <class Interpolation>
>class DiscountCurve {
> ...
>};
I'm not happy about this approach since it will allow some really bad
interpolation choice, anyway since QuantLib users are supposed to be smart
... it's OK for me.
If we go this way it should be clear here that it's a must for
geometricinterpolation to handle t==0.0, or the discount near t=0.0 will be
screwed up.
Andre, I'm sorry if my changes broke some functionality you were relying
upon, but in a previous email last week-end I asked about it:
>3) I fixed 2 bugs in DiscountCurve, but I still have problems with
>calculations between settlementDate and the first knot date, probably due
>to some problem in LogLinearInterpolation. Have someone ever used this
>classes? Do they work for you?
The bugs were pointed object lifetime issues, while I realized now that the
problem with the LogLinearInterpolation was just that geometric
interpolation was undefined at t=0.0
ciao -- Nando