QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
|
Random spot recovery rate latent variable portfolio model. More...
#include <spotlosslatentmodel.hpp>
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. 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 | |
const ext::shared_ptr< LMIntegration > & | integration () const override |
access to integration: More... | |
Protected Member Functions inherited from LatentModel< copulaPolicy > |
Private Types | |
typedef copulaPolicy::initTraits | initTraits |
Private Attributes | |
const std::vector< Real > | recoveries_ |
const Real | modelA_ |
std::vector< Real > | crossIdiosyncFctrs_ |
Size | numNames_ |
ext::shared_ptr< Basket > | basket_ |
ext::shared_ptr< LMIntegration > | integration_ |
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 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_ |
Random spot recovery rate latent variable portfolio model.
Definition at line 42 of file spotlosslatentmodel.hpp.
|
private |
Definition at line 63 of file spotlosslatentmodel.hpp.
SpotRecoveryLatentModel | ( | const std::vector< std::vector< Real > > & | factorWeights, |
const std::vector< Real > & | recoveries, | ||
Real | modelA, | ||
LatentModelIntegrationType::LatentModelIntegrationType | integralType, | ||
const initTraits & | ini = initTraits() |
||
) |
|
overrideprotectedvirtual |
access to integration:
Reimplemented from LatentModel< copulaPolicy >.
Definition at line 60 of file spotlosslatentmodel.hpp.
void resetBasket | ( | const ext::shared_ptr< Basket > & | basket | ) | const |
Definition at line 138 of file spotlosslatentmodel.hpp.
Probability conditionalDefaultProbability | ( | const Date & | date, |
Size | iName, | ||
const std::vector< Real > & | mktFactors | ||
) | const |
Definition at line 147 of file spotlosslatentmodel.hpp.
Probability conditionalDefaultProbability | ( | Probability | prob, |
Size | iName, | ||
const std::vector< Real > & | mktFactors | ||
) | const |
Definition at line 161 of file spotlosslatentmodel.hpp.
Probability conditionalDefaultProbabilityInvP | ( | Real | invCumYProb, |
Size | iName, | ||
const std::vector< Real > & | m | ||
) | const |
Definition at line 181 of file spotlosslatentmodel.hpp.
Expected conditional spot recovery rate. Conditional on a set of systemic factors and default returns the integrated attainable recovery values.
Definition at line 201 of file spotlosslatentmodel.hpp.
Definition at line 219 of file spotlosslatentmodel.hpp.
Real expCondRecoveryInvPinvRR | ( | Real | invUncondDefP, |
Real | invUncondRR, | ||
Size | iName, | ||
const std::vector< Real > & | mktFactors | ||
) | const |
Definition at line 229 of file spotlosslatentmodel.hpp.
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.
Definition at line 256 of file spotlosslatentmodel.hpp.
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.
allFactors | All sampled factors, default and RR valiables. |
iName | The index of the name for which we want the RR sample |
Definition at line 282 of file spotlosslatentmodel.hpp.
Real conditionalExpLossRR | ( | const Date & | d, |
Size | iName, | ||
const std::vector< Real > & | mktFactors | ||
) | const |
Definition at line 291 of file spotlosslatentmodel.hpp.
Real conditionalExpLossRRInv | ( | Real | invP, |
Real | invRR, | ||
Size | iName, | ||
const std::vector< Real > & | mktFactors | ||
) | const |
Definition at line 308 of file spotlosslatentmodel.hpp.
Single name expected loss.
Definition at line 319 of file spotlosslatentmodel.hpp.
|
private |
Definition at line 51 of file spotlosslatentmodel.hpp.
|
private |
Definition at line 52 of file spotlosslatentmodel.hpp.
|
private |
Definition at line 54 of file spotlosslatentmodel.hpp.
|
mutableprivate |
Definition at line 55 of file spotlosslatentmodel.hpp.
|
mutableprivate |
Definition at line 56 of file spotlosslatentmodel.hpp.
|
private |
Definition at line 57 of file spotlosslatentmodel.hpp.