QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ExponentialSplinesFitting Class Reference

Exponential-splines fitting method. More...

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

+ Inheritance diagram for ExponentialSplinesFitting:
+ Collaboration diagram for ExponentialSplinesFitting:

Public Member Functions

 ExponentialSplinesFitting (bool constrainAtZero=true, const Array &weights=Array(), const ext::shared_ptr< OptimizationMethod > &optimizationMethod=ext::shared_ptr< OptimizationMethod >(), const Array &l2=Array(), Real minCutoffTime=0.0, Real maxCutoffTime=QL_MAX_REAL, Size numCoeffs=9, Real fixedKappa=Null< Real >())
 
 ExponentialSplinesFitting (bool constrainAtZero, const Array &weights, const Array &l2, Real minCutoffTime=0.0, Real maxCutoffTime=QL_MAX_REAL, Size numCoeffs=9, Real fixedKappa=Null< Real >())
 
 ExponentialSplinesFitting (bool constrainAtZero, Size numCoeffs, Real fixedKappa, const Array &weights=Array())
 
std::unique_ptr< FittedBondDiscountCurve::FittingMethodclone () const override
 clone of the current object More...
 
- Public Member Functions inherited from FittedBondDiscountCurve::FittingMethod
virtual ~FittingMethod ()=default
 
virtual Size size () const =0
 total number of coefficients to fit/solve for More...
 
Array solution () const
 output array of results of optimization problem More...
 
Integer numberOfIterations () const
 final number of iterations used in the optimization problem More...
 
Real minimumCostValue () const
 final value of cost function after optimization More...
 
EndCriteria::Type errorCode () const
 error code of the optimization More...
 
virtual std::unique_ptr< FittingMethodclone () const =0
 clone of the current object More...
 
bool constrainAtZero () const
 return whether there is a constraint at zero More...
 
Array weights () const
 return weights being used More...
 
Array l2 () const
 return l2 penalties being used More...
 
ext::shared_ptr< OptimizationMethodoptimizationMethod () const
 return optimization method being used More...
 
DiscountFactor discount (const Array &x, Time t) const
 open discountFunction to public More...
 

Private Member Functions

Size size () const override
 total number of coefficients to fit/solve for More...
 
DiscountFactor discountFunction (const Array &x, Time t) const override
 discount function called by FittedBondDiscountCurve More...
 

Private Attributes

Natural numCoeffs_
 
Real fixedKappa_
 

Additional Inherited Members

- Protected Member Functions inherited from FittedBondDiscountCurve::FittingMethod
 FittingMethod (bool constrainAtZero=true, const Array &weights=Array(), ext::shared_ptr< OptimizationMethod > optimizationMethod=ext::shared_ptr< OptimizationMethod >(), Array l2=Array(), Real minCutoffTime=0.0, Real maxCutoffTime=QL_MAX_REAL)
 constructors More...
 
virtual void init ()
 rerun every time instruments/referenceDate changes More...
 
virtual DiscountFactor discountFunction (const Array &x, Time t) const =0
 discount function called by FittedBondDiscountCurve More...
 
- Protected Attributes inherited from FittedBondDiscountCurve::FittingMethod
bool constrainAtZero_
 constrains discount function to unity at \( T=0 \), if true More...
 
FittedBondDiscountCurvecurve_
 internal reference to the FittedBondDiscountCurve instance More...
 
Array solution_
 solution array found from optimization, set in calculate() More...
 
Array guessSolution_
 optional guess solution to be passed into constructor. More...
 
ext::shared_ptr< FittingCost > costFunction_
 base class sets this cost function used in the optimization routine More...
 

Detailed Description

Exponential-splines fitting method.

Fits a discount function to the exponential form

\[ d(t) = \sum_{i=1}^9 c_i \exp^{-kappa i t} \]

where the constants \( c_i \) and \( \kappa \) are to be determined. See:Li, B., E. DeWetering, G. Lucas, R. Brenner and A. Shapiro (2001): "Merrill Lynch Exponential Spline Model." Merrill Lynch Working Paper

\( \kappa \) can be passed a fixed value, in which case it is excluded from optimization.

Warning:
convergence may be slow
Examples
FittedBondCurve.cpp.

Definition at line 49 of file nonlinearfittingmethods.hpp.

Constructor & Destructor Documentation

◆ ExponentialSplinesFitting() [1/3]

ExponentialSplinesFitting ( bool  constrainAtZero = true,
const Array weights = Array(),
const ext::shared_ptr< OptimizationMethod > &  optimizationMethod = ext::shared_ptr<OptimizationMethod>(),
const Array l2 = Array(),
Real  minCutoffTime = 0.0,
Real  maxCutoffTime = QL_MAX_REAL,
Size  numCoeffs = 9,
Real  fixedKappa = Null<Real>() 
)

Definition at line 28 of file nonlinearfittingmethods.cpp.

+ Here is the call graph for this function:

◆ ExponentialSplinesFitting() [2/3]

ExponentialSplinesFitting ( bool  constrainAtZero,
const Array weights,
const Array l2,
Real  minCutoffTime = 0.0,
Real  maxCutoffTime = QL_MAX_REAL,
Size  numCoeffs = 9,
Real  fixedKappa = Null<Real>() 
)

Definition at line 44 of file nonlinearfittingmethods.cpp.

+ Here is the call graph for this function:

◆ ExponentialSplinesFitting() [3/3]

ExponentialSplinesFitting ( bool  constrainAtZero,
Size  numCoeffs,
Real  fixedKappa,
const Array weights = Array() 
)

Definition at line 55 of file nonlinearfittingmethods.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ clone()

std::unique_ptr< FittedBondDiscountCurve::FittingMethod > clone ( ) const
overridevirtual

clone of the current object

Implements FittedBondDiscountCurve::FittingMethod.

Definition at line 66 of file nonlinearfittingmethods.cpp.

◆ size()

Size size ( ) const
overrideprivatevirtual

total number of coefficients to fit/solve for

Implements FittedBondDiscountCurve::FittingMethod.

Definition at line 71 of file nonlinearfittingmethods.cpp.

+ Here is the caller graph for this function:

◆ discountFunction()

DiscountFactor discountFunction ( const Array x,
Time  t 
) const
overrideprivatevirtual

discount function called by FittedBondDiscountCurve

Implements FittedBondDiscountCurve::FittingMethod.

Definition at line 77 of file nonlinearfittingmethods.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ numCoeffs_

Natural numCoeffs_
private

Definition at line 76 of file nonlinearfittingmethods.hpp.

◆ fixedKappa_

Real fixedKappa_
private

Definition at line 77 of file nonlinearfittingmethods.hpp.