29 ext::shared_ptr<std::vector<std::pair<Date, Real> > > events,
34 :
CatSimulation(start, end), events_(
std::move(events)), eventsStart_(eventsStart),
35 eventsEnd_(eventsEnd) {
74 : events_(
std::move(events)), eventsStart_(eventsStart), eventsEnd_(eventsEnd) {}
122 : maxLoss_(maxLoss), lambda_(1.0/
years) {
123 QL_REQUIRE(mean<maxLoss,
"Mean "<<mean<<
"of the loss distribution must be less than the maximum loss "<<maxLoss);
124 Real normalizedMean = mean/maxLoss;
125 Real normalizedVar = stdDev*stdDev/(maxLoss*maxLoss);
126 QL_REQUIRE(normalizedVar<normalizedMean*(1.0-normalizedMean),
"Standard deviation of "<<stdDev<<
" is impossible to achieve in gamma distribution with mean "<<mean);
127 Real nu = normalizedMean*(1.0-normalizedMean)/normalizedVar - 1.0;
classes that encapsulate catastrophe risk
BetaRisk(Real maxLoss, Real years, Real mean, Real stdDev)
ext::shared_ptr< CatSimulation > newSimulation(const Date &start, const Date &end) const override
std::gamma_distribution< Real > gammaAlpha_
std::exponential_distribution< Real > exponential_
bool nextPath(std::vector< std::pair< Date, Real > > &path) override
BetaRiskSimulation(Date start, Date end, Real maxLoss, Real lambda, Real alpha, Real beta)
std::gamma_distribution< Real > gammaBeta_
Date::serial_type dayCount(const Date &, const Date &) const
Returns the number of days between two dates.
Time yearFraction(const Date &, const Date &, const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date()) const
Returns the period between two dates as a fraction of year.
ext::shared_ptr< std::vector< std::pair< Date, Real > > > events_
EventSet(ext::shared_ptr< std::vector< std::pair< Date, Real > > > events, Date eventsStart, Date eventsEnd)
ext::shared_ptr< CatSimulation > newSimulation(const Date &start, const Date &end) const override
EventSetSimulation(ext::shared_ptr< std::vector< std::pair< Date, Real > > > events, Date eventsStart, Date eventsEnd, Date start, Date end)
ext::shared_ptr< std::vector< std::pair< Date, Real > > > events_
bool nextPath(std::vector< std::pair< Date, Real > > &path) override
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
QL_INTEGER Integer
integer number
Real years(const Period &p)
Real days(const Period &p)