QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
|
Saddle point portfolio credit default loss model. More...
#include <saddlepointlossmodel.hpp>
Classes | |
class | SaddleObjectiveFunction |
class | SaddlePercObjFunction |
Public Member Functions | |
SaddlePointLossModel (const ext::shared_ptr< ConstantLossLatentmodel< CP > > &m) | |
Real | percentile (const Date &d, Probability percentile) const override |
Probability | probOverLoss (const Date &d, Real trancheLossFract) const override |
std::map< Real, Probability > | lossDistribution (const Date &d) const override |
Full loss distribution. More... | |
Probability | probOverPortfLoss (const Date &d, Real loss) const |
Real | expectedTrancheLoss (const Date &d) const override |
Probability | probDensity (const Date &d, Real loss) const |
std::vector< Real > | splitVaRLevel (const Date &date, Real loss) const override |
Real | expectedShortfall (const Date &d, Probability percentile) const override |
Expected shortfall given a default loss percentile. More... | |
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 | CumulantGeneratingCond (const std::vector< Real > &invUncondProbs, Real lossFraction, const std::vector< Real > &mktFactor) const |
Real | CumGen1stDerivativeCond (const std::vector< Real > &invUncondProbs, Real saddle, const std::vector< Real > &mktFactor) const |
Real | CumGen2ndDerivativeCond (const std::vector< Real > &invUncondProbs, Real saddle, const std::vector< Real > &mktFactor) const |
Real | CumGen3rdDerivativeCond (const std::vector< Real > &invUncondProbs, Real saddle, const std::vector< Real > &mktFactor) const |
Real | CumGen4thDerivativeCond (const std::vector< Real > &invUncondProbs, Real saddle, const std::vector< Real > &mktFactor) const |
ext::tuple< Real, Real, Real, Real > | CumGen0234DerivCond (const std::vector< Real > &invUncondProbs, Real saddle, const std::vector< Real > &mktFactor) const |
ext::tuple< Real, Real > | CumGen02DerivCond (const std::vector< Real > &invUncondProbs, Real saddle, const std::vector< Real > &mktFactor) const |
Real | CumulantGenerating (const Date &date, Real s) const |
Real | CumGen1stDerivative (const Date &date, Real s) const |
Real | CumGen2ndDerivative (const Date &date, Real s) const |
Real | CumGen3rdDerivative (const Date &date, Real s) const |
Real | CumGen4thDerivative (const Date &date, Real s) const |
Real | findSaddle (const std::vector< Real > &invUncondProbs, Real lossLevel, const std::vector< Real > &mktFactor, Real accuracy=1.0e-3, Natural maxEvaluations=50) const |
Probability | probOverLossCond (const std::vector< Real > &invUncondProbs, Real trancheLossFract, const std::vector< Real > &mktFactor) const |
Probability | probOverLossPortfCond1stOrder (const std::vector< Real > &invUncondProbs, Real loss, const std::vector< Real > &mktFactor) const |
Probability | probOverLossPortfCond (const std::vector< Real > &invUncondProbs, Real loss, const std::vector< Real > &mktFactor) const |
Probability | probDensityCond (const std::vector< Real > &invUncondProbs, Real loss, const std::vector< Real > &mktFactor) const |
std::vector< Real > | splitLossCond (const std::vector< Real > &invUncondProbs, Real loss, std::vector< Real > mktFactor) const |
Real | expectedShortfallFullPortfolioCond (const std::vector< Real > &invUncondProbs, Real lossPerc, const std::vector< Real > &mktFactor) const |
Real | expectedShortfallTrancheCond (const std::vector< Real > &invUncondProbs, Real lossPerc, Probability percentile, const std::vector< Real > &mktFactor) const |
std::vector< Real > | expectedShortfallSplitCond (const std::vector< Real > &invUncondProbs, Real lossPerc, const std::vector< Real > &mktFactor) const |
Real | conditionalExpectedLoss (const std::vector< Real > &invUncondProbs, const std::vector< Real > &mktFactor) const |
Real | conditionalExpectedTrancheLoss (const std::vector< Real > &invUncondProbs, const std::vector< Real > &mktFactor) const |
void | resetModel () override |
Concrete models do now any updates/inits they need on basket reset. More... | |
Protected Member Functions inherited from DefaultLossModel | |
DefaultLossModel ()=default | |
virtual std::vector< Real > | splitESFLevel (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 std::vector< Probability > | probsBeingNthEvent (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 |
virtual Real | expectedRecovery (const Date &, Size iName, const DefaultProbKey &) const |
Protected Attributes | |
const ext::shared_ptr< ConstantLossLatentmodel< CP > > | copula_ |
Size | remainingSize_ |
std::vector< Real > | remainingNotionals_ |
Real | remainingNotional_ |
Real | attachRatio_ |
Real | detachRatio_ |
Protected Attributes inherited from DefaultLossModel | |
RelinkableHandle< Basket > | basket_ |
Saddle point portfolio credit default loss model.
Definition at line 100 of file saddlepointlossmodel.hpp.
|
explicit |
Definition at line 102 of file saddlepointlossmodel.hpp.
|
protected |
Returns the cumulant generating function (zero-th order expansion term) conditional to the mkt factor: \( K = \sum_j ln(1-p_j + p_j e^{N_j \times lgd_j \times s}) \)
Definition at line 566 of file saddlepointlossmodel.hpp.
|
protected |
Returns the first derivative of the cumulant generating function (first order expansion term) conditional to the mkt factor: \( K1 = \sum_j \frac{p_j \times N_j \times LGD_j \times e^{N_j \times LGD_j \times s}} \ {1-p_j + p_j e^{N_j \times LGD_j \times s}} \) One of its properties is that its value at zero is the portfolio expected loss (in fractional units). Its value at infinity is the max attainable portfolio loss. To be understood conditional to the market factor.
Definition at line 587 of file saddlepointlossmodel.hpp.
|
protected |
Returns the second derivative of the cumulant generating function (first order expansion term) conditional to the mkt factor: \( K2 = \sum_j \frac{p_j \times (N_j \times LGD_j)^2 \times e^{N_j \times LGD_j \times s}} {1-p_j + p_j e^{N_j \times LGD_j \times s}} - (\frac{p_j \times N_j \times LGD_j \times e^{N_j \times LGD_j \times s}} {1-p_j + p_j e^{N_j \times LGD_j \times s}})^2 \)
Definition at line 610 of file saddlepointlossmodel.hpp.
|
protected |
Definition at line 635 of file saddlepointlossmodel.hpp.
|
protected |
Definition at line 666 of file saddlepointlossmodel.hpp.
|
protected |
Returns the cumulant and second to fourth derivatives together. Included for optimization, most methods work on expansion of these terms. Alternatively use a local private buffer member?
Definition at line 699 of file saddlepointlossmodel.hpp.
|
protected |
Definition at line 741 of file saddlepointlossmodel.hpp.
Returns the cumulant generating function (zero-th order expansion term) weighting the conditional value by the prob density of the market factor, called by integrations
Definition at line 387 of file saddlepointlossmodel.hpp.
Definition at line 403 of file saddlepointlossmodel.hpp.
Definition at line 419 of file saddlepointlossmodel.hpp.
Definition at line 435 of file saddlepointlossmodel.hpp.
Definition at line 451 of file saddlepointlossmodel.hpp.
|
protected |
Calculates the mkt-fct-conditional saddle point for the loss level given and the probability passed. The date is implicitly given through the probability. Performance requires to pass the probabilities for that date. Otherwise once we integrate this over the market factor we would be computing the same probabilities over and over. While this works fine here some models of the recovery rate might require the date.
The passed lossLevel is in total portfolio loss fractional units.
Definition at line 776 of file saddlepointlossmodel.hpp.
|
overridevirtual |
Returns the loss amount at the requested date for which the probability of lossing that amount or less is equal to the value passed.
Reimplemented from DefaultLossModel.
Definition at line 847 of file saddlepointlossmodel.hpp.
|
protected |
Conditional (on the mkt factor) prob of a loss fraction of the the tranched portfolio.
The trancheLossFract parameter is the fraction over the tranche notional and must be in [0,1].
Definition at line 877 of file saddlepointlossmodel.hpp.
|
protected |
Definition at line 1013 of file saddlepointlossmodel.hpp.
|
overridevirtual |
Probability of the tranche losing the same or more than the fractional amount given.
The passed lossFraction is a fraction of losses over the tranche notional (not the portfolio).
Reimplemented from DefaultLossModel.
Definition at line 467 of file saddlepointlossmodel.hpp.
|
overridevirtual |
Full loss distribution.
Reimplemented from DefaultLossModel.
Definition at line 896 of file saddlepointlossmodel.hpp.
|
protected |
Probability of having losses in the portfolio due to default events equal or larger than a given absolute loss value on a given date conditional to the latent model factor. The integral expression on the expansion is the first order integration as presented in several references, see for instance; equation 8 in R.Martin, K.Thompson, and C. Browne 's 'Taking to the Saddle', Risk Magazine, June 2001, page 91
The passed loss is in absolute value.
Definition at line 919 of file saddlepointlossmodel.hpp.
Probability probOverPortfLoss | ( | const Date & | d, |
Real | loss | ||
) | const |
Definition at line 488 of file saddlepointlossmodel.hpp.
Reimplemented from DefaultLossModel.
Definition at line 504 of file saddlepointlossmodel.hpp.
|
protected |
Probability density of having losses in the total portfolio (untranched) due to default events equal to a given value on a given date conditional to the latent model factor. Based on the integrals of the expected shortfall.
NOTICE THIS IS ON THE TOTAL PORTFOLIO -— UNTRANCHED Probability density of having losses in the portfolio due to default events equal to a given value on a given date conditional to the w latent model factor. Based on the integrals of the expected shortfall. See......refernce.
Definition at line 1082 of file saddlepointlossmodel.hpp.
Probability probDensity | ( | const Date & | d, |
Real | loss | ||
) | const |
Definition at line 520 of file saddlepointlossmodel.hpp.
|
protected |
Definition at line 1127 of file saddlepointlossmodel.hpp.
|
protected |
Definition at line 1266 of file saddlepointlossmodel.hpp.
|
protected |
Definition at line 1230 of file saddlepointlossmodel.hpp.
|
protected |
Definition at line 1195 of file saddlepointlossmodel.hpp.
Sensitivities of the individual names to a given portfolio loss value due to defaults. It returns ratios to the total structure notional, which aggregated add up to the requested loss value. Notice then that it refers to the total portfolio, not the tranched basket.
The passed loss is the loss amount level at which we want to request the sensitivity. Equivalent to a percentile.
Reimplemented from DefaultLossModel.
Definition at line 536 of file saddlepointlossmodel.hpp.
|
overridevirtual |
Expected shortfall given a default loss percentile.
Reimplemented from DefaultLossModel.
Definition at line 1329 of file saddlepointlossmodel.hpp.
|
protected |
Definition at line 1156 of file saddlepointlossmodel.hpp.
|
protected |
Definition at line 1174 of file saddlepointlossmodel.hpp.
|
overrideprotectedvirtual |
Concrete models do now any updates/inits they need on basket reset.
Implements DefaultLossModel.
Definition at line 338 of file saddlepointlossmodel.hpp.
|
protected |
Definition at line 348 of file saddlepointlossmodel.hpp.
|
mutableprotected |
Definition at line 350 of file saddlepointlossmodel.hpp.
|
mutableprotected |
Definition at line 351 of file saddlepointlossmodel.hpp.
|
mutableprotected |
Definition at line 352 of file saddlepointlossmodel.hpp.
|
mutableprotected |
Definition at line 354 of file saddlepointlossmodel.hpp.
|
protected |
Definition at line 354 of file saddlepointlossmodel.hpp.