19#ifndef quantext_extended_constantloss_latentmodel_hpp
20#define quantext_extended_constantloss_latentmodel_hpp
45 const std::vector<std::vector<Real>>& recoveryRates,
46 LatentModelIntegrationType::LatentModelIntegrationType integralType,
50 QL_REQUIRE(
recoveries.size() == factorWeights.size(),
"Incompatible factors and recovery sizes.");
56 const std::vector<std::vector<Real>>& recoveryRates,
57 LatentModelIntegrationType::LatentModelIntegrationType integralType, Size nVariables,
63 QL_REQUIRE(
recoveries.size() == nVariables,
"Incompatible model and recovery sizes.");
78 QL_REQUIRE(QuantLib::close_enough(
expectedRecovery,
recoveries_[i]),
"expected recovery does not match market recovery rate for obligor " << i);
86 Real
conditionalRecovery(Probability uncondDefP, Size iName,
const std::vector<Real>& mktFactors)
const {
120template <
class copulaPolicy>
125 const std::vector<std::vector<Real>>& recoveryRates,
126 LatentModelIntegrationType::LatentModelIntegrationType integralType,
127 const typename copulaPolicy::initTraits& ini = copulaPolicy::initTraits())
132 const std::vector<std::vector<Real>>& recoveryRates,
133 LatentModelIntegrationType::LatentModelIntegrationType integralType, Size nVariables,
134 const typename copulaPolicy::initTraits& ini = copulaPolicy::initTraits())
Default event Latent Model.
Real defaultCorrelation(const Date &d, Size iNamei, Size iNamej) const
void resetBasket(const QuantLib::ext::shared_ptr< Basket > basket) const
Probability probAtLeastNEvents(Size n, const Date &date) const
RelinkableHandle< QuantExt::Basket > basket_
Real conditionalRecovery(const Date &d, Size iName, const std::vector< Real > &mktFactors) const
const std::vector< std::vector< Real > > & recoveryRateGrids()
Real expectedRecovery(const Date &d, Size iName, const DefaultProbKey &defKeys) const
const std::vector< std::vector< Real > > & recoveryProbabilities()
const std::vector< Real > recoveries_
Real conditionalRecovery(Real latentVarSample, Size iName, const Date &d) const
Real conditionalRecoveryInvP(Real invUncondDefP, Size iName, const std::vector< Real > &mktFactors) const
const std::vector< Real > & recoveries() const
ExtendedConstantLossLatentModel(const Handle< Quote > &mktCorrel, const std::vector< Real > &recoveries, const std::vector< std::vector< Real > > &recoveryProbabilities, const std::vector< std::vector< Real > > &recoveryRates, LatentModelIntegrationType::LatentModelIntegrationType integralType, Size nVariables, const initTraits &ini=initTraits())
std::vector< std::vector< Real > > recoveryProbabilities_
Real conditionalRecovery(Probability uncondDefP, Size iName, const std::vector< Real > &mktFactors) const
copulaPolicy::initTraits initTraits
ExtendedConstantLossLatentModel(const std::vector< std::vector< Real > > &factorWeights, const std::vector< Real > &recoveries, const std::vector< std::vector< Real > > &recoveryProbabilities, const std::vector< std::vector< Real > > &recoveryRates, LatentModelIntegrationType::LatentModelIntegrationType integralType, const initTraits &ini=initTraits())
void checkStochasticRecoveries()
std::vector< std::vector< Real > > recoveryRates_
Real defaultCorrelation(const Date &d, Size iName, Size jName) const
Pearsons' default probability correlation.
Real expectedRecovery(const Date &d, Size iName, const DefaultProbKey &k) const
virtual void resetModel()
Concrete models do now any updates/inits they need on basket reset.
ExtendedConstantLossModel(const std::vector< std::vector< Real > > &factorWeights, const std::vector< Real > &recoveries, const std::vector< std::vector< Real > > &recoveryProbabilities, const std::vector< std::vector< Real > > &recoveryRates, LatentModelIntegrationType::LatentModelIntegrationType integralType, const typename copulaPolicy::initTraits &ini=copulaPolicy::initTraits())
Probability probAtLeastNEvents(Size n, const Date &d) const
ExtendedConstantLossModel(const Handle< Quote > &mktCorrel, const std::vector< Real > &recoveries, const std::vector< std::vector< Real > > &recoveryProbabilities, const std::vector< std::vector< Real > > &recoveryRates, LatentModelIntegrationType::LatentModelIntegrationType integralType, Size nVariables, const typename copulaPolicy::initTraits &ini=copulaPolicy::initTraits())
ExtendedConstantLossLatentModel< GaussianCopulaPolicy > ExtendedGaussianConstantLossLM