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

Saddle point portfolio credit default loss model. More...

#include <saddlepointlossmodel.hpp>

+ Inheritance diagram for SaddlePointLossModel< CP >:
+ Collaboration diagram for SaddlePointLossModel< CP >:

Classes

class  SaddleObjectiveFunction
 
class  SaddlePercObjFunction
 

Public Member Functions

 SaddlePointLossModel (const ext::shared_ptr< ConstantLossLatentmodel< CP > > &m)
 
Real percentile (const Date &d, Probability percentile) const override
 
Probability probOverLoss (const Date &d, Real trancheLossFract) const override
 
std::map< Real, ProbabilitylossDistribution (const Date &d) const override
 Full loss distribution. More...
 
Probability probOverPortfLoss (const Date &d, Real loss) const
 
Real expectedTrancheLoss (const Date &d) const override
 
Probability probDensity (const Date &d, Real loss) const
 
std::vector< RealsplitVaRLevel (const Date &date, Real loss) const override
 
Real expectedShortfall (const Date &d, Probability percentile) 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

Real CumulantGeneratingCond (const std::vector< Real > &invUncondProbs, Real lossFraction, const std::vector< Real > &mktFactor) const
 
Real CumGen1stDerivativeCond (const std::vector< Real > &invUncondProbs, Real saddle, const std::vector< Real > &mktFactor) const
 
Real CumGen2ndDerivativeCond (const std::vector< Real > &invUncondProbs, Real saddle, const std::vector< Real > &mktFactor) const
 
Real CumGen3rdDerivativeCond (const std::vector< Real > &invUncondProbs, Real saddle, const std::vector< Real > &mktFactor) const
 
Real CumGen4thDerivativeCond (const std::vector< Real > &invUncondProbs, Real saddle, const std::vector< Real > &mktFactor) const
 
ext::tuple< Real, Real, Real, RealCumGen0234DerivCond (const std::vector< Real > &invUncondProbs, Real saddle, const std::vector< Real > &mktFactor) const
 
ext::tuple< Real, RealCumGen02DerivCond (const std::vector< Real > &invUncondProbs, Real saddle, const std::vector< Real > &mktFactor) const
 
Real CumulantGenerating (const Date &date, Real s) const
 
Real CumGen1stDerivative (const Date &date, Real s) const
 
Real CumGen2ndDerivative (const Date &date, Real s) const
 
Real CumGen3rdDerivative (const Date &date, Real s) const
 
Real CumGen4thDerivative (const Date &date, Real s) const
 
Real findSaddle (const std::vector< Real > &invUncondProbs, Real lossLevel, const std::vector< Real > &mktFactor, Real accuracy=1.0e-3, Natural maxEvaluations=50) const
 
Probability probOverLossCond (const std::vector< Real > &invUncondProbs, Real trancheLossFract, const std::vector< Real > &mktFactor) const
 
Probability probOverLossPortfCond1stOrder (const std::vector< Real > &invUncondProbs, Real loss, const std::vector< Real > &mktFactor) const
 
Probability probOverLossPortfCond (const std::vector< Real > &invUncondProbs, Real loss, const std::vector< Real > &mktFactor) const
 
Probability probDensityCond (const std::vector< Real > &invUncondProbs, Real loss, const std::vector< Real > &mktFactor) const
 
std::vector< RealsplitLossCond (const std::vector< Real > &invUncondProbs, Real loss, std::vector< Real > mktFactor) const
 
Real expectedShortfallFullPortfolioCond (const std::vector< Real > &invUncondProbs, Real lossPerc, const std::vector< Real > &mktFactor) const
 
Real expectedShortfallTrancheCond (const std::vector< Real > &invUncondProbs, Real lossPerc, Probability percentile, const std::vector< Real > &mktFactor) const
 
std::vector< RealexpectedShortfallSplitCond (const std::vector< Real > &invUncondProbs, Real lossPerc, const std::vector< Real > &mktFactor) const
 
Real conditionalExpectedLoss (const std::vector< Real > &invUncondProbs, const std::vector< Real > &mktFactor) const
 
Real conditionalExpectedTrancheLoss (const std::vector< Real > &invUncondProbs, const std::vector< Real > &mktFactor) const
 
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 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< CP > > copula_
 
Size remainingSize_
 
std::vector< RealremainingNotionals_
 
Real remainingNotional_
 
Real attachRatio_
 
Real detachRatio_
 
- Protected Attributes inherited from DefaultLossModel
RelinkableHandle< Basketbasket_
 

Detailed Description

template<class CP>
class QuantLib::SaddlePointLossModel< CP >

Saddle point portfolio credit default loss model.

