Struct SurvivalProbability
- Namespace
- NanoQL.TermStructures
- Assembly
- NanoQL.dll
The survival-probability curve traits: the bootstrap of survival probabilities, and the formulas of InterpolatedSurvivalProbabilityCurve<TInterpolator>.
public readonly struct SurvivalProbability : IDefaultProbabilityTraits, IBootstrapTraits<DefaultProbabilityTermStructure>
- Implements
- Inherited Members
Remarks
A stateless configuration struct, as every bootstrap traits struct is.
Explicit Interface Implementations
DefaultDensityImpl(ReadOnlySpan<double>, ReadOnlySpan<double>, Interpolation, double)
The default density: minus the interpolation's derivative, at the last node's hazard rate past it.
static double DefaultDensityImpl(ReadOnlySpan<double> times, ReadOnlySpan<double> data, Interpolation interpolation, double t)
Parameters
timesReadOnlySpan<double>The nodes' times.
dataReadOnlySpan<double>The nodes' survival probabilities.
interpolationInterpolationThe interpolation of the probabilities.
tdoubleThe time.
Returns
- double
The density.
Exceptions
- ArgumentException
timesis empty, ortis past the last time anddatais empty, where QuantLib reads past their end.
Guess(int, BootstrapState<DefaultProbabilityTermStructure>, bool, int)
The guess for a node's value.
static double Guess(int i, BootstrapState<DefaultProbabilityTermStructure> c, bool validData, int firstAliveHelper)
Parameters
iintThe node.
cBootstrapState<DefaultProbabilityTermStructure>The working state of the curve under construction.
validDataboolWhether the curve's data hold a previous pass's values.
firstAliveHelperintThe index of the first helper alive at the curve's first date.
Returns
- double
The guess.
HazardRateImpl(ReadOnlySpan<double>, ReadOnlySpan<double>, Interpolation, double, DefaultProbabilityTermStructure)
The hazard rate: the base's, the default density over the survival probability, read through the curve.
static double HazardRateImpl(ReadOnlySpan<double> times, ReadOnlySpan<double> data, Interpolation interpolation, double t, DefaultProbabilityTermStructure curve)
Parameters
timesReadOnlySpan<double>The nodes' times, which this kind doesn't read.
dataReadOnlySpan<double>The nodes' data, which this kind doesn't read.
interpolationInterpolationThe interpolation, which this kind doesn't read.
tdoubleThe time.
curveDefaultProbabilityTermStructureThe curve.
Returns
- double
The rate.
InitialDate(BootstrapState<DefaultProbabilityTermStructure>)
The start of the curve's data: the reference date.
static Date InitialDate(BootstrapState<DefaultProbabilityTermStructure> c)
Parameters
cBootstrapState<DefaultProbabilityTermStructure>The working state of the curve under construction.
Returns
- Date
The date.
InitialValue(BootstrapState<DefaultProbabilityTermStructure>)
The value at the reference date: 1.
static double InitialValue(BootstrapState<DefaultProbabilityTermStructure> c)
Parameters
cBootstrapState<DefaultProbabilityTermStructure>The working state of the curve under construction.
Returns
- double
The value.
MaxDate(ReadOnlySpan<Date>)
The maximum date: the last node's.
static Date MaxDate(ReadOnlySpan<Date> dates)
Parameters
datesReadOnlySpan<Date>The nodes' dates.
Returns
- Date
The date.
Exceptions
- ArgumentException
datesis empty, where QuantLib reads past its end.
MaxIterations
Gets the upper bound of the bootstrap's convergence loop: 50.
static int MaxIterations { get; }
Returns
MaxValueAfter(int, BootstrapState<DefaultProbabilityTermStructure>, bool, int)
The upper bound of a node's value, from the previous values.
static double MaxValueAfter(int i, BootstrapState<DefaultProbabilityTermStructure> c, bool validData, int firstAliveHelper)
Parameters
iintThe node.
cBootstrapState<DefaultProbabilityTermStructure>The working state of the curve under construction.
validDataboolWhether the curve's data hold a previous pass's values.
firstAliveHelperintThe index of the first helper alive at the curve's first date.
Returns
- double
The bound.
MinValueAfter(int, BootstrapState<DefaultProbabilityTermStructure>, bool, int)
The lower bound of a node's value, from the previous values.
static double MinValueAfter(int i, BootstrapState<DefaultProbabilityTermStructure> c, bool validData, int firstAliveHelper)
Parameters
iintThe node.
cBootstrapState<DefaultProbabilityTermStructure>The working state of the curve under construction.
validDataboolWhether the curve's data hold a previous pass's values.
firstAliveHelperintThe index of the first helper alive at the curve's first date.
Returns
- double
The bound.
SurvivalProbabilityImpl(ReadOnlySpan<double>, ReadOnlySpan<double>, Interpolation, double)
The survival probability: the interpolation's, at the last node's hazard rate past it.
static double SurvivalProbabilityImpl(ReadOnlySpan<double> times, ReadOnlySpan<double> data, Interpolation interpolation, double t)
Parameters
timesReadOnlySpan<double>The nodes' times.
dataReadOnlySpan<double>The nodes' survival probabilities.
interpolationInterpolationThe interpolation of the probabilities.
tdoubleThe time.
Returns
- double
The probability.
Exceptions
- ArgumentException
timesis empty, ortis past the last time anddatais empty, where QuantLib reads past their end.
UpdateGuess(double[], double, int)
Writes a root finder's trial value into the curve's data: QuantLib's updateGuess.
static void UpdateGuess(double[] data, double p, int i)
Parameters
Exceptions
- ArgumentOutOfRangeException
iisn't a point ofdata, where QuantLib writes past its end.