MixedInterpolation on ForwardRates in Bootstrapping

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

MixedInterpolation on ForwardRates in Bootstrapping

Hartmut Jürgens
Hi all,

experimenting with different interpolation schemes for the yield term structure in the FRA example (QuantLib\Examples\FRA\FRA.cpp) I switched from PiecewiseYieldCurve<Discount,LogLinear> to PiecewiseYieldCurve<ForwardRate,MixedLinearCubic> and wonder about the behavior of the MixedLinearCubic interpolation in the bootstrapping process (of fraTermStructure).

It may happen that the short leg ends in the linear domain (e.g. before the switch to spline) and the long leg ends in the spline domain (e.g. after the switch to spline).  The calculation of the primitive (CubicInterpolationImpl.primitive) assume, that the whole domain since reference date is interpolated by a spline. So the forward-forward calculation (in IborIndex::forecastFixing) ends up in a short linear primitive (on d1) and a long spline primitive (on d2).

Imho the determination of the integral hast to be divided in a partition where the interpolation is linear and a partition where the interpolation is spline to get a consistent integral. Otherwise the integral over the linear domain is that of a spline. Do you see any reason why this procedure may be worse compared to mixed interpolation in QuantLib? How can I get the described segmented integral in a single YieldTermStructure?

Regards
Hartmut Jürgens


------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: MixedInterpolation on ForwardRates in Bootstrapping

Peter Caspers-4
Hi,

