QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
|
#include <constantlosslatentmodel.hpp>
Public Member Functions | |
ConstantLossModel (const std::vector< std::vector< Real > > &factorWeights, const std::vector< Real > &recoveries, LatentModelIntegrationType::LatentModelIntegrationType integralType, const typename copulaPolicy::initTraits &ini=copulaPolicy::initTraits()) | |
ConstantLossModel (const Handle< Quote > &mktCorrel, const std::vector< Real > &recoveries, LatentModelIntegrationType::LatentModelIntegrationType integralType, Size nVariables, const typename copulaPolicy::initTraits &ini=copulaPolicy::initTraits()) | |
Public Member Functions inherited from ConstantLossLatentmodel< copulaPolicy > | |
ConstantLossLatentmodel (const std::vector< std::vector< Real > > &factorWeights, const std::vector< Real > &recoveries, LatentModelIntegrationType::LatentModelIntegrationType integralType, const initTraits &ini=initTraits()) | |
ConstantLossLatentmodel (const Handle< Quote > &mktCorrel, const std::vector< Real > &recoveries, LatentModelIntegrationType::LatentModelIntegrationType integralType, Size nVariables, const initTraits &ini=initTraits()) | |
Real | conditionalRecovery (const Date &d, Size iName, const std::vector< Real > &mktFactors) const |
Real | conditionalRecovery (Probability uncondDefP, Size iName, const std::vector< Real > &mktFactors) const |
Real | conditionalRecoveryInvP (Real invUncondDefP, Size iName, const std::vector< Real > &mktFactors) const |
Real | conditionalRecovery (Real latentVarSample, Size iName, const Date &d) const |
const std::vector< Real > & | recoveries () const |
Real | expectedRecovery (const Date &d, Size iName, const DefaultProbKey &defKeys) const |
Public Member Functions inherited from DefaultLatentModel< copulaPolicy > | |
DefaultLatentModel (const std::vector< std::vector< Real > > &factorWeights, LatentModelIntegrationType::LatentModelIntegrationType integralType, const initTraits &ini=initTraits()) | |
DefaultLatentModel (const Handle< Quote > &mktCorrel, Size nVariables, LatentModelIntegrationType::LatentModelIntegrationType integralType, const initTraits &ini=initTraits()) | |
void | resetBasket (const ext::shared_ptr< Basket > &basket) 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 |
Probability | probOfDefault (Size iName, const Date &d) const |
Real | defaultCorrelation (const Date &d, Size iNamei, Size iNamej) const |
Probability | probAtLeastNEvents (Size n, const Date &date) const |
Public Member Functions inherited from LatentModel< copulaPolicy > | |
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< Real > | allFactorCumulInverter (const std::vector< Real > &probs) const |
Real | latentVarValue (const std::vector< Real > &allFactors, Size iVar) const |
const copulaType & | copula () const |
Real | integratedExpectedValue (const ext::function< Real(const std::vector< Real > &v1)> &f) const |
std::vector< Real > | integratedExpectedValueV (const ext::function< std::vector< Real >(const std::vector< Real > &v1)> &f) const |
Public Member Functions inherited from Observer | |
Observer ()=default | |
Observer (const Observer &) | |
Observer & | operator= (const Observer &) |
virtual | ~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 | update ()=0 |
virtual void | deepUpdate () |
Public Member Functions inherited from Observable | |
Observable () | |
Observable (const Observable &) | |
Observable & | operator= (const Observable &) |
Observable (Observable &&)=delete | |
Observable & | operator= (Observable &&)=delete |
virtual | ~Observable ()=default |
void | notifyObservers () |
Protected Member Functions | |
Real | defaultCorrelation (const Date &d, Size iName, Size jName) const override |
Pearsons' default probability correlation. More... | |
Probability | probAtLeastNEvents (Size n, const Date &d) const override |
Real | expectedRecovery (const Date &d, Size iName, const DefaultProbKey &k) const override |
Protected Member Functions inherited from DefaultLatentModel< copulaPolicy > | |
void | update () override |
Probability | conditionalDefaultProbability (const Date &date, Size iName, const std::vector< Real > &mktFactors) const |
Probability | condProbProduct (Real invCumYProb1, Real invCumYProb2, Size iName1, Size iName2, const std::vector< Real > &mktFactors) const |
Real | conditionalProbAtLeastNEvents (Size n, const Date &date, const std::vector< Real > &mktFactors) const |
Conditional probability of n default events or more. More... | |
const ext::shared_ptr< LMIntegration > & | integration () const override |
access to integration: More... | |
Protected Member Functions inherited from LatentModel< copulaPolicy > | |
Protected Member Functions inherited from DefaultLossModel | |
DefaultLossModel ()=default | |
virtual Real | expectedTrancheLoss (const Date &d) const |
virtual Probability | probOverLoss (const Date &d, Real lossFraction) const |
virtual Real | percentile (const Date &d, Real percentile) const |
Value at Risk given a default loss percentile. More... | |
virtual Real | expectedShortfall (const Date &d, Real percentile) const |
Expected shortfall given a default loss percentile. More... | |
virtual std::vector< Real > | splitVaRLevel (const Date &d, Real loss) const |
Associated VaR fraction to each counterparty. More... | |
virtual std::vector< Real > | splitESFLevel (const Date &d, Real loss) const |
Associated ESF fraction to each counterparty. More... | |
virtual std::map< Real, Probability > | lossDistribution (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< Probability > | probsBeingNthEvent (Size n, const Date &d) const |
Private Member Functions | |
void | resetModel () override |
Concrete models do now any updates/inits they need on basket reset. More... | |
Additional Inherited Members | |
Public Types inherited from LatentModel< copulaPolicy > | |
typedef copulaPolicy | copulaType |
Public Types inherited from Observer | |
typedef set_type::iterator | iterator |
Protected Attributes inherited from DefaultLatentModel< copulaPolicy > | |
ext::shared_ptr< Basket > | basket_ |
ext::shared_ptr< LMIntegration > | integration_ |
Protected Attributes inherited from LatentModel< copulaPolicy > | |
std::vector< std::vector< Real > > | factorWeights_ |
Handle< Quote > | cachedMktFactor_ |
std::vector< Real > | idiosyncFctrs_ |
Size | nFactors_ |
Number of systemic factors. More... | |
Size | nVariables_ |
Number of latent model variables, idiosyncratic terms or model dim. More... | |
copulaType | copula_ |
Protected Attributes inherited from DefaultLossModel | |
RelinkableHandle< Basket > | basket_ |
ConstantLossLatentModel interface for loss models. While it does not provide distribution type losses (e.g. expected tranche losses) because it lacks an integration algorithm it serves to allow pricing of digital type products like NTDs.
Alternatively fuse with the aboves class.
Definition at line 118 of file constantlosslatentmodel.hpp.
ConstantLossModel | ( | const std::vector< std::vector< Real > > & | factorWeights, |
const std::vector< Real > & | recoveries, | ||
LatentModelIntegrationType::LatentModelIntegrationType | integralType, | ||
const typename copulaPolicy::initTraits & | ini = copulaPolicy::initTraits() |
||
) |
Definition at line 123 of file constantlosslatentmodel.hpp.
ConstantLossModel | ( | const Handle< Quote > & | mktCorrel, |
const std::vector< Real > & | recoveries, | ||
LatentModelIntegrationType::LatentModelIntegrationType | integralType, | ||
Size | nVariables, | ||
const typename copulaPolicy::initTraits & | ini = copulaPolicy::initTraits() |
||
) |
Definition at line 132 of file constantlosslatentmodel.hpp.
Pearsons' default probability correlation.
Reimplemented from DefaultLossModel.
Definition at line 148 of file constantlosslatentmodel.hpp.
|
overrideprotectedvirtual |
Returns the probaility of having a given or larger number of defaults in the basket portfolio at a given time.
Reimplemented from DefaultLossModel.
Definition at line 151 of file constantlosslatentmodel.hpp.
|
overrideprotectedvirtual |
Expected RR for name conditinal to default by that date.
Reimplemented from DefaultLossModel.
Definition at line 154 of file constantlosslatentmodel.hpp.
|
overrideprivatevirtual |
Concrete models do now any updates/inits they need on basket reset.
Implements DefaultLossModel.
Definition at line 159 of file constantlosslatentmodel.hpp.