Class NelsonSiegelFitting
- Namespace
- NanoQL.TermStructures
- Assembly
- NanoQL.dll
The Nelson-Siegel fitting method: a discount function d(t) = e^(−r t), the zero rate r = c_0 + (c_1 + c_2)(1 − e^(−κt))/(κt) − c_2 e^(−κt).
public sealed class NelsonSiegelFitting : FittedBondDiscountCurveFittingMethod
- Inheritance
-
NelsonSiegelFitting
- Inherited Members
Remarks
See Nelson, C. and A. Siegel (1985): "Parsimonious modeling of yield curves for US Treasury bills." NBER Working
Paper Series, no 1594. The parameters are c_0, c_1, c_2 and κ; the method is constrained at zero. QuantLib's
constructor without the optimization method is the first constructor with l2 named.
Constructors
NelsonSiegelFitting(IEnumerable<double>?, OptimizationMethod?, IEnumerable<double>?, double, double, Constraint?)
Initializes a new instance of the NelsonSiegelFitting class.
public NelsonSiegelFitting(IEnumerable<double>? weights = null, OptimizationMethod? optimizationMethod = null, IEnumerable<double>? l2 = null, double minCutoffTime = 0, double maxCutoffTime = 1.7976931348623157E+308, Constraint? constraint = null)
Parameters
weightsIEnumerable<double>The bonds' weights, or null or empty for their inverse durations.
optimizationMethodOptimizationMethodl2IEnumerable<double>The L2 penalties, one per parameter, or null or empty for none.
minCutoffTimedoubleThe time before which the discount extrapolates with a flat forward rate.
maxCutoffTimedoubleThe time after which the discount extrapolates with a flat forward rate.
constraintConstraintThe optimization's constraint, or null for none.
Properties
Size
Gets the total number of coefficients to fit, or solve for.
public override int Size { get; }
Property Value
Remarks
Four: c_0, c_1, c_2 and κ.
Methods
DiscountFunction(ReadOnlySpan<double>, double)
The discount function the curve is fitted to, at given parameters.
protected override double DiscountFunction(ReadOnlySpan<double> x, double t)
Parameters
xReadOnlySpan<double>The parameters, Size of them.
tdoubleThe time.
Returns
- double
The discount factor.