Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Classes | Public Types | Static Public Member Functions | List of all members
SurvivalProbability Struct Reference

Survival probability curve traits. More...

#include <qle/termstructures/probabilitytraits.hpp>

+ Collaboration diagram for SurvivalProbability:

Classes

struct  curve
 

Public Types

typedef QuantLib::BootstrapHelper< QuantLib::DefaultProbabilityTermStructure > helper
 

Static Public Member Functions

static QuantLib::Date initialDate (const QuantLib::DefaultProbabilityTermStructure *c)
 
static QuantLib::Real initialValue (const QuantLib::DefaultProbabilityTermStructure *)
 
template<class C >
static QuantLib::Real guess (QuantLib::Size i, const C *c, bool validData, QuantLib::Size)
 
template<class C >
static QuantLib::Real minValueAfter (QuantLib::Size i, const C *c, bool validData, QuantLib::Size)
 
template<class C >
static QuantLib::Real maxValueAfter (QuantLib::Size i, const C *c, bool validData, QuantLib::Size)
 
static void updateGuess (std::vector< QuantLib::Real > &data, QuantLib::Probability p, QuantLib::Size i)
 
static QuantLib::Size maxIterations ()
 

Detailed Description

Survival probability curve traits.

Definition at line 39 of file probabilitytraits.hpp.

Member Typedef Documentation

◆ helper

typedef QuantLib::BootstrapHelper<QuantLib::DefaultProbabilityTermStructure> helper

Definition at line 47 of file probabilitytraits.hpp.

Member Function Documentation

◆ initialDate()

static QuantLib::Date initialDate ( const QuantLib::DefaultProbabilityTermStructure *  c)
static

Definition at line 50 of file probabilitytraits.hpp.

50{ return c->referenceDate(); }

◆ initialValue()

static QuantLib::Real initialValue ( const QuantLib::DefaultProbabilityTermStructure *  )
static

Definition at line 53 of file probabilitytraits.hpp.

53{ return 1.0; }

◆ guess()

static QuantLib::Real guess ( QuantLib::Size  i,
const C *  c,
bool  validData,
QuantLib::Size   
)
static

Definition at line 56 of file probabilitytraits.hpp.

56 {
57
58 // If have already bootstrapped some points, use the previous point
59 if (validData)
60 return c->data()[i];
61
62 // If haven't already bootstrapped some points, initial guess
63 if (i == 1)
64 return 1.0 / (1.0 + detail::avgHazardRate * 0.25);
65
66 // extrapolate
67 Date d = c->dates()[i];
68 return c->survivalProbability(d, true);
69 }
const QuantLib::Real avgHazardRate

◆ minValueAfter()

static QuantLib::Real minValueAfter ( QuantLib::Size  i,
const C *  c,
bool  validData,
QuantLib::Size   
)
static

Definition at line 73 of file probabilitytraits.hpp.

73 {
74
75 if (validData) {
76 return c->data().back() / 2.0;
77 }
78
79 Time dt = c->times()[i] - c->times()[i - 1];
80 return c->data()[i - 1] * std::exp(-detail::maxHazardRate * dt);
81 }
const QuantLib::Real maxHazardRate

◆ maxValueAfter()

static QuantLib::Real maxValueAfter ( QuantLib::Size  i,
const C *  c,
bool  validData,
QuantLib::Size   
)
static

Definition at line 84 of file probabilitytraits.hpp.

84 {
85 // survival probability cannot increase
86 return c->data()[i - 1];
87 }

◆ updateGuess()

static void updateGuess ( std::vector< QuantLib::Real > &  data,
QuantLib::Probability  p,
QuantLib::Size  i 
)
static

Definition at line 90 of file probabilitytraits.hpp.

90 {
91 data[i] = p;
92 }

◆ maxIterations()

static QuantLib::Size maxIterations ( )
static

Definition at line 95 of file probabilitytraits.hpp.

95{ return 50; }