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

#include <gaussianlhplossmodel.hpp>

+ Inheritance diagram for GaussianLHPLossModel:
+ Collaboration diagram for GaussianLHPLossModel:

Public Types

typedef GaussianCopulaPolicy copulaType
 
- Public Types inherited from LatentModel< GaussianCopulaPolicy >
typedef GaussianCopulaPolicy copulaType
 
- Public Types inherited from Observer
typedef set_type::iterator iterator
 

Public Member Functions

 GaussianLHPLossModel (const Handle< Quote > &correlQuote, const std::vector< Handle< RecoveryRateQuote > > &quotes)
 
 GaussianLHPLossModel (Real correlation, const std::vector< Real > &recoveries)
 
 GaussianLHPLossModel (const Handle< Quote > &correlQuote, const std::vector< Real > &recoveries)
 
void update () override
 
Real expectedTrancheLoss (const Date &d) const override
 
Real probOverLoss (const Date &d, Real remainingLossFraction) const override
 
Real expectedShortfall (const Date &d, Probability perctl) const override
 Returns the ESF as an absolute amount (rather than a fraction) More...
 
Real percentile (const Date &d, Real perctl) const override
 Value at Risk given a default loss percentile. More...
 
Probability averageProb (const Date &d) const
 
Real averageRecovery (const Date &d) const
 
- Public Member Functions inherited from Observable
 Observable ()
 
 Observable (const Observable &)
 
Observableoperator= (const Observable &)
 
 Observable (Observable &&)=delete
 
Observableoperator= (Observable &&)=delete
 
virtual ~Observable ()=default
 
void notifyObservers ()
 
- Public Member Functions inherited from LatentModel< GaussianCopulaPolicy >
void update () override
 
Size size () const
 
Size numFactors () const
 Number of systemic factors. More...
 
Size numTotalFactors () const
 Number of total free random factors; systemic and idiosyncratic. More...
 
 LatentModel (const std::vector< std::vector< Real > > &factorsWeights, const typename copulaType::initTraits &ini=typename copulaType::initTraits())
 
 LatentModel (const std::vector< Real > &factorsWeight, const typename copulaType::initTraits &ini=typename copulaType::initTraits())
 
 LatentModel (Real correlSqr, Size nVariables, const typename copulaType::initTraits &ini=typename copulaType::initTraits())
 
 LatentModel (const Handle< Quote > &singleFactorCorrel, Size nVariables, const typename copulaType::initTraits &ini=typename copulaType::initTraits())
 
const std::vector< std::vector< Real > > & factorWeights () const
 Provides values of the factors \( a_{i,k} \). More...
 
const std::vector< Real > & idiosyncFctrs () const
 Provides values of the normalized idiosyncratic factors \( Z_i \). More...
 
Real latentVariableCorrel (Size iVar1, Size iVar2) const
 Latent variable correlations: More...
 
Probability cumulativeY (Real val, Size iVariable) const
 
Probability cumulativeZ (Real z) const
 Cumulative distribution of Z, the idiosyncratic/error factors. More...
 
Probability density (const std::vector< Real > &m) const
 Density function of M, the market/systemic factors. More...
 
Real inverseCumulativeDensity (Probability p, Size iFactor) const
 Inverse cumulative distribution of the systemic factor iFactor. More...
 
Real inverseCumulativeY (Probability p, Size iVariable) const
 
Real inverseCumulativeZ (Probability p) const
 
std::vector< RealallFactorCumulInverter (const std::vector< Real > &probs) const
 
Real latentVarValue (const std::vector< Real > &allFactors, Size iVar) const
 
const copulaTypecopula () const
 
Real integratedExpectedValue (const ext::function< Real(const std::vector< Real > &v1)> &f) const
 
std::vector< RealintegratedExpectedValueV (const ext::function< std::vector< Real >(const std::vector< Real > &v1)> &f) const
 
- Public Member Functions inherited from Observer
 Observer ()=default
 
 Observer (const Observer &)
 
Observeroperator= (const Observer &)
 
virtual ~Observer ()
 
std::pair< iterator, boolregisterWith (const ext::shared_ptr< Observable > &)
 
void registerWithObservables (const ext::shared_ptr< Observer > &)
 
Size unregisterWith (const ext::shared_ptr< Observable > &)
 
void unregisterWithAll ()
 
virtual void update ()=0
 
virtual void deepUpdate ()
 

Protected Member Functions

Real percentilePortfolioLossFraction (const Date &d, Real perctl) const
 
Real expectedRecovery (const Date &d, Size iName, const DefaultProbKey &ik) const override
 
