20#ifndef quantlib_base_correl_lossmodel_hpp
21#define quantlib_base_correl_lossmodel_hpp
91 template <
class BaseModel_T,
class Corr2DInt_T>
95 typedef typename BaseModel_T::copulaType::initTraits
initTraits;
98 std::vector<Real> recoveries,
162 template<
class LM,
class I>
166 Real correlK1 = correlTS_->correlation(
d, attachRatio_);
167 Real correlK2 = correlTS_->correlation(
d, detachRatio_);
171 localCorrelationAttach_->setValue(correlK1);
173 basketAttach_->expectedTrancheLoss(
d);
174 localCorrelationDetach_->setValue(correlK2);
176 basketDetach_->expectedTrancheLoss(
d);
177 return expLossK2 - expLossK1;
189 #ifndef QL_PATCH_SOLARIS
197 scalarCorrelModelAttach_ = ext::make_shared<GaussianLHPLossModel>(
199 scalarCorrelModelDetach_ = ext::make_shared<GaussianLHPLossModel>(
202 basketAttach_->setLossModel(scalarCorrelModelAttach_);
203 basketDetach_->setLossModel(scalarCorrelModelDetach_);
210 ext::shared_ptr<GaussianConstantLossLM> lmA =
211 ext::make_shared<GaussianConstantLossLM>(
214 recoveries_.size(), copulaTraits_);
215 ext::shared_ptr<GaussianConstantLossLM> lmD =
216 ext::make_shared<GaussianConstantLossLM>(
219 recoveries_.size(), copulaTraits_);
220 scalarCorrelModelAttach_ =
221 ext::make_shared<GaussianBinomialLossModel>(lmA);
222 scalarCorrelModelDetach_ =
223 ext::make_shared<GaussianBinomialLossModel>(lmD);
225 basketAttach_->setLossModel(scalarCorrelModelAttach_);
226 basketDetach_->setLossModel(scalarCorrelModelDetach_);
234 ext::shared_ptr<TConstantLossLM> lmA =
235 ext::make_shared<TConstantLossLM>(
238 recoveries_.size(), copulaTraits_);
239 ext::shared_ptr<TConstantLossLM> lmD =
240 ext::make_shared<TConstantLossLM>(
243 recoveries_.size(), copulaTraits_);
245 scalarCorrelModelAttach_ =
246 ext::make_shared<TBinomialLossModel>(lmA);
247 scalarCorrelModelDetach_ =
248 ext::make_shared<TBinomialLossModel>(lmD);
250 basketAttach_->setLossModel(scalarCorrelModelAttach_);
251 basketDetach_->setLossModel(scalarCorrelModelDetach_);
261 ext::shared_ptr<GaussianConstantLossLM> lmA =
262 ext::make_shared<GaussianConstantLossLM>(
265 recoveries_.size(), copulaTraits_);
266 ext::shared_ptr<GaussianConstantLossLM> lmD =
267 ext::make_shared<GaussianConstantLossLM>(
270 recoveries_.size(), copulaTraits_);
274 scalarCorrelModelAttach_ =
275 ext::make_shared<IHGaussPoolLossModel>(lmA, 500);
276 scalarCorrelModelDetach_ =
277 ext::make_shared<IHGaussPoolLossModel>(lmD, 500);
279 basketAttach_->setLossModel(scalarCorrelModelAttach_);
280 basketDetach_->setLossModel(scalarCorrelModelDetach_);
287 #ifndef QL_PATCH_SOLARIS
basket of issuers and related notionals
ext::shared_ptr< Basket > basketDetach_
BaseModel_T::copulaType::initTraits initTraits
Handle< BaseCorrelationTermStructure< Corr2DInt_T > > correlTS_
ext::shared_ptr< BaseModel_T > scalarCorrelModelAttach_
BaseCorrelationLossModel(const Handle< BaseCorrelationTermStructure< Corr2DInt_T > > &correlTS, std::vector< Real > recoveries, const initTraits &traits=initTraits())
ext::shared_ptr< SimpleQuote > localCorrelationAttach_
Correlation buffer to pick up values from the surface and.
ext::shared_ptr< SimpleQuote > localCorrelationDetach_
void resetModel() override
Concrete models do now any updates/inits they need on basket reset.
Real expectedTrancheLoss(const Date &d) const override
ext::shared_ptr< Basket > basketAttach_
std::vector< Real > recoveries_
BaseModel_T::copulaType::initTraits copulaTraits_
ext::shared_ptr< BaseModel_T > scalarCorrelModelDetach_
bilinear interpolation between discrete points
RelinkableHandle< Basket > basket_
Shared handle to an observable.
Object that gets notified when a given observable changes.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
market element returning a stored value
static Settings & instance()
access to the unique instance
InhomogeneousPoolLossModel< GaussianCopulaPolicy > IHGaussPoolLossModel
BinomialLossModel< GaussianConstantLossLM > GaussianBinomialLossModel
BinomialLossModel< TConstantLossLM > TBinomialLossModel
BaseCorrelationLossModel< GaussianLHPLossModel, BilinearInterpolation > GaussianLHPFlatBCLM
purely virtual base class for market observables