QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
RecursiveLossModel< copulaPolicy > Class Template Reference

#include <recursivelossmodel.hpp>

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

Public Member Functions

 RecursiveLossModel (const ext::shared_ptr< ConstantLossLatentmodel< copulaPolicy > > &m, Size nbuckets=1)
 
Real expectedTrancheLoss (const Date &date) const override
 
std::vector< ReallossProbability (const Date &date) const
 
std::map< Real, ProbabilitylossDistribution (const Date &d) const override
 Full loss distribution. More...
 
Real percentile (const Date &d, Real percentile) const override
 Value at Risk given a default loss percentile. More...
 
Real expectedShortfall (const Date &d, Real perctl) const override
 Expected shortfall given a default loss percentile. More...
 
- Public Member Functions inherited from Observable
 Observable ()
 
 Observable (const Observable &)
 
Observableoperator= (const Observable &)
 
 Observable (Observable &&)=delete
 
Observableoperator= (Observable &&)=delete
 
virtual ~Observable ()=default
 
void notifyObservers ()
 

Protected Member Functions

void resetModel () override
 Concrete models do now any updates/inits they need on basket reset. More...
 
- Protected Member Functions inherited from DefaultLossModel
 DefaultLossModel ()=default
 
virtual Probability probOverLoss (const Date &d, Real lossFraction) const
 
virtual std::vector< RealsplitVaRLevel (const Date &d, Real loss) const
 Associated VaR fraction to each counterparty. More...
 
