Base fitting method used to construct a fitted bond discount curve. More...
#include <ql/termstructures/yield/fittedbonddiscountcurve.hpp>
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 | |
bool | constrainAtZero () const |
return whether there is a constraint at zero | |
Array | weights () const |
return weights being used | |
Array | l2 () const |
return l2 penalties being used | |
boost::shared_ptr< OptimizationMethod > | optimizationMethod () const |
return optimization method being used | |
DiscountFactor | discount (const Array &x, Time t) const |
open discountFunction to public | |
Protected Member Functions | |
FittingMethod (bool constrainAtZero=true, const Array &weights=Array(), boost::shared_ptr< OptimizationMethod > optimizationMethod=boost::shared_ptr< OptimizationMethod >(), const Array &l2=Array()) | |
constructors | |
virtual void | init () |
rerun every time instruments/referenceDate changes | |
virtual DiscountFactor | discountFunction (const Array &x, Time t) const =0 |
discount function called by FittedBondDiscountCurve | |
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. More... | |
boost::shared_ptr< FittingCost > | costFunction_ |
base class sets this cost function used in the optimization routine | |
Friends | |
class | FittedBondDiscountCurve |
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.
Optional parameters for FittingMethod include an Array of weights, which will be used as weights to each bond. If not given or empty, then the bonds will be weighted by inverse duration
An optional Array may be provided as an L2 regularizor in this case a L2 (gaussian) penalty is applied to each parameter starting from the initial guess. This is the same as giving a Gaussian prior on the parameters
|
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.