QuantLib::FittedBondDiscountCurve::FittingMethod - Base fitting method used to construct a fitted bond discount curve.


#include <ql/termstructures/yield/fittedbonddiscountcurve.hpp>

Inherited by CubicBSplinesFitting, ExponentialSplinesFitting, NelsonSiegelFitting, and SimplePolynomialFitting.

Public Member Functions

virtual Size size () const =0
total number of coefficients to fit/solve for
Array solution () const
output array of results of optimization problem
Integer numberOfIterations () const
final number of iterations used in the optimization problem
Real minimumCostValue () const
final value of cost function after optimization
virtual std::auto_ptr< FittingMethod > clone () const =0
clone of the current object

Protected Member Functions

FittingMethod (bool constrainAtZero=true)
void init ()
rerun every time instruments/referenceDate changes
virtual DiscountFactor discountFunction (const Array &x, Time t) const =0
derived classes must set this

Protected Attributes

bool constrainAtZero_
constrains discount function to unity at $ T=0 $, if true
FittedBondDiscountCurve * curve_
internal reference to the FittedBondDiscountCurve instance
Array solution_
solution array found from optimization, set in calculate()
Array guessSolution_
optional guess solution to be passed into constructor.
boost::shared_ptr< FittingCost > costFunction_
base class sets this cost function used in the optimization routine


class FittedBondDiscountCurve

Detailed Description

Base fitting method used to construct a fitted bond discount curve.

This base class provides the specific methodology/strategy used to construct a FittedBondDiscountCurve. Derived classes need only define the virtual function discountFunction() based on the particular fitting method to be implemented, as well as size(), the number of variables to be solved for/optimized. The generic fitting methodology implemented here can be termed nonlinear, in contrast to (typically faster, computationally) linear fitting method.

Possible enhancements

derive the special-case class LinearFittingMethods from FittingMethod. A linear fitting to a set of basis functions $ b_i(t) $ is any fitting of the form [ d(t) = um_{i=0} c_i b_i(t) ] i.e., linear in the unknown coefficients $ c_i $. Such a fitting can be reduced to a linear algebra problem $ Ax = b $, and for large numbers of bonds, would typically be much faster computationally than the generic non-linear fitting method.


some parameters to the Simplex optimization method may need to be tweaked internally to the class, depending on the fitting method used, in order to get proper/reasonable/faster convergence.

Member Function Documentation

virtual DiscountFactor discountFunction (const Array & x, Time t) const [protected, pure virtual]

derived classes must set this

user-defined discount curve, as a function of time and an array of unknown fitting coefficients $ x_i $.

Member Data Documentation

Array guessSolution_ [protected]

optional guess solution to be passed into constructor.

The idea is to use a previous solution as a guess solution to the discount curve, in an attempt to speed up calculations.


Generated automatically by Doxygen for QuantLib from the source code.