27 const std::vector<std::vector<Real> >& factorWeights,
30 for (
int tOrder : vals.
tOrders) {
32 QL_REQUIRE(tOrder > 2,
"Non finite variance T in latent model.");
42 for (
const auto& factorWeight : factorWeights) {
46 "Incompatible number of T functions and number of factors.");
48 Real factorsNorm = std::inner_product(factorWeight.begin(), factorWeight.end(),
49 factorWeight.begin(),
Real(0.));
51 "Non normal random factor combination.");
52 Real idiosyncFctr = std::sqrt(1.-factorsNorm);
55 std::vector<Real> normFactorWeights;
56 for (
Size iFactor = 0; iFactor < factorWeight.size(); iFactor++)
57 normFactorWeights.push_back(factorWeight[iFactor] *
varianceFactors_[iFactor]);
66 const std::vector<Real>& probs)
const
68 #if defined(QL_EXTRA_SAFETY_CHECKS)
71 "Incompatible sample and latent model sizes");
74 std::vector<Real> result(probs.size());
75 Size indexSystemic = 0;
78 [&](
Probability p) { return inverseCumulativeDensity(p, indexSystemic++); });
81 [&](
Probability p) { return inverseCumulativeZ(p); });
TCopulaPolicy(const std::vector< std::vector< Real > > &factorWeights=std::vector< std::vector< Real > >(), const initTraits &vals=initTraits())
std::vector< boost::math::students_t_distribution< Real > > distributions_
std::vector< Real > allFactorCumulInverter(const std::vector< Real > &probs) const
std::vector< Real > varianceFactors_
std::vector< CumulativeBehrensFisher > latentVarsCumul_
std::vector< InverseCumulativeBehrensFisher > latentVarsInverters_
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Real Probability
probability
std::size_t Size
size of a container
std::vector< Integer > tOrders