Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Protected Member Functions | Protected Attributes | Friends | List of all members
DefaultLossModel Class Referenceabstract

#include <qle/models/defaultlossmodel.hpp>

+ Inheritance diagram for DefaultLossModel:
+ Collaboration diagram for DefaultLossModel:

Protected Member Functions

 DefaultLossModel ()
 

Protected Attributes

RelinkableHandle< QuantExt::Basketbasket_
 

Friends

class QuantExt::Basket
 

Statistics

virtual Real expectedTrancheLoss (const Date &d, Real recoveryRate=Null< Real >()) const
 
virtual Probability probOverLoss (const Date &d, Real lossFraction) const
 
virtual Real percentile (const Date &d, Real percentile) const
 Value at Risk given a default loss percentile. More...
 
virtual Real expectedShortfall (const Date &d, Real percentile) const
 Expected shortfall given a default loss percentile. More...
 
virtual std::vector< Real > splitVaRLevel (const Date &d, Real loss) const
 Associated VaR fraction to each counterparty. More...
 
virtual std::vector< Real > splitESFLevel (const Date &d, Real loss) const
 Associated ESF fraction to each counterparty. More...
 
virtual std::map< Real, Probability > lossDistribution (const Date &) const
 Full loss distribution. More...
 
virtual Real densityTrancheLoss (const Date &d, Real lossFraction) const
 Probability density of a given loss fraction of the basket notional. More...
 
virtual std::vector< Probability > probsBeingNthEvent (Size n, const Date &d) const
 
virtual Real defaultCorrelation (const Date &d, Size iName, Size jName) const
 Pearsons' default probability correlation. More...
 
virtual Probability probAtLeastNEvents (Size n, const Date &d) const
 
virtual Real expectedRecovery (const Date &, Size iName, const DefaultProbKey &) const
 
virtual QuantLib::Real correlation () const
 
void setBasket (QuantExt::Basket *bskt)
 
virtual void resetModel ()=0
 Concrete models do now any updates/inits they need on basket reset. More...
 

Detailed Description

Default loss model interface definition. Allows communication between the basket and specific algorithms. Intended to hold any kind of portfolio joint loss, latent models, top-down,....

An inconvenience of this design as opposed to the full arguments/results is that when pricing several derivatives instruments on the same basket not all the pricing engines would point to the same loss model; thus when pricing a set of such instruments there might be some switching on the basket loss models, which might require recalculations (of the basket) or not depending on the pricing order.

Definition at line 48 of file defaultlossmodel.hpp.

Constructor & Destructor Documentation

◆ DefaultLossModel()

DefaultLossModel ( )
protected

Definition at line 61 of file defaultlossmodel.hpp.

61{}

Member Function Documentation

◆ expectedTrancheLoss()

virtual Real expectedTrancheLoss ( const Date &  d,
Real  recoveryRate = Null<Real>() 
) const
protectedvirtual

Reimplemented in GaussianLHPLossModel.

Definition at line 71 of file defaultlossmodel.hpp.

71 {
72 QL_FAIL("expectedTrancheLoss Not implemented for this model.");
73 }

◆ probOverLoss()

virtual Probability probOverLoss ( const Date &  d,
Real  lossFraction 
) const
protectedvirtual

Probability of the tranche losing the same or more than the fractional amount given.

The passed lossFraction is a fraction of losses over the tranche notional (not the portfolio).

Reimplemented in GaussianLHPLossModel.

Definition at line 80 of file defaultlossmodel.hpp.

80 {
81 QL_FAIL("probOverLoss Not implemented for this model.");
82 }

◆ percentile()

virtual Real percentile ( const Date &  d,
Real  percentile 
) const
protectedvirtual

Value at Risk given a default loss percentile.

Reimplemented in HomogeneousPoolLossModel< copulaPolicy >, InhomogeneousPoolLossModel< copulaPolicy >, and GaussianLHPLossModel.

Definition at line 84 of file defaultlossmodel.hpp.

84 {
85 QL_FAIL("percentile Not implemented for this model.");
86 }

◆ expectedShortfall()

virtual Real expectedShortfall ( const Date &  d,
Real  percentile 
) const
protectedvirtual

Expected shortfall given a default loss percentile.

Definition at line 88 of file defaultlossmodel.hpp.

88 {
89 QL_FAIL("eSF Not implemented for this model.");
90 }

◆ splitVaRLevel()

virtual std::vector< Real > splitVaRLevel ( const Date &  d,
Real  loss 
) const
protectedvirtual

Associated VaR fraction to each counterparty.

Definition at line 92 of file defaultlossmodel.hpp.

92 {
93 QL_FAIL("splitVaRLevel Not implemented for this model.");
94 }

◆ splitESFLevel()

virtual std::vector< Real > splitESFLevel ( const Date &  d,
Real  loss 
) const
protectedvirtual

Associated ESF fraction to each counterparty.

Definition at line 96 of file defaultlossmodel.hpp.

