21#ifndef quantlib_gaussian_lhp_lossmodel_hpp
22#define quantlib_gaussian_lhp_lossmodel_hpp
26#ifndef QL_PATCH_SOLARIS
72 const std::vector<Real>& recoveries);
76 const std::vector<Real>& recoveries);
96 Real detachLimit)
const;
100 const Real remainingfullNot =
basket_->remainingNotional(
d);
103 Real remainingAttachAmount =
basket_->remainingAttachmentAmount();
104 Real remainingDetachAmount =
basket_->remainingDetachmentAmount();
111 const Real attach = remainingAttachAmount / remainingfullNot;
112 const Real detach = remainingDetachAmount / remainingfullNot;
137 return rrQuotes_[iName].currentLink()->value();
143 const Real remainingNot =
basket_->remainingNotional(
d);
144 Real remainingAttachAmount =
basket_->remainingAttachmentAmount();
145 Real remainingDetachAmount =
basket_->remainingDetachmentAmount();
146 const Real attach = std::min(remainingAttachAmount / remainingNot, 1.);
147 const Real detach = std::min(remainingDetachAmount / remainingNot, 1.);
148 return remainingNot *
155 const std::vector<Probability> probs =
157 const std::vector<Real> remainingNots =
159 return std::inner_product(probs.begin(), probs.end(),
160 remainingNots.begin(),
Real(0.)) /
basket_->remainingNotional(
d);
174 const std::vector<Probability> probs =
176 std::vector<Real> recoveries;
178 recoveries.push_back(
rrQuotes_[i]->value());
179 std::vector<Real> notionals =
basket_->remainingNotionals(
d);
180 Real denominator = std::inner_product(notionals.begin(),
181 notionals.end(), probs.begin(),
Real(0.));
182 if(denominator == 0.)
return 0.;
184 std::transform(notionals.begin(), notionals.end(), probs.begin(),
185 notionals.begin(), std::multiplies<>());
187 return std::inner_product(recoveries.begin(), recoveries.end(),
188 notionals.begin(),
Real(0.)) / denominator;
basket of issuers and related notionals
bivariate cumulative normal distribution
Cumulative bivariate normal distibution function (West 2004)
Cumulative normal distribution function.
RelinkableHandle< Basket > basket_
Probability averageProb(const Date &d) const
Real percentilePortfolioLossFraction(const Date &d, Real perctl) const
Real percentile(const Date &d, Real perctl) const override
Value at Risk given a default loss percentile.
Real expectedTrancheLossImpl(Real remainingNot, Real prob, Real averageRR, Real attachLimit, Real detachLimit) const
std::vector< Handle< RecoveryRateQuote > > rrQuotes_
BivariateCumulativeNormalDistribution biphi_
Real averageRecovery(const Date &d) const
Real probOverLoss(const Date &d, Real remainingLossFraction) const override
void resetModel() override
Concrete models do now any updates/inits they need on basket reset.
Real expectedTrancheLoss(const Date &d) const override
Real expectedShortfall(const Date &d, Probability perctl) const override
Returns the ESF as an absolute amount (rather than a fraction)
GaussianCopulaPolicy copulaType
Real expectedRecovery(const Date &d, Size iName, const DefaultProbKey &ik) const override
static CumulativeNormalDistribution const phi_
Shared handle to an observable.
Generic multifactor latent variable model.
Maps function, bind and cref to either the boost or std implementation.
Real Probability
probability
std::size_t Size
size of a container
Generic multifactor latent variable model.
BivariateCumulativeNormalDistributionWe04DP BivariateCumulativeNormalDistribution
default bivariate implementation
Global definitions and compiler switches.