Default Loss model implementing the Saddle point expansion integrations on several default risk metrics. Codepence is dealt through a latent model making the integrals conditional to the latent model factor. Latent variables are integrated indirectly.
See:
Taking to the saddle by R.Martin, K.Thompson and C.Browne; RISK JUNE 2001; p.91
The saddlepoint method and portfolio optionalities R.Martin in Risk December 2006
VAR: who contributes and how much? R.Martin, K.Thompson and C.Browne RISK AUGUST 2001
Shortfall: Who contributes and how much? R. J. Martin, Credit Suisse January 3, 2007
Don't Fall from the Saddle: the Importance of Higher Moments of Credit Loss Distributions J.Annaert, C.Garcia Joao Batista, J.Lamoot, G.Lanine February 2006, Gent University
Analytical techniques for synthetic CDOs and credit default risk measures A. Antonov, S. Mechkovy, and T. Misirpashaevz; NumeriX May 23, 2005
Computation of VaR and VaR contribution in the Vasicek portfolio credit loss model: a comparative study X.Huang, C.W.Oosterlee, M.Mesters Journal of Credit Risk (75-96) Volume 3/ Number 3, Fall 2007
Higher-order saddlepoint approximations in the Vasicek portfolio credit loss model X.Huang, C.W.Oosterlee, M.Mesters Journal of Computational Finance (93-113) Volume 11/Number 1, Fall 2007
While more expensive, a high order expansion is used here; see the paper by Antonov et al for the terms retained.
For a discussion of an alternative to fix the error at low loss levels (more relevant to pricing than risk metrics) see:
The hybrid saddlepoint method for credit portfolios by A.Owen, A.McLeod and K.Thompson; in Risk, August 2009. This is not implemented here though (yet?...)
For the more general context mathematical theory see: Saddlepoint approximations with applications by R.W. Butler, Cambridge series in statistical and probabilistic mathematics. 2007

Definition at line 100 of file saddlepointlossmodel.hpp.

Constructor & Destructor Documentation

◆ SaddlePointLossModel()

SaddlePointLossModel ( const ext::shared_ptr< ConstantLossLatentmodel< CP > > &  m)
explicit

Definition at line 102 of file saddlepointlossmodel.hpp.

Member Function Documentation

◆ CumulantGeneratingCond()

Real CumulantGeneratingCond ( const std::vector< Real > &  invUncondProbs,
Real  lossFraction,
const std::vector< Real > &  mktFactor 
) const
protected

Returns the cumulant generating function (zero-th order expansion term) conditional to the mkt factor: \( K = \sum_j ln(1-p_j + p_j e^{N_j \times lgd_j \times s}) \)

Definition at line 566 of file saddlepointlossmodel.hpp.

◆ CumGen1stDerivativeCond()

Real CumGen1stDerivativeCond ( const std::vector< Real > &  invUncondProbs,
Real  saddle,
const std::vector< Real > &  mktFactor 
) const
protected

Returns the first derivative of the cumulant generating function (first order expansion term) conditional to the mkt factor: \( K1 = \sum_j \frac{p_j \times N_j \times LGD_j \times e^{N_j \times LGD_j \times s}} \ {1-p_j + p_j e^{N_j \times LGD_j \times s}} \) One of its properties is that its value at zero is the portfolio expected loss (in fractional units). Its value at infinity is the max attainable portfolio loss. To be understood conditional to the market factor.

Definition at line 587 of file saddlepointlossmodel.hpp.

+ Here is the caller graph for this function:

◆ CumGen2ndDerivativeCond()

Real CumGen2ndDerivativeCond ( const std::vector< Real > &  invUncondProbs,
Real  saddle,
const std::vector< Real > &  mktFactor 
) const
protected

Returns the second derivative of the cumulant generating function (first order expansion term) conditional to the mkt factor: \( K2 = \sum_j \frac{p_j \times (N_j \times LGD_j)^2 \times e^{N_j \times LGD_j \times s}} {1-p_j + p_j e^{N_j \times LGD_j \times s}} - (\frac{p_j \times N_j \times LGD_j \times e^{N_j \times LGD_j \times s}} {1-p_j + p_j e^{N_j \times LGD_j \times s}})^2 \)

Definition at line 610 of file saddlepointlossmodel.hpp.

+ Here is the caller graph for this function:

◆ CumGen3rdDerivativeCond()

Real CumGen3rdDerivativeCond ( const std::vector< Real > &  invUncondProbs,
Real  saddle,
const std::vector< Real > &  mktFactor 
) const
protected

Definition at line 635 of file saddlepointlossmodel.hpp.

◆ CumGen4thDerivativeCond()

Real CumGen4thDerivativeCond ( const std::vector< Real > &  invUncondProbs,
Real  saddle,
const std::vector< Real > &  mktFactor 
) const
protected