I wonder whether this is just a typo in mixedinterpolation.hpp, i.e.

             Real primitive(Real x) const {
                 if (x<*(this->xBegin2_))
                     return interpolation1_.primitive(x, true);
                 return interpolation2_.primitive(x, true);

should rather be

            Real primitive(Real x) const {
                if (x<*(this->xBegin2_))
                    return interpolation1_.primitive(x, true);
                return interpolation2_.primitive(x, true) -
                    interpolation2_.primitive(*xBegin2_, true) +
                    interpolation1_.primitive(*xBegin2_, true);
            }

I did not compile this, though. What do you think ?

Regards
Peter


On 30 June 2014 15:23, Hartmut Jürgens <[hidden email]> wrote:

> Hi all,
>
> experimenting with different interpolation schemes for the yield term structure in the FRA example (QuantLib\Examples\FRA\FRA.cpp) I switched from PiecewiseYieldCurve<Discount,LogLinear> to PiecewiseYieldCurve<ForwardRate,MixedLinearCubic> and wonder about the behavior of the MixedLinearCubic interpolation in the bootstrapping process (of fraTermStructure).
>
> It may happen that the short leg ends in the linear domain (e.g. before the switch to spline) and the long leg ends in the spline domain (e.g. after the switch to spline).  The calculation of the primitive (CubicInterpolationImpl.primitive) assume, that the whole domain since reference date is interpolated by a spline. So the forward-forward calculation (in IborIndex::forecastFixing) ends up in a short linear primitive (on d1) and a long spline primitive (on d2).
>
> Imho the determination of the integral hast to be divided in a partition where the interpolation is linear and a partition where the interpolation is spline to get a consistent integral. Otherwise the integral over the linear domain is that of a spline. Do you see any reason why this procedure may be worse compared to mixed interpolation in QuantLib? How can I get the described segmented integral in a single YieldTermStructure?
>
> Regards
> Hartmut Jürgens
>
>
> ------------------------------------------------------------------------------
> Open source business process management suite built on Java and Eclipse
> Turn processes into business applications with Bonita BPM Community Edition
> Quickly connect people, data, and systems into organized workflows
> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> http://p.sf.net/sfu/Bonitasoft
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: MixedInterpolation on ForwardRates in Bootstrapping

Hartmut Jürgens
Hi Peter,
That's it! The outcome of your suggestion for primitive(.) in MixedInterpolation fits my expectation (for the FRA example).
Many thanks and best regards
Hartmut
 
-----Ursprüngliche Nachricht-----
Von: Peter Caspers [mailto:[hidden email]]
Gesendet: Monday, June 30, 2014 8:35 PM
An: Hartmut Jürgens
Cc: [hidden email]
Betreff: Re: [Quantlib-users] MixedInterpolation on ForwardRates in Bootstrapping

Hi,

I wonder whether this is just a typo in mixedinterpolation.hpp, i.e.

             Real primitive(Real x) const {
                 if (x<*(this->xBegin2_))
                     return interpolation1_.primitive(x, true);
                 return interpolation2_.primitive(x, true);

should rather be

            Real primitive(Real x) const {
                if (x<*(this->xBegin2_))
                    return interpolation1_.primitive(x, true);
                return interpolation2_.primitive(x, true) -
                    interpolation2_.primitive(*xBegin2_, true) +
                    interpolation1_.primitive(*xBegin2_, true);
            }

I did not compile this, though. What do you think ?

Regards
Peter


On 30 June 2014 15:23, Hartmut Jürgens <[hidden email]> wrote:

> Hi all,
>
> experimenting with different interpolation schemes for the yield term structure in the FRA example (QuantLib\Examples\FRA\FRA.cpp) I switched from PiecewiseYieldCurve<Discount,LogLinear> to PiecewiseYieldCurve<ForwardRate,MixedLinearCubic> and wonder about the behavior of the MixedLinearCubic interpolation in the bootstrapping process (of fraTermStructure).
>
> It may happen that the short leg ends in the linear domain (e.g. before the switch to spline) and the long leg ends in the spline domain (e.g. after the switch to spline).  The calculation of the primitive (CubicInterpolationImpl.primitive) assume, that the whole domain since reference date is interpolated by a spline. So the forward-forward calculation (in IborIndex::forecastFixing) ends up in a short linear primitive (on d1) and a long spline primitive (on d2).
>
> Imho the determination of the integral hast to be divided in a partition where the interpolation is linear and a partition where the interpolation is spline to get a consistent integral. Otherwise the integral over the linear domain is that of a spline. Do you see any reason why this procedure may be worse compared to mixed interpolation in QuantLib? How can I get the described segmented integral in a single YieldTermStructure?
>
> Regards
> Hartmut Jürgens
>
>
> ----------------------------------------------------------------------
> -------- Open source business process management suite built on Java
> and Eclipse Turn processes into business applications with Bonita BPM
> Community Edition Quickly connect people, data, and systems into
> organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards
> http://p.sf.net/sfu/Bonitasoft 
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: MixedInterpolation on ForwardRates in Bootstrapping

Peter Caspers-4
Hi Hartmut,
thanks for your feedback. I will send Luigi a pull request so that the
fix can be applied in the official repository.
Best Regards
Peter

On 1 July 2014 09:59, Hartmut Jürgens <[hidden email]> wrote:

> Hi Peter,
> That's it! The outcome of your suggestion for primitive(.) in MixedInterpolation fits my expectation (for the FRA example).
> Many thanks and best regards
> Hartmut
>
> -----Ursprüngliche Nachricht-----
> Von: Peter Caspers [mailto:[hidden email]]
> Gesendet: Monday, June 30, 2014 8:35 PM
> An: Hartmut Jürgens
> Cc: [hidden email]
> Betreff: Re: [Quantlib-users] MixedInterpolation on ForwardRates in Bootstrapping
>
> Hi,
>
> I wonder whether this is just a typo in mixedinterpolation.hpp, i.e.
>
>              Real primitive(Real x) const {
>                  if (x<*(this->xBegin2_))
>                      return interpolation1_.primitive(x, true);
>                  return interpolation2_.primitive(x, true);
>
> should rather be
>
>             Real primitive(Real x) const {
>                 if (x<*(this->xBegin2_))
>                     return interpolation1_.primitive(x, true);
>                 return interpolation2_.primitive(x, true) -
>                     interpolation2_.primitive(*xBegin2_, true) +
>                     interpolation1_.primitive(*xBegin2_, true);
>             }
>
> I did not compile this, though. What do you think ?
>
> Regards
> Peter
>
>
> On 30 June 2014 15:23, Hartmut Jürgens <[hidden email]> wrote:
>> Hi all,
>>
>> experimenting with different interpolation schemes for the yield term structure in the FRA example (QuantLib\Examples\FRA\FRA.cpp) I switched from PiecewiseYieldCurve<Discount,LogLinear> to PiecewiseYieldCurve<ForwardRate,MixedLinearCubic> and wonder about the behavior of the MixedLinearCubic interpolation in the bootstrapping process (of fraTermStructure).
>>
>> It may happen that the short leg ends in the linear domain (e.g. before the switch to spline) and the long leg ends in the spline domain (e.g. after the switch to spline).  The calculation of the primitive (CubicInterpolationImpl.primitive) assume, that the whole domain since reference date is interpolated by a spline. So the forward-forward calculation (in IborIndex::forecastFixing) ends up in a short linear primitive (on d1) and a long spline primitive (on d2).
>>
>> Imho the determination of the integral hast to be divided in a partition where the interpolation is linear and a partition where the interpolation is spline to get a consistent integral. Otherwise the integral over the linear domain is that of a spline. Do you see any reason why this procedure may be worse compared to mixed interpolation in QuantLib? How can I get the described segmented integral in a single YieldTermStructure?
>>
>> Regards
>> Hartmut Jürgens
>>
>>
>> ----------------------------------------------------------------------
>> -------- Open source business process management suite built on Java
>> and Eclipse Turn processes into business applications with Bonita BPM
>> Community Edition Quickly connect people, data, and systems into
>> organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards
>> http://p.sf.net/sfu/Bonitasoft
>> _______________________________________________
>> QuantLib-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users