Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Attributes | List of all members
ExtendedConstantLossLatentModel< copulaPolicy > Class Template Reference

#include <qle/models/extendedconstantlosslatentmodel.hpp>

+ Inheritance diagram for ExtendedConstantLossLatentModel< copulaPolicy >:
+ Collaboration diagram for ExtendedConstantLossLatentModel< copulaPolicy >:

Public Member Functions

 ExtendedConstantLossLatentModel (const std::vector< std::vector< Real > > &factorWeights, const std::vector< Real > &recoveries, const std::vector< std::vector< Real > > &recoveryProbabilities, const std::vector< std::vector< Real > > &recoveryRates, LatentModelIntegrationType::LatentModelIntegrationType integralType, const initTraits &ini=initTraits())
 
 ExtendedConstantLossLatentModel (const Handle< Quote > &mktCorrel, const std::vector< Real > &recoveries, const std::vector< std::vector< Real > > &recoveryProbabilities, const std::vector< std::vector< Real > > &recoveryRates, LatentModelIntegrationType::LatentModelIntegrationType integralType, Size nVariables, const initTraits &ini=initTraits())
 
void checkStochasticRecoveries ()
 
Real conditionalRecovery (const Date &d, Size iName, const std::vector< Real > &mktFactors) const
 
Real conditionalRecovery (Probability uncondDefP, Size iName, const std::vector< Real > &mktFactors) const
 
Real conditionalRecoveryInvP (Real invUncondDefP, Size iName, const std::vector< Real > &mktFactors) const
 
Real conditionalRecovery (Real latentVarSample, Size iName, const Date &d) const
 
const std::vector< Real > & recoveries () const
 
Real expectedRecovery (const Date &d, Size iName, const DefaultProbKey &defKeys) const
 
const std::vector< std::vector< Real > > & recoveryProbabilities ()
 
const std::vector< std::vector< Real > > & recoveryRateGrids ()
 
- Public Member Functions inherited from DefaultLatentModel< copulaPolicy >
 DefaultLatentModel (const std::vector< std::vector< Real > > &factorWeights, LatentModelIntegrationType::LatentModelIntegrationType integralType, const initTraits &ini=initTraits())
 
 DefaultLatentModel (const Handle< Quote > &mktCorrel, Size nVariables, LatentModelIntegrationType::LatentModelIntegrationType integralType, const initTraits &ini=initTraits())
 
void resetBasket (const QuantLib::ext::shared_ptr< Basket > basket) const
 
Probability conditionalDefaultProbability (Probability prob, Size iName, const std::vector< Real > &mktFactors) const
 
Probability conditionalDefaultProbabilityInvP (Real invCumYProb, Size iName, const std::vector< Real > &m) const
 
Probability probOfDefault (Size iName, const Date &d) const
 
Real defaultCorrelation (const Date &d, Size iNamei, Size iNamej) const
 
Probability probAtLeastNEvents (Size n, const Date &date) const
 

Private Types

typedef copulaPolicy::initTraits initTraits
 

Private Attributes

const std::vector< Real > recoveries_
 
std::vector< std::vector< Real > > recoveryProbabilities_
 
std::vector< std::vector< Real > > recoveryRates_
 

Additional Inherited Members

- Protected Member Functions inherited from DefaultLatentModel< copulaPolicy >
void update () override
 
Probability conditionalDefaultProbability (const Date &date, Size iName, const std::vector< Real > &mktFactors) const
 
Probability condProbProduct (Real invCumYProb1, Real invCumYProb2, Size iName1, Size iName2, const std::vector< Real > &mktFactors) const
 
Real conditionalProbAtLeastNEvents (Size n, const Date &date, const std::vector< Real > &mktFactors) const
 Conditional probability of n default events or more. More...
 
const QuantLib::ext::shared_ptr< LMIntegration > & integration () const override
 access to integration: More...
 
- Protected Attributes inherited from DefaultLatentModel< copulaPolicy >
QuantLib::ext::shared_ptr< Basketbasket_
 
QuantLib::ext::shared_ptr< LMIntegration > integration_
 

Detailed Description

template<class copulaPolicy>
class QuantExt::ExtendedConstantLossLatentModel< copulaPolicy >

Constant deterministic loss amount default latent model, extended to cover a discrete distribution of recovery rates following Krekel (2008), https://ssrn.com/abstract=11340228. For each obligor we pass a vector of J recovery probabilities p_1, ..., p_J and recovery rates in decreasing order r_1 > r_2 > ... > r_J contional on default. If this data is empty, the extended model will fall back on the ConstantLossLatentModel.

Definition at line 37 of file extendedconstantlosslatentmodel.hpp.

Member Typedef Documentation

◆ initTraits

typedef copulaPolicy::initTraits initTraits
private

Definition at line 40 of file extendedconstantlosslatentmodel.hpp.

Constructor & Destructor Documentation

◆ ExtendedConstantLossLatentModel() [1/2]

ExtendedConstantLossLatentModel ( const std::vector< std::vector< Real > > &  factorWeights,
const std::vector< Real > &  recoveries,
const std::vector< std::vector< Real > > &  recoveryProbabilities,
const std::vector< std::vector< Real > > &  recoveryRates,
LatentModelIntegrationType::LatentModelIntegrationType  integralType,
const initTraits ini = initTraits() 
)