Definition at line 666 of file saddlepointlossmodel.hpp.

◆ CumGen0234DerivCond()

ext::tuple< Real, Real, Real, Real > CumGen0234DerivCond ( const std::vector< Real > &  invUncondProbs,
Real  saddle,
const std::vector< Real > &  mktFactor 
) const
protected

Returns the cumulant and second to fourth derivatives together. Included for optimization, most methods work on expansion of these terms. Alternatively use a local private buffer member?

Definition at line 699 of file saddlepointlossmodel.hpp.

◆ CumGen02DerivCond()

ext::tuple< Real, Real > CumGen02DerivCond ( const std::vector< Real > &  invUncondProbs,
Real  saddle,
const std::vector< Real > &  mktFactor 
) const
protected

Definition at line 741 of file saddlepointlossmodel.hpp.

◆ CumulantGenerating()

Real CumulantGenerating ( const Date date,
Real  s 
) const
protected

Returns the cumulant generating function (zero-th order expansion term) weighting the conditional value by the prob density of the market factor, called by integrations

Definition at line 387 of file saddlepointlossmodel.hpp.

◆ CumGen1stDerivative()

Real CumGen1stDerivative ( const Date date,
Real  s 
) const
protected

Definition at line 403 of file saddlepointlossmodel.hpp.

◆ CumGen2ndDerivative()

Real CumGen2ndDerivative ( const Date date,
Real  s 
) const
protected

Definition at line 419 of file saddlepointlossmodel.hpp.

◆ CumGen3rdDerivative()

Real CumGen3rdDerivative ( const Date date,
Real  s 
) const
protected

Definition at line 435 of file saddlepointlossmodel.hpp.

◆ CumGen4thDerivative()

Real CumGen4thDerivative ( const Date date,
Real  s 
) const
protected

Definition at line 451 of file saddlepointlossmodel.hpp.

◆ findSaddle()

Real findSaddle ( const std::vector< Real > &  invUncondProbs,
Real  lossLevel,
const std::vector< Real > &  mktFactor,
Real  accuracy = 1.0e-3,
Natural  maxEvaluations = 50 
) const
protected

Calculates the mkt-fct-conditional saddle point for the loss level given and the probability passed. The date is implicitly given through the probability. Performance requires to pass the probabilities for that date. Otherwise once we integrate this over the market factor we would be computing the same probabilities over and over. While this works fine here some models of the recovery rate might require the date.

The passed lossLevel is in total portfolio loss fractional units.

Definition at line 776 of file saddlepointlossmodel.hpp.

+ Here is the call graph for this function:

◆ percentile()

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

Returns the loss amount at the requested date for which the probability of lossing that amount or less is equal to the value passed.

Reimplemented from DefaultLossModel.

Definition at line 847 of file saddlepointlossmodel.hpp.

+ Here is the call graph for this function:

◆ probOverLossCond()

Probability probOverLossCond ( const std::vector< Real > &  invUncondProbs,
Real  trancheLossFract,
const std::vector< Real > &  mktFactor 
) const
protected

Conditional (on the mkt factor) prob of a loss fraction of the the tranched portfolio.

The trancheLossFract parameter is the fraction over the tranche notional and must be in [0,1].

Definition at line 877 of file saddlepointlossmodel.hpp.

◆ probOverLossPortfCond1stOrder()

Probability probOverLossPortfCond1stOrder ( const std::vector< Real > &  invUncondProbs,
Real  loss,
const std::vector< Real > &  mktFactor 
) const
protected

Definition at line 1013 of file saddlepointlossmodel.hpp.

◆ probOverLoss()

Probability probOverLoss ( const Date d,
Real  lossFraction 
) const
overridevirtual

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 from DefaultLossModel.

Definition at line 467 of file saddlepointlossmodel.hpp.

+ Here is the caller graph for this function:

◆ lossDistribution()

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

Full loss distribution.

Reimplemented from DefaultLossModel.

Definition at line 896 of file saddlepointlossmodel.hpp.

◆ probOverLossPortfCond()

Probability probOverLossPortfCond ( const std::vector< Real > &  invUncondProbs,
Real  loss,
const std::vector< Real > &  mktFactor 
) const
protected

Probability of having losses in the portfolio due to default events equal or larger than a given absolute loss value on a given date conditional to the latent model factor. The integral expression on the expansion is the first order integration as presented in several references, see for instance; equation 8 in R.Martin, K.Thompson, and C. Browne 's 'Taking to the Saddle', Risk Magazine, June 2001, page 91

The passed loss is in absolute value.

Definition at line 919 of file saddlepointlossmodel.hpp.

◆ probOverPortfLoss()

