Login  Register

Re: LogLinear interpolation

Posted by Luigi Ballabio-4 on Jun 26, 2002; 8:25am
URL: http://quantlib.414.s1.nabble.com/LogLinear-interpolation-tp10120p10127.html

Hi Andre,
         forget me for jumping in, but I got interested...

At 01:25 PM 6/26/02 +0200, 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 i.o.w:
>
>         cf1 = ln(df1), cf2 = ln(df2)
>         dfx = exp(cf1+((tx-t1)/(t2-t1))*(cf2-cf1)))

Personally, I didn't see the above as cont. compounded rates (shouldn't
they be ln(df1)/t1 anyway?)
I had figured it as "linear interpolation on the logarithms of the discounts"
which, I assumed, was the definition Nando took of "loglinear".


>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.

Well, almost :)
Nando's formula can be transformed to

         dfx = (df1^((t2-tx)/(t2-t1)))*(df2^((tx-t1)/(t2-t1)))

Moreover, it can be transformed to

         dfx = df1*(df2/df1)^((tx-t1)/(t2-t1))

or

         ln(dfx)-ln(df1)   ln(df2)-ln(df1)
         --------------- = ---------------
              tx-t1             t2-t1

which is not a direct one but best expresses the intent...


>If that is your institution's standard, fine, but could I then rename your
>implementation as contcomplinearinterpolation.hpp (or some such name), as I
>see the original implementation being log-linear interpolation?

I think it's just a matter of deciding what's what.
<asking just out of ignorance>
What is your definition of "loglinear"? In plain english, I mean?
</asking just out of ignorance>


>We could the implement a mechanism in DiscountCurve to distinguish which
>to use?

Sure:

template <class Interpolation>
class DiscountCurve {
    ...
};

Bye,
         Luigi