- Protected Member Functions inherited from DefaultLossModel
 DefaultLossModel ()=default
 
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 std::map< Real, ProbabilitylossDistribution (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< 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
 
- Protected Member Functions inherited from LatentModel< GaussianCopulaPolicy >
virtual const ext::shared_ptr< LMIntegration > & integration () const
 

Private Member Functions

void resetModel () override
 Concrete models do now any updates/inits they need on basket reset. More...
 
Real expectedTrancheLossImpl (Real remainingNot, Real prob, Real averageRR, Real attachLimit, Real detachLimit) const
 

Private Attributes

Real sqrt1minuscorrel_
 
Handle< Quotecorrel_
 
std::vector< Handle< RecoveryRateQuote > > rrQuotes_
 
Real beta_
 
BivariateCumulativeNormalDistribution biphi_
 

Static Private Attributes

static CumulativeNormalDistribution const phi_
 

Additional Inherited Members

- Protected Attributes inherited from DefaultLossModel
RelinkableHandle< Basketbasket_
 
- Protected Attributes inherited from LatentModel< GaussianCopulaPolicy >
std::vector< std::vector< Real > > factorWeights_
 
Handle< QuotecachedMktFactor_
 
std::vector< RealidiosyncFctrs_
 
Size nFactors_
 Number of systemic factors. More...
 
Size nVariables_
 Number of latent model variables, idiosyncratic terms or model dim. More...
 
copulaType copula_
 

Detailed Description

Portfolio loss model with analytical expected tranche loss for a large homogeneous pool with Gaussian one-factor copula. See for example "The Normal Inverse Gaussian Distribution for Synthetic CDO pricing.", Anna Kalemanova, Bernd Schmid, Ralf Werner, Journal of Derivatives, Vol. 14, No. 3, (Spring 2007), pp. 80-93. http://www.defaultrisk.com/pp_crdrv_91.htm

It can be used to price a credit derivative or to provide risk metrics of a portfolio.

Definition at line 61 of file gaussianlhplossmodel.hpp.

Member Typedef Documentation

◆ copulaType

Definition at line 64 of file gaussianlhplossmodel.hpp.

Constructor & Destructor Documentation

◆ GaussianLHPLossModel() [1/3]

GaussianLHPLossModel ( const Handle< Quote > &  correlQuote,
const std::vector< Handle< RecoveryRateQuote > > &  quotes 
)

Definition at line 33 of file gaussianlhplossmodel.cpp.

+ Here is the call graph for this function:

◆ GaussianLHPLossModel() [2/3]

GaussianLHPLossModel ( Real  correlation,
const std::vector< Real > &  recoveries 
)

Definition at line 51 of file gaussianlhplossmodel.cpp.

◆ GaussianLHPLossModel() [3/3]

GaussianLHPLossModel ( const Handle< Quote > &  correlQuote,
const std::vector< Real > &  recoveries 
)

Definition at line 67 of file gaussianlhplossmodel.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ update()

void update ( )
overridevirtual

This method must be implemented in derived classes. An instance of Observer does not call this method directly: instead, it will be called by the observables the instance registered with when they need to notify any changes.

Implements Observer.

Definition at line 78 of file gaussianlhplossmodel.hpp.

◆ resetModel()

void resetModel ( )
overrideprivatevirtual

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

Implements DefaultLossModel.

Definition at line 88 of file gaussianlhplossmodel.hpp.

◆ expectedTrancheLossImpl()

Real expectedTrancheLossImpl ( Real  remainingNot,
Real  prob,
Real  averageRR,
Real  attachLimit,
Real  detachLimit 
) const
private
Parameters
attachLimitas a fraction of the underlying live portfolio notional

Definition at line 85 of file gaussianlhplossmodel.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ expectedTrancheLoss()

Real expectedTrancheLoss ( const Date d) const
overridevirtual

Reimplemented from DefaultLossModel.

Definition at line 98 of file gaussianlhplossmodel.hpp.

+ Here is the call graph for this function:

◆ probOverLoss()

Real probOverLoss ( const Date d,
Real  remainingLossFraction 
) const
overridevirtual

The passed remainingLossFraction is in live tranche units, not portfolio as a fraction of the remaining(live) tranche (i.e. a_remaining=0% and det_remaining=100%)

Reimplemented from DefaultLossModel.

Definition at line 118 of file gaussianlhplossmodel.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ expectedShortfall()

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

Returns the ESF as an absolute amount (rather than a fraction)

Reimplemented from DefaultLossModel.

Definition at line 156 of file gaussianlhplossmodel.cpp.

+ Here is the call graph for this function:

◆ percentilePortfolioLossFraction()

Real percentilePortfolioLossFraction ( const Date d,
Real  perctl 
) const
protected

Definition at line 187 of file gaussianlhplossmodel.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ expectedRecovery()

Real expectedRecovery ( const Date ,
Size  iName,
const DefaultProbKey  
) const
overrideprotectedvirtual

Expected RR for name conditinal to default by that date.

Reimplemented from DefaultLossModel.

Definition at line 136 of file gaussianlhplossmodel.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 142 of file gaussianlhplossmodel.hpp.

+ Here is the call graph for this function:

◆ averageProb()

Probability averageProb ( const Date d) const

Definition at line 153 of file gaussianlhplossmodel.hpp.

+ Here is the caller graph for this function:

◆ averageRecovery()

Real averageRecovery ( const Date d) const

Definition at line 171 of file gaussianlhplossmodel.hpp.

+ Here is the caller graph for this function:

Member Data Documentation

◆ sqrt1minuscorrel_

Real sqrt1minuscorrel_
mutableprivate

Definition at line 193 of file gaussianlhplossmodel.hpp.

◆ correl_

Handle<Quote> correl_
private

Definition at line 195 of file gaussianlhplossmodel.hpp.

◆ rrQuotes_

std::vector<Handle<RecoveryRateQuote> > rrQuotes_
private

Definition at line 196 of file gaussianlhplossmodel.hpp.

◆ beta_

Real beta_
private

Definition at line 208 of file gaussianlhplossmodel.hpp.

◆ biphi_

Definition at line 209 of file gaussianlhplossmodel.hpp.

◆ phi_

CumulativeNormalDistribution const phi_
staticprivate
Initial value:
=
CumulativeNormalDistribution()

Definition at line 210 of file gaussianlhplossmodel.hpp.