QuantLib: a free/open-source library for quantitative finance
Reference manual - version 1.40
Loading...
Searching...
No Matches
SpotRecoveryLatentModel< copulaPolicy > Class Template Reference

Random spot recovery rate latent variable portfolio model. More...

#include <ql/experimental/credit/spotlosslatentmodel.hpp>

Inheritance diagram for SpotRecoveryLatentModel< copulaPolicy >:

Public Member Functions

 SpotRecoveryLatentModel (const std::vector< std::vector< Real > > &factorWeights, const std::vector< Real > &recoveries, Real modelA, LatentModelIntegrationType::LatentModelIntegrationType integralType, const initTraits &ini=initTraits())
void resetBasket (const ext::shared_ptr< Basket > &basket) const
Probability conditionalDefaultProbability (const Date &date, Size iName, const std::vector< Real > &mktFactors) 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
Real expCondRecovery (const Date &d, Size iName, const std::vector< Real > &mktFactors) const
Real expCondRecoveryP (Real uncondDefP, Size iName, const std::vector< Real > &mktFactors) const
Real expCondRecoveryInvPinvRR (Real invUncondDefP, Real invUncondRR, Size iName, const std::vector< Real > &mktFactors) const
Real conditionalRecovery (Real latentVarSample, Size iName, const Date &d) const
Real latentRRVarValue (const std::vector< Real > &allFactors, Size iName) const
Real conditionalExpLossRR (const Date &d, Size iName, const std::vector< Real > &mktFactors) const
Real conditionalExpLossRRInv (Real invP, Real invRR, Size iName, const std::vector< Real > &mktFactors) const
Real expectedLoss (const Date &d, Size iName) const
Public Member Functions inherited from LatentModel< copulaPolicy >
void update () override
Size size () const
Size numFactors () const
 Number of systemic factors.
Size numTotalFactors () const
 Number of total free random factors; systemic and idiosyncratic.
 LatentModel (const std::vector< std::vector< Real > > &factorsWeights, const typename copulaType::initTraits &ini=typename copulaType::initTraits())
const std::vector< std::vector< Real > > & factorWeights () const
 Provides values of the factors \( a_{i,k} \).
const std::vector< Real > & idiosyncFctrs () const
 Provides values of the normalized idiosyncratic factors \( Z_i \).
Real latentVariableCorrel (Size iVar1, Size iVar2) const
 Latent variable correlations:
Probability cumulativeY (Real val, Size iVariable) const
Probability cumulativeZ (Real z) const
 Cumulative distribution of Z, the idiosyncratic/error factors.
Probability density (const std::vector< Real > &m) const
 Density function of M, the market/systemic factors.
Real inverseCumulativeDensity (Probability p, Size iFactor) const
 Inverse cumulative distribution of the systemic factor iFactor.
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 copulaType & copula () const
Real integratedExpectedValue (const std::function< Real(const std::vector< Real > &v1)> &f) const
std::vector< RealintegratedExpectedValueV (const std::function< std::vector< Real >(const std::vector< Real > &v1)> &f) const
Public Member Functions inherited from Observer
 Observer (const Observer &)
Observeroperator= (const Observer &)
std::pair< iterator, bool > registerWith (const ext::shared_ptr< Observable > &)
void registerWithObservables (const ext::shared_ptr< Observer > &)
Size unregisterWith (const ext::shared_ptr< Observable > &)
void unregisterWithAll ()
virtual void deepUpdate ()
Public Member Functions inherited from Observable
 Observable (const Observable &)
Observableoperator= (const Observable &)
 Observable (Observable &&)=delete
Observableoperator= (Observable &&)=delete
void notifyObservers ()

Protected Member Functions

const ext::shared_ptr< LMIntegration > & integration () const override
 access to integration:

Additional Inherited Members

typedef copulaPolicy copulaType
Public Types inherited from Observer
typedef set_type::iterator iterator
std::vector< std::vector< Real > > factorWeights_
Handle< QuotecachedMktFactor_
std::vector< RealidiosyncFctrs_
Size nFactors_
 Number of systemic factors.
Size nVariables_
 Number of latent model variables, idiosyncratic terms or model dim.
copulaType copula_

Detailed Description

template<class copulaPolicy>
class QuantLib::SpotRecoveryLatentModel< copulaPolicy >

Random spot recovery rate latent variable portfolio model.

See:
A Spot Stochastic Recovery Extension of the Gaussian Copula N.Bennani and J.Maetz, MPRA July 2009
Extension of Spot Recovery model for Gaussian Copula H.Li, October 2009, MPRA
The model is adpated here for a multifactor set up and a generic copula so it can be used for pricing in single factor mode or for risk metrics in its multifactor version.

Member Function Documentation

◆ integration()

template<class copulaPolicy>
const ext::shared_ptr< LMIntegration > & integration ( ) const
overrideprotectedvirtual

access to integration:

Reimplemented from LatentModel< copulaPolicy >.

◆ expCondRecovery()

template<class CP>
Real expCondRecovery ( const Date & d,
Size iName,
const std::vector< Real > & mktFactors ) const

Expected conditional spot recovery rate. Conditional on a set of systemic factors and default returns the integrated attainable recovery values.

Corresponds to a multifactor generalization of the model in eq. 44 on p.15 of Extension of Spot Recovery Model for Gaussian Copula Hui Li. 2009 Only remember that \(\rho_l Z \) there is here (multiple betas): \( \sum_k \beta_{ik}^l Z_k \) and that \( \rho_d \rho_l \) there is here: \( \sum_k \beta_{ik}^d \beta_{ik}^l \)
(d,l corresponds to first and last set of betas)

◆ conditionalRecovery()

template<class CP>
Real conditionalRecovery ( Real latentVarSample,
Size iName,
const Date & d ) const

Implements equation 42 on p.14 (second). Remember that for this call to make sense the sample used must be one leading to a default. Theres no check on this. This member typically to be used within a simulation.

◆ latentRRVarValue()

template<class CP>
Real latentRRVarValue ( const std::vector< Real > & allFactors,
Size iName ) const

Due to the way the latent model is splitted in two parts, we call the base class for the default sample and the LM owned here for the RR model sample. This sample only makes sense if it led to a default.

Parameters
allFactorsAll sampled factors, default and RR valiables.
iNameThe index of the name for which we want the RR sample

◆ expectedLoss()

template<class CP>
Real expectedLoss ( const Date & d,
Size iName ) const

Single name expected loss.

The main reason of this method is for the testing of this model. The model is coherent in that it preserves the single name expected loss and thus is coherent with the single name CDS market when used in the pricing context. i.e. it should match: \(pdef_i(d) \times RR_i \)