Definition at line 43 of file extendedconstantlosslatentmodel.hpp.

48 : DefaultLatentModel<copulaPolicy>(factorWeights, integralType, ini), recoveries_(recoveries),
50 QL_REQUIRE(recoveries.size() == factorWeights.size(), "Incompatible factors and recovery sizes.");
52 }
const std::vector< std::vector< Real > > & recoveryProbabilities()
+ Here is the call graph for this function:

◆ ExtendedConstantLossLatentModel() [2/2]

ExtendedConstantLossLatentModel ( const Handle< Quote > &  mktCorrel,
const std::vector< Real > &  recoveries,
const std::vector< std::vector< Real > > &  recoveryProbabilities,
const std::vector< std::vector< Real > > &  recoveryRates,
LatentModelIntegrationType::LatentModelIntegrationType  integralType,
Size  nVariables,
const initTraits ini = initTraits() 
)

Definition at line 54 of file extendedconstantlosslatentmodel.hpp.

59 : DefaultLatentModel<copulaPolicy>(mktCorrel, nVariables, integralType, ini), recoveries_(recoveries),
61 // actually one could define the other and get rid of the variable
62 // here and in other similar models
63 QL_REQUIRE(recoveries.size() == nVariables, "Incompatible model and recovery sizes.");
65 }
+ Here is the call graph for this function:

Member Function Documentation

◆ checkStochasticRecoveries()

void checkStochasticRecoveries ( )

Definition at line 68 of file extendedconstantlosslatentmodel.hpp.

68 {
69 QL_REQUIRE(recoveryProbabilities_.size() == recoveryRates_.size(), "number of recovery probability vectors and market recovery rates differ");
70 if (recoveryProbabilities_.size() == 0)
71 return;
72 QL_REQUIRE(recoveryProbabilities_.size() == recoveries_.size(), "number of recovery rates and recovery probablity vectors differ");
73 for (Size i = 0; i < recoveries_.size(); ++i) {
74 QL_REQUIRE(recoveryProbabilities_[i].size() == recoveryRates_[i].size(), "recovery and probability vector size mismatch for obligor " << i);
75 Real expectedRecovery = 0.0;
76 for (Size j = 0; j < recoveryProbabilities_[i].size(); ++j)
78 QL_REQUIRE(QuantLib::close_enough(expectedRecovery, recoveries_[i]), "expected recovery does not match market recovery rate for obligor " << i);
79 }
80 }
Real expectedRecovery(const Date &d, Size iName, const DefaultProbKey &defKeys) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ conditionalRecovery() [1/3]

Real conditionalRecovery ( const Date &  d,
Size  iName,
const std::vector< Real > &  mktFactors 
) const

Definition at line 82 of file extendedconstantlosslatentmodel.hpp.

82 {
83 return recoveries_[iName];
84 }

◆ conditionalRecovery() [2/3]

Real conditionalRecovery ( Probability  uncondDefP,
Size  iName,
const std::vector< Real > &  mktFactors 
) const

Definition at line 86 of file extendedconstantlosslatentmodel.hpp.

86 {
87 return recoveries_[iName];
88 }

◆ conditionalRecoveryInvP()

Real conditionalRecoveryInvP ( Real  invUncondDefP,
Size  iName,
const std::vector< Real > &  mktFactors 
) const

Definition at line 90 of file extendedconstantlosslatentmodel.hpp.

90 {
91 return recoveries_[iName];
92 }

◆ conditionalRecovery() [3/3]

Real conditionalRecovery ( Real  latentVarSample,
Size  iName,
const Date &  d 
) const

Definition at line 94 of file extendedconstantlosslatentmodel.hpp.

94{ return recoveries_[iName]; }

◆ recoveries()

const std::vector< Real > & recoveries ( ) const

Definition at line 96 of file extendedconstantlosslatentmodel.hpp.

96{ return recoveries_; }
+ Here is the caller graph for this function:

◆ expectedRecovery()

Real expectedRecovery ( const Date &  d,
Size  iName,
const DefaultProbKey &  defKeys 
) const

Definition at line 101 of file extendedconstantlosslatentmodel.hpp.

101{ return recoveries_[iName]; }
+ Here is the caller graph for this function:

◆ recoveryProbabilities()

const std::vector< std::vector< Real > > & recoveryProbabilities ( )

Definition at line 103 of file extendedconstantlosslatentmodel.hpp.

103{ return recoveryProbabilities_; }

◆ recoveryRateGrids()

const std::vector< std::vector< Real > > & recoveryRateGrids ( )

Definition at line 104 of file extendedconstantlosslatentmodel.hpp.

104{ return recoveryRates_; }

Member Data Documentation

◆ recoveries_

const std::vector<Real> recoveries_
private

Definition at line 39 of file extendedconstantlosslatentmodel.hpp.

◆ recoveryProbabilities_

std::vector<std::vector<Real> > recoveryProbabilities_
private

Definition at line 107 of file extendedconstantlosslatentmodel.hpp.

◆ recoveryRates_

std::vector<std::vector<Real> > recoveryRates_
private

Definition at line 108 of file extendedconstantlosslatentmodel.hpp.