96 {
97 QL_FAIL("splitESFLevel Not implemented for this model.");
98 }

◆ lossDistribution()

virtual std::map< Real, Probability > lossDistribution ( const Date &  ) const
protectedvirtual

Full loss distribution.

Definition at line 103 of file defaultlossmodel.hpp.

103 {
104 QL_FAIL("lossDistribution Not implemented for this model.");
105 }

◆ densityTrancheLoss()

virtual Real densityTrancheLoss ( const Date &  d,
Real  lossFraction 
) const
protectedvirtual

Probability density of a given loss fraction of the basket notional.

Definition at line 107 of file defaultlossmodel.hpp.

107 {
108 QL_FAIL("densityTrancheLoss Not implemented for this model.");
109 }

◆ probsBeingNthEvent()

virtual std::vector< Probability > probsBeingNthEvent ( Size  n,
const Date &  d 
) const
protectedvirtual

Probabilities for each of the (remaining) basket elements in the pool to have defaulted by time d and at the same time be the Nth defaulting name to default in the basket. This method is oriented to default order dependent portfolio pricing (e.g. NTDs) The probabilities ordering in the vector coincides with the pool order.

Definition at line 117 of file defaultlossmodel.hpp.

117 {
118 QL_FAIL("probsBeingNthEvent Not implemented for this model.");
119 }

◆ defaultCorrelation()

virtual Real defaultCorrelation ( const Date &  d,
Size  iName,
Size  jName 
) const
protectedvirtual

Pearsons' default probability correlation.

Reimplemented in ConstantLossModel< copulaPolicy >, and ExtendedConstantLossModel< copulaPolicy >.

Definition at line 121 of file defaultlossmodel.hpp.

121 {
122 QL_FAIL("defaultCorrelation Not implemented for this model.");
123 }

◆ probAtLeastNEvents()

virtual Probability probAtLeastNEvents ( Size  n,
const Date &  d 
) const
protectedvirtual

Returns the probaility of having a given or larger number of defaults in the basket portfolio at a given time.

Reimplemented in ConstantLossModel< copulaPolicy >, and ExtendedConstantLossModel< copulaPolicy >.

Definition at line 127 of file defaultlossmodel.hpp.

127 {
128 QL_FAIL("probAtLeastNEvents Not implemented for this model.");
129 }

◆ expectedRecovery()

virtual Real expectedRecovery ( const Date &  ,
Size  iName,
const DefaultProbKey &   
) const
protectedvirtual

Expected RR for name conditinal to default by that date.

Reimplemented in GaussianLHPLossModel, ConstantLossModel< copulaPolicy >, and ExtendedConstantLossModel< copulaPolicy >.

Definition at line 132 of file defaultlossmodel.hpp.

132 {
133 QL_FAIL("expected recovery Not implemented for this model.");
134 }

◆ correlation()

virtual QuantLib::Real correlation ( ) const
protectedvirtual

Return single correlation number for one factor models. If not implemented or not applicable, returns a Null<Real>().

Reimplemented in PoolLossModel< CopulaPolicy >.

Definition at line 140 of file defaultlossmodel.hpp.

140 {
141 return QuantLib::Null<QuantLib::Real>();
142 }

◆ setBasket()

void setBasket ( QuantExt::Basket bskt)
private

Send a reference to the basket to allow the model to read the problem arguments (contained in the basket)

Definition at line 149 of file defaultlossmodel.hpp.

149 {
150 /* After this; if the model modifies its internal status/caches (if
151 any) it should notify the prior basket to recognise that basket is
152 not in a calculated=true state. Since we dont know at this level if
153 the model keeps caches it is the children responsibility. Typically
154 this is done at the first call to calculate to the loss model, there
155 it notifies the basket. The old basket is still registered with us
156 until the basket takes in a new model....
157 ..alternatively both old basket and model could be forced reset here
158 */
159 // RL: QuantExt version
160 basket_.linkTo(QuantLib::ext::shared_ptr<QuantExt::Basket>(bskt, null_deleter()), false);
161 resetModel(); // or rename to setBasketImpl(...)
162 }
virtual void resetModel()=0
Concrete models do now any updates/inits they need on basket reset.
RelinkableHandle< QuantExt::Basket > basket_
+ Here is the call graph for this function:

◆ resetModel()

virtual void resetModel ( )
privatepure virtual

Concrete models do now any updates/inits they need on basket reset.

Implemented in ConstantLossModel< copulaPolicy >, ExtendedConstantLossModel< copulaPolicy >, HomogeneousPoolLossModel< copulaPolicy >, InhomogeneousPoolLossModel< copulaPolicy >, GaussianLHPLossModel, and PoolLossModel< CopulaPolicy >.

+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ QuantExt::Basket

friend class QuantExt::Basket
friend

Definition at line 54 of file defaultlossmodel.hpp.

Member Data Documentation

◆ basket_

RelinkableHandle<QuantExt::Basket> basket_
mutableprotected

Definition at line 59 of file defaultlossmodel.hpp.