virtual std::vector< RealsplitESFLevel (const Date &d, Real loss) const
 Associated ESF fraction to each counterparty. 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< ProbabilityprobsBeingNthEvent (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
 

Protected Attributes

const ext::shared_ptr< ConstantLossLatentmodel< copulaPolicy > > copula_
 
- Protected Attributes inherited from DefaultLossModel
RelinkableHandle< Basketbasket_
 

Private Member Functions

std::map< Real, ProbabilityconditionalLossDistrib (const std::vector< Probability > &pDefDate, const std::vector< Real > &mktFactor) const
 
Real expectedConditionalLoss (const std::vector< Probability > &pDefDate, const std::vector< Real > &mktFactor) const
 Portfolio loss conditional to the market factor value. More...
 
std::vector< RealconditionalLossProb (const std::vector< Probability > &pDefDate, const std::vector< Real > &mktFactor) const
 
std::map< Real, ProbabilityconditionalLossDistribInvP (const std::vector< Real > &pDefDate, const std::vector< Real > &mktFactor) const
 
Real expectedConditionalLossInvP (const std::vector< Real > &pDefDate, const std::vector< Real > &mktFactor) const
 

Private Attributes

const Size nBuckets_
 
std::vector< Realwk_
 
Real lossUnit_
 
Real attachAmount_
 name to name factor. In the single factor copula: More...
 
Real detachAmount_
 
Real notional_
 
Size remainingBsktSize_
 
std::vector< Realnotionals_
 

Detailed Description

template<class copulaPolicy>
class QuantLib::RecursiveLossModel< copulaPolicy >

Recursive STCDO default loss model for a heterogeneous pool of names. The pool names are heterogeneous in their default probabilities, notionals and recovery rates. Correlations are given by the latent model. The recursive pricing algorithm used here is described in Andersen, Sidenius and Basu; "All your hedges in one basket", Risk, November 2003, pages 67-72

Notice that using copulas other than Gaussian it is only an
approximation (see remark on p.68).

\todo Make the loss unit equal to some small fraction depending on the
portfolio loss weights (notionals and recoveries). As it is now this
is ok for pricing but not for risk metrics. See the discussion in O'Kane
18.3.2
\todo Intengrands should all use the inverted probabilities for 
performance instead of calling the copula inversion with the same vals.

Definition at line 47 of file recursivelossmodel.hpp.

Constructor & Destructor Documentation

◆ RecursiveLossModel()

RecursiveLossModel ( const ext::shared_ptr< ConstantLossLatentmodel< copulaPolicy > > &  m,
Size  nbuckets = 1 
)
explicit

Definition at line 49 of file recursivelossmodel.hpp.

Member Function Documentation

◆ conditionalLossDistrib()

std::map< Real, Probability > conditionalLossDistrib ( const std::vector< Probability > &  pDefDate,
const std::vector< Real > &  mktFactor 
) const
private
Parameters
pDefDateVector of unconditional default probabilities for each live name (at the current evaluation date). This is passed instead of the date for performance reasons (if in the future other magnitudes -e.g. lgd- are contingent on the date they shouldd be passed too).

Definition at line 302 of file recursivelossmodel.hpp.

◆ expectedConditionalLoss()

Real expectedConditionalLoss ( const std::vector< Probability > &  pDefDate,
const std::vector< Real > &  mktFactor 
) const
private

Portfolio loss conditional to the market factor value.

Definition at line 406 of file recursivelossmodel.hpp.

◆ conditionalLossProb()

std::vector< Real > conditionalLossProb ( const std::vector< Probability > &  pDefDate,
const std::vector< Real > &  mktFactor 
) const
private

Definition at line 469 of file recursivelossmodel.hpp.

◆ conditionalLossDistribInvP()

std::map< Real, Probability > conditionalLossDistribInvP ( const std::vector< Real > &  pDefDate,
const std::vector< Real > &  mktFactor 
) const
private

Definition at line 350 of file recursivelossmodel.hpp.

◆ expectedConditionalLossInvP()

Real expectedConditionalLossInvP ( const std::vector< Real > &  pDefDate,
const std::vector< Real > &  mktFactor 
) const
private

Definition at line 438 of file recursivelossmodel.hpp.

◆ resetModel()

void resetModel ( )
overrideprotectedvirtual

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

Implements DefaultLossModel.

Definition at line 191 of file recursivelossmodel.hpp.

◆ expectedTrancheLoss()

Real expectedTrancheLoss ( const Date date) const
overridevirtual

Reimplemented from DefaultLossModel.

Definition at line 131 of file recursivelossmodel.hpp.

◆ lossProbability()

std::vector< Real > lossProbability ( const Date date) const

Definition at line 178 of file recursivelossmodel.hpp.

◆ lossDistribution()

std::map< Real, Probability > lossDistribution ( const Date ) const
overridevirtual

Full loss distribution.

Reimplemented from DefaultLossModel.

Definition at line 216 of file recursivelossmodel.hpp.

◆ percentile()

Real percentile ( const Date d,
Real  percentile 
) const
overridevirtual

Value at Risk given a default loss percentile.

Reimplemented from DefaultLossModel.

Definition at line 233 of file recursivelossmodel.hpp.

◆ expectedShortfall()

Real expectedShortfall ( const Date d,
Real  percentile 
) const
overridevirtual

Expected shortfall given a default loss percentile.

Reimplemented from DefaultLossModel.

Definition at line 262 of file recursivelossmodel.hpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ copula_

const ext::shared_ptr<ConstantLossLatentmodel<copulaPolicy> > copula_
protected

Definition at line 106 of file recursivelossmodel.hpp.

◆ nBuckets_

const Size nBuckets_
private

Definition at line 109 of file recursivelossmodel.hpp.

◆ wk_

std::vector<Real> wk_
mutableprivate

Definition at line 110 of file recursivelossmodel.hpp.

◆ lossUnit_

Real lossUnit_
mutableprivate

Definition at line 111 of file recursivelossmodel.hpp.

◆ attachAmount_

Real attachAmount_
mutableprivate

name to name factor. In the single factor copula:

Definition at line 118 of file recursivelossmodel.hpp.

◆ detachAmount_

Real detachAmount_
private

Definition at line 119 of file recursivelossmodel.hpp.

◆ notional_

Real notional_
private

Definition at line 120 of file recursivelossmodel.hpp.

◆ remainingBsktSize_

Size remainingBsktSize_
mutableprivate

Definition at line 121 of file recursivelossmodel.hpp.

◆ notionals_

std::vector<Real> notionals_
mutableprivate

Definition at line 122 of file recursivelossmodel.hpp.