QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
RandomLossLM< copulaPolicy, USNG > Class Template Reference

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

+ Inheritance diagram for RandomLossLM< copulaPolicy, USNG >:
+ Collaboration diagram for RandomLossLM< copulaPolicy, USNG >:

Public Member Functions

 RandomLossLM (const ext::shared_ptr< SpotRecoveryLatentModel< copulaPolicy > > &copula, Size nSims=0, Real accuracy=1.e-6, BigNatural seed=2863311530UL)
 
- Public Member Functions inherited from RandomLM< derivedRandomLM, copulaPolicy, USNG >
 ~RandomLM () override=default
 
- Public Member Functions inherited from LazyObject
 LazyObject ()
 
 ~LazyObject () override=default
 
void update () override
 
bool isCalculated () const
 
void forwardFirstNotificationOnly ()
 
void alwaysForwardNotifications ()
 
void recalculate ()
 
void freeze ()
 
void unfreeze ()
 
- 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 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

void nextSample (const std::vector< Real > &values) const
 
void initDates () const
 
Real getEventRecovery (const defaultSimEvent &evt) const
 
Real latentVarValue (const std::vector< Real > &factorsSample, Size iVar) const
 
Size basketSize () const
 
Real conditionalRecovery (Real latentVarSample, Size iName, const Date &d) const
 
- Protected Member Functions inherited from RandomLM< derivedRandomLM, copulaPolicy, USNG >
 RandomLM (Size numFactors, Size numLMVars, copulaPolicy copula, Size nSims, BigNatural seed)
 
void update () override
 
void performCalculations () const override
 
void performSimulations () const
 
const std::vector< simEvent< derivedRandomLM< copulaPolicy, USNG > > > & getSim (const Size iSim) const
 
Real getEventRecovery (const simEvent< derivedRandomLM< copulaPolicy, USNG > > &evt) const
 
Probability probAtLeastNEvents (Size n, const Date &d) const override
 
std::vector< ProbabilityprobsBeingNthEvent (Size n, const Date &d) const override
 
Real defaultCorrelation (const Date &d, Size iName, Size jName) const override
 Pearsons' default probability correlation. More...
 
Real expectedTrancheLoss (const Date &d) const override
 
virtual std::pair< Real, RealexpectedTrancheLossInterval (const Date &d, Probability confidencePerc) const
 
std::map< Real, ProbabilitylossDistribution (const Date &d) const override
 Full loss distribution. More...
 
virtual Histogram computeHistogram (const Date &d) const
 
Real expectedShortfall (const Date &d, Real percent) const override
 Expected shortfall given a default loss percentile. More...
 
Real percentile (const Date &d, Real percentile) const override
 Value at Risk given a default loss percentile. More...
 
virtual ext::tuple< Real, Real, RealpercentileAndInterval (const Date &d, Real percentile) const
 
std::vector< RealsplitVaRLevel (const Date &date, Real loss) const override
 
virtual std::vector< std::vector< Real > > splitVaRAndError (const Date &date, Real loss, Probability confInterval) const
 
- Protected Member Functions inherited from LazyObject
virtual void calculate () const
 
- Protected Member Functions inherited from DefaultLossModel
 DefaultLossModel ()=default
 
virtual Probability probOverLoss (const Date &d, Real lossFraction) const
 
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 Real expectedRecovery (const Date &, Size iName, const DefaultProbKey &) const
 

Private Types

typedef simEvent< RandomLossLMdefaultSimEvent
 

Private Member Functions

void resetModel () override
 Concrete models do now any updates/inits they need on basket reset. More...
 

Private Attributes

const ext::shared_ptr< SpotRecoveryLatentModel< copulaPolicy > > copula_
 
Real accuracy_
 
std::vector< ProbabilityhorizonDefaultPs_
 

Friends

class RandomLM< ::QuantLib::RandomLossLM, copulaPolicy, USNG >
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 
- Protected Attributes inherited from RandomLM< derivedRandomLM, copulaPolicy, USNG >
const Size numFactors_
 
const Size numLMVars_
 
const Size nSims_
 
std::vector< std::vector< simEvent< derivedRandomLM< copulaPolicy, USNG > > > > simsBuffer_
 
copulaPolicy copula_
 
ext::shared_ptr< copulaRNG_typecopulasRng_
 
- Protected Attributes inherited from LazyObject
bool calculated_ = false
 
bool frozen_ = false
 
bool alwaysForward_
 
- Protected Attributes inherited from DefaultLossModel
RelinkableHandle< Basketbasket_
 
- Static Protected Attributes inherited from RandomLM< derivedRandomLM, copulaPolicy, USNG >
static const Size maxHorizon_ = 4050
 

Detailed Description

template<class copulaPolicy, class USNG = SobolRsg>
class QuantLib::RandomLossLM< copulaPolicy, USNG >

Random spot recovery rate loss model simulation for an arbitrary copula.

Definition at line 71 of file randomlosslatentmodel.hpp.

Member Typedef Documentation

◆ defaultSimEvent

Definition at line 74 of file randomlosslatentmodel.hpp.

Constructor & Destructor Documentation

◆ RandomLossLM()

RandomLossLM ( const ext::shared_ptr< SpotRecoveryLatentModel< copulaPolicy > > &  copula,
Size  nSims = 0,
Real  accuracy = 1.e-6,
BigNatural  seed = 2863311530UL 
)
explicit

Definition at line 80 of file randomlosslatentmodel.hpp.

Member Function Documentation

◆ nextSample()

void nextSample ( const std::vector< Real > &  values) const
protected

Definition at line 157 of file randomlosslatentmodel.hpp.

+ Here is the call graph for this function:

◆ initDates()

void initDates ( ) const
protected

Definition at line 107 of file randomlosslatentmodel.hpp.

+ Here is the call graph for this function:

◆ getEventRecovery()

Real getEventRecovery ( const defaultSimEvent evt) const
protected

Definition at line 121 of file randomlosslatentmodel.hpp.

◆ latentVarValue()

Real latentVarValue ( const std::vector< Real > &  factorsSample,
Size  iVar 
) const
protected

Definition at line 125 of file randomlosslatentmodel.hpp.

◆ basketSize()

Size basketSize ( ) const
protected

Definition at line 129 of file randomlosslatentmodel.hpp.

◆ conditionalRecovery()

Real conditionalRecovery ( Real  latentVarSample,
Size  iName,
const Date d 
) const
protected

◆ resetModel()

void resetModel ( )
overrideprivatevirtual

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

Implements DefaultLossModel.

Definition at line 134 of file randomlosslatentmodel.hpp.

+ Here is the call graph for this function:

Friends And Related Function Documentation

◆ RandomLM< ::QuantLib::RandomLossLM, copulaPolicy, USNG >

friend class RandomLM< ::QuantLib::RandomLossLM, copulaPolicy, USNG >
friend

Definition at line 80 of file randomlosslatentmodel.hpp.

Member Data Documentation

◆ copula_

const ext::shared_ptr<SpotRecoveryLatentModel<copulaPolicy> > copula_
private

Definition at line 76 of file randomlosslatentmodel.hpp.

◆ accuracy_

Real accuracy_
private

Definition at line 78 of file randomlosslatentmodel.hpp.

◆ horizonDefaultPs_

std::vector<Probability> horizonDefaultPs_
mutableprivate

Definition at line 149 of file randomlosslatentmodel.hpp.