#include <orea/engine/historicalsensipnlcalculator.hpp>
|
typedef boost::accumulators::accumulator_set< QuantLib::Real, boost::accumulators::stats< boost::accumulators::tag::covariance< QuantLib::Real, boost::accumulators::tag::covariate1 > > > | accumulator |
|
◆ accumulator
typedef boost::accumulators::accumulator_set< QuantLib::Real, boost::accumulators::stats<boost::accumulators::tag::covariance<QuantLib::Real, boost::accumulators::tag::covariate1> > > accumulator |
|
private |
◆ CovarianceCalculator()
◆ initialise()
void initialise |
( |
const std::set< std::pair< RiskFactorKey, QuantLib::Size > > & |
keys | ) |
|
Definition at line 85 of file historicalsensipnlcalculator.cpp.
85 {
86
87
88
89 for (auto ito = keys.begin(); ito != keys.end(); ito++) {
91 for (auto iti = keys.begin(); iti != ito; iti++) {
93 }
94 }
95}
boost::accumulators::accumulator_set< QuantLib::Real, boost::accumulators::stats< boost::accumulators::tag::covariance< QuantLib::Real, boost::accumulators::tag::covariate1 > > > accumulator
std::map< std::pair< QuantLib::Size, QuantLib::Size >, accumulator > accCov_
◆ updateAccumulators()
void updateAccumulators |
( |
const QuantLib::ext::shared_ptr< NPVCube > & |
shiftCube, |
|
|
QuantLib::Date |
startDate, |
|
|
QuantLib::Date |
endDate, |
|
|
QuantLib::Size |
index |
|
) |
| |
Definition at line 97 of file historicalsensipnlcalculator.cpp.
97 {
98 TLOG(
"Updating Covariance accumlators for sensitivity record " << index);
101
103 Real oShift = shiftCube->get(it->first.first, 0, index);
104 if (it->first.first == it->first.second) {
105 it->second(oShift, covariate1 = oShift);
106 } else {
107 Real iShift = shiftCube->get(it->first.second, 0, index);
108 it->second(oShift, covariate1 = iShift);
109 }
110 }
111 }
112}
bool contains(const Date &d) const
◆ populateCovariance()
void populateCovariance |
( |
const std::set< std::pair< RiskFactorKey, QuantLib::Size > > & |
keys | ) |
|
Definition at line 114 of file historicalsensipnlcalculator.cpp.
114 {
115 LOG(
"Populate the covariance matrix with the calculated covariances");
117 Size i = 0;
118 for (auto ito = keys.begin(); ito != keys.end(); ito++) {
119 covariance_[i][i] = boost::accumulators::covariance(
accCov_.at(make_pair(ito->second, ito->second)));
120 Size j = 0;
121 for (auto iti = keys.begin(); iti != ito; iti++) {
123 boost::accumulators::covariance(
accCov_.at(make_pair(iti->second, ito->second)));
124 j++;
125 }
126 i++;
127 }
128}
QuantLib::Matrix covariance_
◆ covariance()
const Matrix & covariance |
( |
| ) |
const |
◆ accCov_
std::map<std::pair<QuantLib::Size, QuantLib::Size>, accumulator> accCov_ |
|
private |
◆ covariancePeriod_
◆ covariance_
QuantLib::Matrix covariance_ |
|
private |