Probability probOverPortfLoss ( const Date d,
Real  loss 
) const

Definition at line 488 of file saddlepointlossmodel.hpp.

◆ expectedTrancheLoss()

Real expectedTrancheLoss ( const Date d) const
overridevirtual

Reimplemented from DefaultLossModel.

Definition at line 504 of file saddlepointlossmodel.hpp.

◆ probDensityCond()

Probability probDensityCond ( const std::vector< Real > &  invUncondPs,
Real  loss,
const std::vector< Real > &  mktFactor 
) const
protected

Probability density of having losses in the total portfolio (untranched) due to default events equal to a given value on a given date conditional to the latent model factor. Based on the integrals of the expected shortfall.

NOTICE THIS IS ON THE TOTAL PORTFOLIO -— UNTRANCHED Probability density of having losses in the portfolio due to default events equal to a given value on a given date conditional to the w latent model factor. Based on the integrals of the expected shortfall. See......refernce.

Definition at line 1082 of file saddlepointlossmodel.hpp.

◆ probDensity()

Probability probDensity ( const Date d,
Real  loss 
) const

Definition at line 520 of file saddlepointlossmodel.hpp.

◆ splitLossCond()

std::vector< Real > splitLossCond ( const std::vector< Real > &  invUncondProbs,
Real  loss,
std::vector< Real mktFactor 
) const
protected

Definition at line 1127 of file saddlepointlossmodel.hpp.

◆ expectedShortfallFullPortfolioCond()

Real expectedShortfallFullPortfolioCond ( const std::vector< Real > &  invUncondProbs,
Real  lossPerc,
const std::vector< Real > &  mktFactor 
) const
protected

Definition at line 1266 of file saddlepointlossmodel.hpp.

◆ expectedShortfallTrancheCond()

Real expectedShortfallTrancheCond ( const std::vector< Real > &  invUncondProbs,
Real  lossPerc,
Probability  percentile,
const std::vector< Real > &  mktFactor 
) const
protected

Definition at line 1230 of file saddlepointlossmodel.hpp.

◆ expectedShortfallSplitCond()

std::vector< Real > expectedShortfallSplitCond ( const std::vector< Real > &  invUncondProbs,
Real  lossPerc,
const std::vector< Real > &  mktFactor 
) const
protected

Definition at line 1195 of file saddlepointlossmodel.hpp.

◆ splitVaRLevel()

std::vector< Real > splitVaRLevel ( const Date date,
Real  loss 
) const
overridevirtual

Sensitivities of the individual names to a given portfolio loss value due to defaults. It returns ratios to the total structure notional, which aggregated add up to the requested loss value. Notice then that it refers to the total portfolio, not the tranched basket.

see equation 8 in VAR: who contributes and how much? by R.Martin, K.Thompson, and C. Browne in Risk Magazine, August 2001

The passed loss is the loss amount level at which we want to request the sensitivity. Equivalent to a percentile.

Reimplemented from DefaultLossModel.

Definition at line 536 of file saddlepointlossmodel.hpp.

◆ expectedShortfall()

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

Expected shortfall given a default loss percentile.

Reimplemented from DefaultLossModel.

Definition at line 1329 of file saddlepointlossmodel.hpp.

◆ conditionalExpectedLoss()

Real conditionalExpectedLoss ( const std::vector< Real > &  invUncondProbs,
const std::vector< Real > &  mktFactor 
) const
protected

Definition at line 1156 of file saddlepointlossmodel.hpp.

◆ conditionalExpectedTrancheLoss()

Real conditionalExpectedTrancheLoss ( const std::vector< Real > &  invUncondProbs,
const std::vector< Real > &  mktFactor 
) const
protected

Definition at line 1174 of file saddlepointlossmodel.hpp.

◆ resetModel()

void resetModel ( )
overrideprotectedvirtual

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

Implements DefaultLossModel.

Definition at line 338 of file saddlepointlossmodel.hpp.

Member Data Documentation

◆ copula_

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

Definition at line 348 of file saddlepointlossmodel.hpp.

◆ remainingSize_

Size remainingSize_
mutableprotected

Definition at line 350 of file saddlepointlossmodel.hpp.

◆ remainingNotionals_

std::vector<Real> remainingNotionals_
mutableprotected

Definition at line 351 of file saddlepointlossmodel.hpp.

◆ remainingNotional_

Real remainingNotional_
mutableprotected

Definition at line 352 of file saddlepointlossmodel.hpp.

◆ attachRatio_

Real attachRatio_
mutableprotected

Definition at line 354 of file saddlepointlossmodel.hpp.

◆ detachRatio_

Real detachRatio_
protected

Definition at line 354 of file saddlepointlossmodel.hpp.