|
From: Luigi B. <lui...@gm...> - 2020-11-20 15:07:18
|
Hello David,
if you can do so while keeping backward compatibility (e.g., by adding
new constructors or giving defaults to new parameters) I'd suggest you
modify the existing class.
Thanks,
Luigi
On Fri, Nov 20, 2020 at 2:44 PM <da...@el...> wrote:
> Hi everyone,
>
>
>
> I’ve made some mods for my own use to the ExponentialSplinesFitting class,
> and before I go ahead and submit a pull request, I’d appreciate some
> initial feedback.
>
> The form of the discount function for the exponential spline fit is: df(t)
> = sum( b(i) exp -i.kappa.t ) for i = 1 to N.
>
> Where b(i) and kappa are the variables used to fit the curve.
>
> The current implementation fixes N at 9 (so 9 x b(i) + 1 x kappa = 10
> parameters). If the discount factor is constrained to be 1 at time t=0
> (which is usually is) then one of the b(i)s is constrained, since at t=0,
> sum(b(i)) = 1, reducing the total number of independent parameters to 9. In
> the implementation b(1) is constrained.
>
>
>
> From my experience of using exponential spline fitting over the years, and
> from what I have read, there is no definitive argument for fixing N=9.
> Indeed the number chosen can depend on several considerations: the density
> of bonds across the curve; whether you want to fit the very short end etc.
> You also find that the value of kappa doesn’t make much difference to the
> quality of fit as long as it is in the right range. Other implementations
> fix kappa (it’s akin to the far-forward overnight rate, so something around
> 1% in the current environment), and then optimize over the b(i)s. If you
> extrapolate the spline beyond the last bond (which is probably not a great
> idea) then kappa does have an effect on the shape of that extrapolated part
> but I feel it is simply an artefact of the fitting.
>
>
>
> In my implementation, the number of parameters is a variable and hence a
> class member, and there is also the option to fix kappa and supply a
> non-zero value for that fix (kappa = 0 is a special case as it produces
> df(t) = 1 no matter how much the b(i)s are varied (in the constrained
> model) ).
>
> Initially I had derived my new class, unimaginatively named
> ExponentialSplinesFittingN from ExponentialSplinesFitting, but on
> reflection the inheritance is redundant as I am over-riding every method,
> so perhaps it should also derive directly from the abstract base
> FittedBondDiscountCurve::FittingMethod. I am open to suggestions for a
> decent name!
>
> I wrote it before I had read the QL “style guide” so will need to amend my
> implantation anyway: hence this is a good moment to hear any thoughts!
>
>
> Best wishes
>
> David Sansom
>
>
>
>
>
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|